ns2 – how to debug segmentation faults

1. Set the limit of coredumps to really huge so that they are allways produced, in the terminal window, type:

ulimit -c 100000

2. add “-g” to the CFLAGS in the Makefile so that debugging is enabled. Run make clean and then make.

3.When a segmentation fault occurs, type: “gdb -c core“, then in gdb tell it that you want to load symbols from the ns executable with “file ns“,and then you can inspect the stack (“bt“), select a stack frame (“select 0“) and inspect the values of variables in that stack frame.

Ref. http://article.gmane.org/gmane.network.simulator.isi/2766/match=segmentation

Advertisement

Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.