Bug 15860 - [3.3/3.4/4.0 regression] No DW_AT_location debug info is emitted for formal arguments to a function that uses "register" qualifiers
Summary: [3.3/3.4/4.0 regression] No DW_AT_location debug info is emitted for formal a...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 3.4.3
Assignee: Richard Henderson
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2004-06-07 18:25 UTC by Randolph Chung
Modified: 2004-10-14 01:45 UTC (History)
2 users (show)

See Also:
Host:
Target: hppa-unknown-linux
Build:
Known to work:
Known to fail: 3.4.1 4.0.0
Last reconfirmed: 2004-10-13 18:54:43


Attachments
testcase (270 bytes, text/plain)
2004-06-07 18:26 UTC, Randolph Chung
Details
proposed patch (752 bytes, patch)
2004-10-13 18:56 UTC, Richard Henderson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Randolph Chung 2004-06-07 18:25:14 UTC
Compile the attached code with "gcc -g -c structs2.c" [structs2.c comes from 
the gdb testsuite]

The arguments to param_reg() are not described in the dwarf debug info. e.g.:
$ readelf -wi structs2.o
[...]
 <2><69>: Abbrev Number: 6 (DW_TAG_formal_parameter)
     DW_AT_name        : (indirect string, offset: 0x27): pr_char
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 28
     DW_AT_type        : <96>

No DW_AT_location information is given.

With gcc-3.0, I see:
 <2><82>: Abbrev Number: 6 (DW_TAG_formal_parameter)
     DW_AT_name        : pr_char
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 28
     DW_AT_type        : <cf>
     DW_AT_location    : 2 byte block: 91 b     (DW_OP_fbreg: 11)

param_reg() is defined as:
static void param_reg (register signed char pr_char,
                       register unsigned char pr_uchar,
                       register short pr_short,
                       register unsigned short pr_ushort);

if the "register" qualifier is removed, the correct debug information is 
emitted.

Dan Jacobowitz tells me that on i386/mips, with gcc-3.3, he does not see this 
problem. On hppa-linux i see this with gcc-3.3/3.4/3.5

This was also observed by Corinna Vinschen (sh target):
http://sources.redhat.com/ml/gdb/2004-03/msg00043.html
Comment 1 Randolph Chung 2004-06-07 18:26:25 UTC
Created attachment 6487 [details]
testcase
Comment 2 Andrew Pinski 2004-06-07 18:52:27 UTC
hmm, I see it fine on powerpc-apple-darwin on the mainline just fine.  I wonder if this is a target 
problem some how.
Comment 3 Mark Mitchell 2004-08-29 18:53:26 UTC
Postponed until GCC 3.4.3.
Comment 4 Richard Henderson 2004-10-13 18:54:43 UTC
It would seem that this would affect any big-endian target for which the ABI
forces type promotion of parameters.  
Comment 5 Richard Henderson 2004-10-13 18:56:31 UTC
Created attachment 7340 [details]
proposed patch
Comment 6 Richard Henderson 2004-10-13 18:57:13 UTC
Someone will need to test this on an affected target, both with gcc and the
gdb testsuite.
Comment 7 Randolph Chung 2004-10-13 21:24:27 UTC
Verified with gcc-3.4.1 and gdb-6.2.1 on hppa-linux. Thanks Richard.
Comment 8 CVS Commits 2004-10-13 23:44:01 UTC
Subject: Bug 15860

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2004-10-13 23:43:57

Modified files:
	gcc            : ChangeLog dwarf2out.c 

Log message:
	PR debug/15860
	* dwarf2out.c (rtl_for_decl_location): Apply big-endian correction
	for DECL_INCOMING_RTL.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5871&r2=2.5872
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&r1=1.554&r2=1.555

Comment 9 CVS Commits 2004-10-13 23:44:29 UTC
Subject: Bug 15860

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	rth@gcc.gnu.org	2004-10-13 23:44:27

Modified files:
	gcc            : ChangeLog dwarf2out.c 

Log message:
	PR debug/15860
	* dwarf2out.c (rtl_for_decl_location): Apply big-endian correction
	for DECL_INCOMING_RTL.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.657&r2=2.2326.2.658
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.478.2.10&r2=1.478.2.11

Comment 10 Richard Henderson 2004-10-13 23:45:51 UTC
Fixed.
Comment 11 Giovanni Bajo 2004-10-14 01:45:17 UTC
What about 3.3?