I would like to view the source code( the current line it has executed/going to do) in gdb while i am debugging, and i know list and other commands will display the code.
what i would like to know is do i need to set some path or something to display the code while debugging.

because it always works if i try a sample program in local sysytem , does not matter where i copy my exe and run, but the project i am working is very big code ,so even if i use list and other commands it does not display code neither it displays during debugging


Recommended Answers

I wonder if you are thinking of old friends like TurboC, Visual Studio, etc?

gdb is more like this -> http://www.thegeekstuff.com/2010/03/debug-c-program-using-gdb/

I often find folk not know of gdb basics or wish it …

Jump to Post

All 4 Replies

sorry, you are completely mistaken, i use gdb very often, and i know how to use it in linux.

My problem is , i am not able see the code when i execute statements line by line using 'n' in gdb.

It normally happens in my test programs , but my project code i am running is made so many shared libraries i am able to run gdb but cannot see statements as it executes.

i used list, frame etc...

If those shared libraries aren't build with debugging symbols and you don't have the source code, there is no way to see the source code. Are they built with debugging symbols and do you have the source code?

As Moschops noted, you need the source and to compile that with debugging sympbols. If not, old fashioned debugging with printf and such.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.