GDB and breakpoints in ns3

If you want debug your simulation, a good option is use gdb.

If you want create breakpoints (watchpoints) in your file, just add this line:

ns3::BreakpointFallback(); 

Also, you can do it by the classic way with these lines:

#include <signal.h>
raise(SIGINT);

Now, just execute:

./waf --command-template="gdb %s" --run $FILE_NAME

run

Whre $FILE_NAME is your simulation file, frequently located at scratch folder. As you can see with "where", the breakpoint was in line 101.












You will get these follows signals:

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007fffeaba02a9 in raise (sig=5) at ../sysdeps/unix/sysv/linux/pt-raise.c:35
35 ../sysdeps/unix/sysv/linux/pt-raise.c: No such file or directory.

Program received signal SIGINT, Interrupt.
0x00007fffeaba02a9 in raise (sig=2) at ../sysdeps/unix/sysv/linux/pt-raise.c:35
35 ../sysdeps/unix/sysv/linux/pt-raise.c: No such file or directory.



Comments

Popular posts from this blog

from: can't read /var/mail/ in Python scripts

How to fix Android when developer options are not available for this user

Fix "Set scan parameters failed: Input/output error" on Ubuntu 16.04