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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.