Red Hat Bugzilla – Bug 92309
CDT Debug Step issue
Last modified: 2007-04-18 12:54:18 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.7 (X11; Linux i686; U;) Gecko/20030131
Description of problem:
in the CDT (using C++), while debugging, i for some reason cannot use
the stepping through function (to go through the code line by line).
it hangs on the first "std::cout <<" line.
stepping through works for C code.
also, stepping through works with the same code on another machine
running Red Hat 9 (i have Red Hat 8.0) but failed on another machine
running RH 8
is this an OS problem?
Thanks - Bertina
Version-Release number of selected component (if applicable):
Beehive Eclipse Release
Steps to Reproduce:
Actual Results: hangs on the first "std::cout <<" line
Expected Results: Output to the console
Moved from mailing list my pmuldoon on behalf off blee for better tracking
In short: debugging applications with no debug info doesn't work very well.
When the CDT debugger hits a PC with no debug info, it appears to do nothing. In
fact, gdb HAS done something, but it just doesn't look like it.
Stepping into a system library is always going to be hit-or-miss in this
respect. Most of the time, it will be miss (system libraries stripped or do not
contain debug info). Even if you did have debug info, odds that one has the
source files for the libraries is slim at best.
Under the cover, the CDT is asking gdb for a particular source file (or for the
source file for a given PC), and gdb is saying, "I don't know." Well, the CDT
then just does nothing. It should open a disassembly window, so that at least
the user can see that there is no source. Alas, this option is disabled by
default in the CDT. Go to Window->Preferences->C/C++->Debug and select
"Automatically switch to disassembly mode" and it will operate as it should.
More under the cover: Imagine that you have a program like this:
main (int argc, char *argv)
std::cout << "Hello, world" << std::endl;
You set a break at main. The debugger stops there. If the app has debug info,
gdb and the CDT will display the source for main(). If the app has no debug info
, the CDT will show nothing (or the disassembly if the preference is set).
Now you step into std::cout, a system library... What happens?
If your application has no debug info, gdb issues a warning that it doesn't know
how to figure out how to step (because there are no line numbers for the current
function, main()), and it steps until main() returns! This is normal behavior.
If your app has debug info and the library has no debug info, then gdb issues a
warning (which the CDT does not display anywhere) that it is going to step OVER
the function call, since it has no debug info for it. This is also normal behavior.
If your app has debug info and the library has debug info, then gdb and the cdt
will happily display the results of the step, but it will only be able to
display source code IF the source file is found on your system (in the same
place as the when the library was built, which is exceptionally unlikely).
[Mumble something about gdb's path command, which adds source file search paths,
but that's another topic.]
1) Don't try to step into a system library without having "automatically
2) Don't try to debug an executable with no debug info