Red Hat Bugzilla – Bug 150693
[4.0/4.1 Regression] GCC produces wrong dwarf2 output that breaks gdb
Last modified: 2007-11-30 17:07:16 EST
From upstream bug:
The combination of libjava/include/posix-threads.h and
combine to produce broken dwarf2 output when compiled with
optimization and -g.
(This can be seen by bootstrapping, installing, then running a recent
either gij, or libgcj.so)
The cause is this:
inline _Jv_Thread_t *
extern pthread_key_t _Jv_ThreadDataKey;
return (_Jv_Thread_t *) pthread_getspecific (_Jv_ThreadDataKey);
We end up with calls to _Jv_ThreadCurrentData before we get to output
for _Jv_ThreadDataKey (which is a perfectly reasonable turn of events).
We end up generating a full die for _Jv_ThreadDataKey inside
We then go to output the global, and mark it as having an abstract
origin of the
DIE inside the inlined function.
This is backwards.
I'm not sure how easy/hard this will be to fix.
The obvious thing to do is to drive global variable debug output using
but that seems a bit invasive for 4.0.
I'm also sure this patch exposed by one of my patches to mark blocks
which in turn fixed other regressions, so I don't believe we should simply
It's possible that the DECL_ABSTRACT_ORIGIN's aren't set up properly,
is the real cause here. I would have expected we would have seen that the
declaration inside the inline had an abstract origin of the one
inline, and thus, we wouldn't have tried to output a full die for it,
isn't what appears to happen.
gcc-4.0.0-0.3* has gcc4-pr19769-workaround.patch patch in it so that this bug
isn't triggered on the installed libgcj.so.
PR19769 is fixed in 4.0.0-0.36 and above.