Search Mailing List Archives
[mininet-discuss] How to use pdb to debug POX controller?
murphy.mccauley at gmail.com
Thu Mar 12 17:19:00 PDT 2015
(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 something like that from your launch function so that it gets called from the cooperative thread.
On Mar 12, 2015, at 5:02 PM, David Li <dlipubkey at gmail.com> wrote:
> 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.
> -> 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?
> mininet-discuss mailing list
> mininet-discuss at lists.stanford.edu
More information about the mininet-discuss