Bug 445912 - [RHEL5.2] static variable not available in gdb
Summary: [RHEL5.2] static variable not available in gdb
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gdb
Version: 5.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jan Kratochvil
QA Contact:
URL:
Whiteboard:
Depends On: 462897 465824
Blocks: 391501
TreeView+ depends on / blocked
 
Reported: 2008-05-09 19:34 UTC by Alan Matsuoka
Modified: 2018-10-20 00:16 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-02 11:26:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
pr27574.C (271 bytes, text/x-csrc)
2008-05-09 19:34 UTC, Alan Matsuoka
no flags Details
pr27574.wi (3.24 KB, application/octet-stream)
2008-05-09 19:35 UTC, Alan Matsuoka
no flags Details
Fix + testcase (of the _static_ variable). (6.62 KB, patch)
2008-10-05 23:25 UTC, Jan Kratochvil
no flags Details | Diff
Fix + testcase (of the _static_ variable; updated). (6.44 KB, patch)
2008-10-06 11:52 UTC, Jan Kratochvil
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 33044 0 None None None Never
Red Hat Product Errata RHBA-2009:1361 0 normal SHIPPED_LIVE gdb bug fix update 2009-09-01 10:57:06 UTC

Description Alan Matsuoka 2008-05-09 19:34:32 UTC
Description of problem:

Date: Tue, 15 Jan 2008 13:54:20 -0500
From: Seppo Sahrakorpi <seppo>
Organization: Totalview Technologies
User-Agent: Thunderbird 2.0.0.6 (X11/20070728)
MIME-Version: 1.0
To: Ben Woodard <bwoodard>
Cc: Matt Wolfe <mwolfe>,
       Nikolay Piskun <nikolay.piskun>,
       seppo
Subject: Update/help needed: Local variables not visible in C++ constructor
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi Ben,

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.
http://gcc.gnu.org /bugzilla/show_bug.cgi?id=33044
http://gcc.gnu.org /bugzilla/show_bug.cgi?id=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.

Thanks,
Seppo

-- 
Seppo Sahrakorpi
Partner Technologies Engineer
TotalView Technologies, 24 Prime Parkway, Natick, MA 01760
Whiteboard	[It's All Text!] 
Version-Release number of selected component (if applicable):


How reproducible:
 always

Steps to Reproduce:
1. compile test programs
2.
3.
  
Actual results:


Expected results:


Additional info:

Seems similar to:
https://enterprise.redhat.com/issue-tracker/?module=issues&action=view&tid=39586
https://enterprise.redhat.com/issue-tracker/?module=issues&action=view&tid=57461



woodard assigned to issue for LLNL (HPC).

Date problem reported: 1-15-08

problem:
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.
From SEG:

 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.

Comment 1 Alan Matsuoka 2008-05-09 19:34:33 UTC
Created attachment 304979 [details]
pr27574.C

Comment 2 Alan Matsuoka 2008-05-09 19:35:34 UTC
Created attachment 304980 [details]
pr27574.wi

Comment 3 RHEL Program Management 2008-06-02 20:00:51 UTC
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
release.

Comment 5 Issue Tracker 2008-08-26 06:22:19 UTC
Can I get an update on this one please.


This event sent from IssueTracker by woodard 
 issue 146253

Comment 7 Dodji Seketeli 2008-09-02 18:43:51 UTC
Hello,

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.

Comment 8 Alan Matsuoka 2008-09-05 13:25:20 UTC
Further investigation by engineering points to a  gdb problem.

Comment 9 Jan Kratochvil 2008-10-05 21:44:23 UTC
Currently considering this GDB Bug only for _static_ variables:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044

The _non-static_ variables are currently broken in GCC and still not committed even in GCC HEAD:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27574

(OTOH you are right for GDB it should be the same fix.)

Comment 10 Jan Kratochvil 2008-10-05 23:25:19 UTC
Created attachment 319510 [details]
Fix + testcase (of the _static_ variable).

Proof of the concept was more simple but it had quadratic complexity.

Comment 11 Jan Kratochvil 2008-10-06 11:52:14 UTC
Created attachment 319541 [details]
Fix + testcase (of the _static_ variable; updated).

Small QUIT-leak fix by make_cleanup().

Comment 12 Dodji Seketeli 2008-11-19 00:26:36 UTC
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.

Comment 13 Jan Kratochvil 2008-11-21 19:37:10 UTC
_static_ variables GDB fix:
For F11 present in:
archer-jankratochvil-misc
60eb8684d0d85d0884aca7a2f013e5eb16a51d47

Comment 14 Petr Muller 2009-02-23 17:52:30 UTC
qe_ack+, testcase in gdb.cp/abstract-origin.exp

Comment 15 Jan Kratochvil 2009-04-13 15:47:20 UTC
The post for FSF GDB (with no reply):
http://sourceware.org/ml/gdb-patches/2008-12/msg00367.html

Comment 16 Jan Kratochvil 2009-04-17 21:59:52 UTC
Built:
* Wed Apr 15 2009 Jan Kratochvil <jan.kratochvil> - 6.8-28
- Fix visibility of static variables in C++ constructors (BZ 445912).

Comment 18 Chris Ward 2009-07-03 18:02:46 UTC
~~ 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.

Comment 21 errata-xmlrpc 2009-09-02 11:26:17 UTC
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.

http://rhn.redhat.com/errata/RHBA-2009-1361.html


Note You need to log in before you can comment on or make changes to this bug.