PATCH: PR debug/37002: [4.4 Regression] No debug info on unreferenced parameters
H.J. Lu
hongjiu.lu@intel.com
Fri Aug 1 16:49:00 GMT 2008
when DRAP is used to align stack, the parameters are referenced via
internal_arg_pointer, which may be a copy of DRAP. When the RTL that
assigning DRAP to internal_arg_pointer is optimized away since it is
never referenced in the function body, mem_loc_descriptor finds a pseudo
register:
if (REGNO (rtl) < FIRST_PSEUDO_REGISTER)
mem_loc_result = based_loc_descr (rtl, 0, VAR_INIT_STATUS_INITIALIZED);
where rtl is internal_arg_pointer and doesn't generate debug info.
This patch checks if DRAP is used to align stack and rtl is
internal_arg_pointer, it will replace rtl with DRAP. Tested on
Linux/ia32. Now I got
[hjl@gnu-33 gcc]$ ./xgcc -B./ -m32 -mforce-drap -mstackrealign /tmp/x.c
-g
[hjl@gnu-33 gcc]$ /usr/bin/gdb a.out
(gdb) b foo
Breakpoint 1 at 0x80483b5: file /tmp/x.c, line 6.
(gdb) r
Starting program:
/export/build/gnu/gcc-work/build-x86_64-linux/gcc/a.out
Breakpoint 1, foo (x=3000, y=3303, z=-193) at /tmp/x.c:6
6 printf ("hello\n");
Missing separate debuginfos, use: debuginfo-install glibc.i686
(gdb)
OK for trunk?
Thanks.
H.J.
----
2008-08-01 H.J. Lu <hongjiu.lu@intel.com>
PR debug/37002
* dwarf2out.c (mem_loc_descriptor): Use DRAP for vDRAP which
has been optimized out.
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c (revision 3458)
+++ gcc/dwarf2out.c (revision 3459)
@@ -9436,6 +9436,16 @@ mem_loc_descriptor (rtx rtl, enum machin
distinction between OP_REG and OP_BASEREG. */
if (REGNO (rtl) < FIRST_PSEUDO_REGISTER)
mem_loc_result = based_loc_descr (rtl, 0, VAR_INIT_STATUS_INITIALIZED);
+ else if (stack_realign_drap
+ && crtl->drap_reg
+ && crtl->args.internal_arg_pointer == rtl
+ && REGNO (crtl->drap_reg) < FIRST_PSEUDO_REGISTER)
+ {
+ /* If RTL is internal_arg_pointer, which has been optimized
+ out, use DRAP instead. */
+ mem_loc_result = based_loc_descr (crtl->drap_reg, 0,
+ VAR_INIT_STATUS_INITIALIZED);
+ }
break;
case MEM:
More information about the Gcc-patches
mailing list