Red Hat Bugzilla – Bug 445912
[RHEL5.2] static variable not available in gdb
Last modified: 2010-10-22 20:53:54 EDT
Description of problem:
Date: Tue, 15 Jan 2008 13:54:20 -0500
From: Seppo Sahrakorpi <firstname.lastname@example.org>
Organization: Totalview Technologies
User-Agent: Thunderbird 188.8.131.52 (X11/20070728)
To: Ben Woodard <email@example.com>
Cc: Matt Wolfe <firstname.lastname@example.org>,
Nikolay Piskun <email@example.com>,
Subject: Update/help needed: Local variables not visible in C++ constructor
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
I would like to bring to your attention / update you on two bugs related
to local (static and non-static) variables in C++ constructor.
The short summary of the bugs is as follows: "In gcc 3.2.3 (and more
recent versions) the DWARF information created by gcc does not create
DW_AT_location attribute for (1) local static variables and (2) local
(non-static) static variables inside a C++ constructor."
We have reported these bugs to gcc-bugzilla, where they are not moving
very quickly. We were thinking that perhaps you could help in getting
these bugs fixed.
The local static variable problem is gcc-bug #33044, and the local
(non-static) variable problem is gcc-bug #27574.
The bug number #27574 is being reviewed by a new person right now.
The ("static") report #33044, seems to have stuck in the system, it
would be great if you could help finding someone who could give this a
look and move it forward.
Partner Technologies Engineer
TotalView Technologies, 24 Prime Parkway, Natick, MA 01760
Whiteboard [It's All Text!]
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. compile test programs
Seems similar to:
woodard assigned to issue for LLNL (HPC).
Date problem reported: 1-15-08
LLNL basically has a gcc issue that apparently has stalled out on the gcc
bugzilla lists. Both bugs are related to local (static and non-static) variables
in C++ constructor. At this point we aren't sure if the two are actually one in
the same or separate issues. The issue (according to the output sent in by Ben)
is still present even in the latest versions of the gcc compiler in RHEL5.1.
This has also been cloned for RHEL4.6 in IT 158679
What's needed from SEG / Engineering: The customer has asked for our help in
getting these issues resolved on the gcc lists so they can be ported to the RHEL
releases in a future fix.
Source file and readelf output from customer is attached.
I've tried the patch described in http://gcc.gnu.org
/bugzilla/show_bug.cgi?id=27574 and while it does fix the problem in the
testcase, it breaks a million other things which is probably why it hasn't been
put into the upstream sources.
Created attachment 304979 [details]
Created attachment 304980 [details]
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release. Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products. This request is not yet committed for inclusion in an Update
Can I get an update on this one please.
This event sent from IssueTracker by woodard
I have done an anlysis for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044 that lead to the problem report being closed upstream because the bug is invalid. Basically, there is enough debug info generated by GCC there for the debuggers (GDB and TotalView) to find the static variable. So I think the debuggers should be fixed.
For http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27574, I have tested the patch that is attached to the bug and it seems to work for me and passes the regression tests on the 4.1 branch. I have contacted the author of the patch to try to apply it upstream. I will update this bug accordingly when I have more info on that front.
Further investigation by engineering points to a gdb problem.
Currently considering this GDB Bug only for _static_ variables:
The _non-static_ variables are currently broken in GCC and still not committed even in GCC HEAD:
(OTOH you are right for GDB it should be the same fix.)
Created attachment 319510 [details]
Fix + testcase (of the _static_ variable).
Proof of the concept was more simple but it had quadratic complexity.
Created attachment 319541 [details]
Fix + testcase (of the _static_ variable; updated).
Small QUIT-leak fix by make_cleanup().
Hello, I have committed a fix for the gcc bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27574 in trunk (upcoming 4.4), 4.3 and 4.2 branches. I believe this should fix the _non-static_ variables case in GCC.
_static_ variables GDB fix:
For F11 present in:
qe_ack+, testcase in gdb.cp/abstract-origin.exp
The post for FSF GDB (with no reply):
* Wed Apr 15 2009 Jan Kratochvil <firstname.lastname@example.org> - 6.8-28
- Fix visibility of static variables in C++ constructors (BZ 445912).
~~ Attention - RHEL 5.4 Beta Released! ~~
RHEL 5.4 Beta has been released! There should be a fix present in the Beta release that addresses this particular request. Please test and report back results here, at your earliest convenience. RHEL 5.4 General Availability release is just around the corner!
If you encounter any issues while testing Beta, please describe the issues you have encountered and set the bug into NEED_INFO. If you encounter new issues, please clone this bug to open a new issue and request it be reviewed for inclusion in RHEL 5.4 or a later update, if it is not of urgent severity.
Please do not flip the bug status to VERIFIED. Only post your verification results, and if available, update Verified field with the appropriate value.
Questions can be posted to this bug or your customer or partner representative.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.