Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[mininet-discuss] How to use pdb to debug POX controller?

Murphy McCauley murphy.mccauley at gmail.com
Fri Mar 13 00:48:26 PDT 2015


That works too.  Glad you got it working.

Future readers, see inline for a typo correction. :)

On Mar 12, 2015, at 8:38 PM, David Li <dlipubkey at gmail.com> wrote:

> Yes, you are right. I put another set_trace() inside the PacketIn
> handler and it hit this time!
> I will ask on pox-dev list in the future.
> 
> Thanks.
> 
> On Thu, Mar 12, 2015 at 5:19 PM, Murphy McCauley
> <murphy.mccauley at gmail.com> wrote:
>> (Note: This would seem to be more appropriate for the pox-dev mailing list, since it isn't really related to Mininet.)
>> 
>> I think the problem is that set_trace() sets up a *thread* to be debugged.  POX's default is to not use the main thread for the cooperative task system, but the main thread *is* probably the one which calls all the launch functions.  So long story short, I think you're calling set_trace() on the wrong thread.  I think the easiest way to fix this is probably doing core.callLayer(pdb.set_trace) or


Err... callLa*t*er

>> something like that from your launch function so that it gets called from the cooperative thread.
>> 
>> -- Murphy
>> 
>> On Mar 12, 2015, at 5:02 PM, David Li <dlipubkey at gmail.com> wrote:
>> 
>>> Hi,
>>> 
>>> I am using POX controller to connect to a mininet switch. My intention
>>> is to use break points to trace code flows. Here is my basic setup:
>>> 
>>> 
>>> 1. Launch mininet: sudo mn --topo=single,3 --controller=remote --switch=ovsk
>>> 
>>> 2. I use l2_learning switch and added single line in the launch function:
>>> 
>>> import pdb; pdb.set_trace()
>>> core.registerNew(l2_learning, str_to_bool(transparent))
>>> 
>>> 3. Launch POX controller using pdb, the debugger stopped at the above
>>> line and I set a break point on line 99 inside the _handle_PacketIn().
>>> 
>>>    line 99: packet = event.parsed
>>> 
>>>   The console output looks like:
>>> 
>>> mininet at mininet-vm:~/pox$ ./pox.py log.level --DEBUG forwarding.l2_learning
>>> POX 0.2.0 (carp) / Copyright 2011-2013 James McCauley, et al.
>>>> /home/mininet/pox/pox/forwarding/l2_learning.py(202)launch()
>>> -> core.registerNew(l2_learning, str_to_bool(transparent))
>>> (Pdb) break /home/mininet/pox/pox/forwarding/l2_learning.py:99
>>> Breakpoint 1 at /home/mininet/pox/pox/forwarding/l2_learning.py:99
>>> (Pdb) c
>>> DEBUG:core:POX 0.2.0 (carp) going up...
>>> DEBUG:core:Running on CPython (2.7.6/Mar 22 2014 22:59:38)
>>> DEBUG:core:Platform is Linux-3.13.0-24-generic-i686-with-Ubuntu-14.04-trusty
>>> INFO:core:POX 0.2.0 (carp) is up.
>>> DEBUG:openflow.of_01:Listening on 0.0.0.0:6633
>>> INFO:openflow.of_01:[00-00-00-00-00-01 1] connected
>>> 
>>> 
>>> 4. Then I ping from h1 to h2. Here I assume this would hit my break
>>> point but it never did.
>>> 
>>> Anyone has any experience how to to this?
>>> 
>>> Thanks.
>>> _______________________________________________
>>> mininet-discuss mailing list
>>> mininet-discuss at lists.stanford.edu
>>> https://mailman.stanford.edu/mailman/listinfo/mininet-discuss
>> 



More information about the mininet-discuss mailing list