gdb debugging

444 views
Skip to first unread message

Fengyuan Gong

unread,
Nov 9, 2011, 1:02:29 AM11/9/11
to omn...@googlegroups.com
Hi, ALL

I want to use gdb to debug the code in command line. For example, if I
want to debug the executable file run in the directory
/inetmanet/examples/adhoc/net80211_aodv.
I type "gdb run", then it says
"inetmanet/examples/adhoc/net80211_aodv/run": not in executable
format: File format not recognized". But run is an executable file. So
I am confused about how to debug the executable file in gdb. Can
anyone help me figure it out? Thanks~

--
Best Regards~
Fengyuan Gong

Rudolf Hornig

unread,
Nov 9, 2011, 4:25:25 AM11/9/11
to omn...@googlegroups.com
run is an 'sh' script so it cannot be debugged. It is executable but not a native binary. Open the run command and see how it starts the simulation...

In case of INET it will use opp_run to start the inetmanet shared lib..

Rudolf

--
Sent from the OMNeT++ mailing list. To configure your membership,
visit http://groups.google.com/group/omnetpp

Fengyuan Gong

unread,
Nov 9, 2011, 10:04:40 AM11/9/11
to omn...@googlegroups.com
Hi, Rudolf,

Thanks for your help. This time, I type "gdb opp_run" for the example
"inetmanet/examples/adhoc/net80211_aodv/".

Then in the gdb, I type run, but it give me following error. It seems
like the NED file can not be loaded correctly. I am still not sure
what is the problem and how to fix it so that I can start debugging.
Any help will be appreciated !

Reading symbols from /home/gong/OMNET++/omnetpp-4.1/bin/opp_run...done.
(gdb) run
Starting program: /home/gong/OMNET++/omnetpp-4.1/bin/opp_run
[Thread debugging using libthread_db enabled]
OMNeT++ Discrete Event Simulation (C) 1992-2010 Andras Varga, OpenSim Ltd.
Version: 4.1, build: 100611-4b63c38, edition: Academic Public License
-- NOT FOR COMMERCIAL USE
See the license for distribution terms and warranty disclaimer
Setting up Tkenv...

<!> Error: Error loading NED sources from `.': NED error in file
`Net80211_aodv.ned': declared package
`inet.examples.adhoc.net80211_aodv' does not match expected package
`'.


End.

Program exited normally.

Rudolf Hornig

unread,
Nov 9, 2011, 11:19:54 AM11/9/11
to omn...@googlegroups.com
Of course you have to provide the shared library to start and also the root of the NED folders. Check the src/run_inet file...

I guess you have to write something like this:

opp_run -l ../../../src/inet -n ../../../src:../..

if you want to start the program from the command line and you have to use

gdb --args opp_run -l ../../../src/inet -n ../../../src:../..

to debug it. (assuming that you are in examples/adhoc/net80211_aodv deirectory)

Rudolf
Reply all
Reply to author
Forward
0 new messages