Skip to contentSkip to conversation

regarding gdb stack trace problems in mozilla etc.

DISCUSSION Kevin Buettner 1 participant 1 message Jan 17, 2000 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 10 lines · D.J. Barrow

Some mozilla developer was asking about gdb not displaying stack traces properly in mozilla. The most common reason for this is compiling -g with optimisation ( -O2 or whatever ), when compiling -O2 gcc doesn't copy register parameters to the stack, this means that the stack backtrace will not work & if you view one of the parameters passed into the function it will be incorrect as soon as the register is reused.

Quoted 5 lines

To avoid this just compile as much of the code as possible without optimisation, you may not be able to compile it all without optimisation in mozilla as inline functions will not work compile without optimisation

D.J.,

You give sound advice. Normally, when gdb is giving me strange results for values of parameters and whatnot, I do exactly as you suggest.

In the case that you're referring to however, gdb is giving incorrect information about the line number being called from. The person reporting the bug (Sean Chitwood) states that the line number refers to a closing curly brace and that often times the curly brace being referred to doesn't even below to the calling function!

This looks like a bug that I worked on for several weeks last fall. In a nutshell, the linker is creating shared objects with zero-valued N_FUN symbols. gdb had/has a mechanism for resolving the symbols under these circumstances, but there were some problems with the code. You can find a detailed analysis of the problem at

    http://sourceware.cygnus.com/ml/gdb/1999-q3/msg00325.html

If you read the above analysis, you'll see a proposed patch at the end of the message. This patch made its way into the current gdb source tree with few (if any) changes. I'm not sure it'll apply cleanly to the gdb-4.18 sources though. If it doesn't, I have another one that might work better. (The fix is the same, but the diff was taken relative to something which might be closer to 4.18.)

Kevin

Signature · 4 lines
Kevin Buettner
[email protected], [email protected]

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/