Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GDB question

Status
Not open for further replies.

seanken

Programmer
Joined
May 2, 2001
Messages
24
Location
US
Hi All,

Second question in 2 days...getting my money's worth.

I (and more worringly, my team lead) think that its time I progressed from inserting printf's to debug code to using a proper debugging tool. From the dim & distant past, I remember using dbx but since I don't have that on my server, I am trying to use GDB instead.

What I would like to know is when i run the gdb command passing in the executable, how can i link the source code so I can see where in the program I am in order to add breaks, etc?

Currently i simply do:

$>> gdb main

and get the following:

blah, blah ...Wildebeest was built for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00...(no debugging symbols found)...


Should I recompile the code in some 'debug' mode (seems to ring a bell (-g option??))?. Any advise, etc, gratefully received.

Thanks & rgds,
Sean
 
Hi,

Yeah that's true. Use -g option with gcc while compiling the code. Then you can see the source code with command "list" in gdb. By the way, you only answered your own question :-)

regards,
Mahesh
 
I'm a helpful sort of guy!!

Thanks,
Sean
 
Status
Not open for further replies.

Similar threads

  • Locked
  • Question Question
Replies
4
Views
477
Replies
2
Views
406
Replies
1
Views
298
  • Locked
  • Question Question
Replies
4
Views
341

Part and Inventory Search

Sponsor

Back
Top