Wednesday, 15 August 2012

c++ - GDB and NS2: how to stop program at some Function call -



c++ - GDB and NS2: how to stop program at some Function call -

i using gdb debug ns-2 simulator network protocols. takes .tcl file input , interpret it. [i think interpreter.]

some of code written in tcl (events , creation of network components) , in c++ (especially packet formats, agents etc.).

i have created agent in c++ , want stop @ function phone call can see stack trace , find other classes have been called before it.

this have done:

there error in 1 of myagent::function , giving segmentation fault , gdb stopping there automatically. see stack trace. rectified error.

now when run

gdb ./ns b myagent::function() /* when press tab after writing "b mya" gives me functions of class :). when press come in after above command -- asks me "breakpoint on future shared library load" , yes. hope ok ?? */ r myfiles/mywireless.tcl

now runs , not stop anywhere. :(

i sure function beingness called, because when segmentation fault occuring, stopping @ function.

thanks

you can add together breakpoint in function:

(gdb) break myagent::function()

you must create sure compile whatever options necessary debug symbols. on gcc, utilize -g or -ggdb options.

c++ gdb tcl breakpoints ns2

No comments:

Post a Comment