From: "H. J. Lu" <hjl@lucon.org>
To: Daniel Berlin <dberlin@dberlin.org>
Cc: Daniel Jacobowitz <drow@false.org>,
gcc@gcc.gnu.org, GDB <gdb@sources.redhat.com>
Subject: Re: Gdb generates location list without DW_AT_frame_base
Date: Fri, 31 Dec 2004 19:57:00 -0000 [thread overview]
Message-ID: <20041231195734.GA4125@lucon.org> (raw)
In-Reply-To: <Pine.LNX.4.60.0412301934590.27590@dberlin.org>
On Thu, Dec 30, 2004 at 07:35:13PM -0500, Daniel Berlin wrote:
>
>
> On Thu, 30 Dec 2004, H. J. Lu wrote:
>
> >On Thu, Dec 30, 2004 at 03:56:33PM -0500, Daniel Berlin wrote:
> >>
> >>>And what's in the location lists? If it's DW_OP_fbreg, then I presume
> >>>it's a GCC bug. According to my reading of the DWARF spec, anyway.
> >>It is.
> >>
> >>I added code to tell it when not to use fbreg, but i only told it not to
> >>use fbreg in the location expression when we were outputting the
> >>frame_base attribute.
> >>
> >>However, it appears we don't output a frame base attribute for external
> >>procedures, so we need to tell it it can't use if we don't have a frame
> >>base attribute.
> >>
> >>You just need to change when loc_descriptor is called with a second
> >>parameter of true/1 to fix this.
> >
> >Do you have a patch I can try?
>
> This may not fix all of them, but it should help.
> Index: dwarf2out.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
> retrieving revision 1.564
> diff -u -p -r1.564 dwarf2out.c
> --- dwarf2out.c 24 Dec 2004 05:23:07 -0000 1.564
> +++ dwarf2out.c 31 Dec 2004 00:34:38 -0000
> @@ -9980,6 +9980,7 @@ add_location_or_const_value_attribute (d
> rtx rtl;
> dw_loc_descr_ref descr;
> var_loc_list *loc_list;
> + bool can_use_fb = attr != DW_AT_frame_base && !DECL_EXTERNAL (decl);
>
> if (TREE_CODE (decl) == ERROR_MARK)
> return;
> @@ -10049,7 +10050,7 @@ add_location_or_const_value_attribute (d
> varloc = NOTE_VAR_LOCATION (node->var_loc_note);
> add_loc_descr_to_loc_list (&list,
> loc_descriptor (varloc,
> - attr != DW_AT_frame_base),
> + can_use_fb),
> node->label, node->next->label, secname);
> }
>
> @@ -10070,7 +10071,7 @@ add_location_or_const_value_attribute (d
> }
> add_loc_descr_to_loc_list (&list,
> loc_descriptor (varloc,
> - attr != DW_AT_frame_base),
> + can_use_fb),
> node->label, endname, secname);
> }
>
There are several problems with this patch:
1. It checks DECL_EXTERNAL. Did you mean TREE_PUBLIC?
2. It doesn't cover PARM_DECL nor RESULT_DECL.
3. For
#0 loc_descriptor (rtl=0xb7d67abc, can_use_fbreg=1 '\001')
at /net/gnu/export/gnu/src/gcc/gcc/gcc/dwarf2out.c:8740
#1 0x0813bd45 in loc_descriptor_from_tree_1 (loc=0xb7d60870,
want_address=2)
at /net/gnu/export/gnu/src/gcc/gcc/gcc/dwarf2out.c:8928
#2 0x0813c2b7 in add_location_or_const_value_attribute
(die=0xb7d66f3c,
decl=0xb7d60870, attr=DW_AT_location)
at /net/gnu/export/gnu/src/gcc/gcc/gcc/dwarf2out.c:9247
#3 0x08141ec6 in gen_formal_parameter_die (node=0xb7d60870,
context_die=0xb7d66ea0)
at /net/gnu/export/gnu/src/gcc/gcc/gcc/dwarf2out.c:11001
#4 0x0813ded2 in gen_decl_die (decl=0xb7d60870,
context_die=0xb7d66ea0)
at /net/gnu/export/gnu/src/gcc/gcc/gcc/dwarf2out.c:12700
#5 0x08140479 in gen_subprogram_die (decl=0xb7d601b0,
context_die=0x84da799)
at /net/gnu/export/gnu/src/gcc/gcc/gcc/dwarf2out.c:11382
it comes from
8926 /* Certain constructs can only be represented at
top-level. */
8927 if (want_address == 2)
8928 return loc_descriptor (rtl, true);
8929
H.J.
next prev parent reply other threads:[~2004-12-31 19:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-22 1:16 Is this a gcc, gdb or readelf bug? H. J. Lu
2004-12-22 11:09 ` Nick Clifton
2004-12-22 18:25 ` H. J. Lu
2004-12-23 3:43 ` Daniel Jacobowitz
2004-12-30 19:24 ` GDB 6.3 assumes that DW_AT_frame_base exists H. J. Lu
2004-12-30 19:36 ` H. J. Lu
2004-12-30 19:56 ` H. J. Lu
2004-12-30 20:07 ` Daniel Jacobowitz
2004-12-30 20:23 ` Gdb generates location list without DW_AT_frame_base H. J. Lu
2004-12-30 20:28 ` Daniel Jacobowitz
2004-12-30 20:52 ` Gdb generates DW_OP_fbreg in " H. J. Lu
2004-12-30 20:56 ` Gdb generates " Daniel Berlin
2004-12-30 21:05 ` H. J. Lu
2004-12-31 0:35 ` Daniel Berlin
2004-12-31 19:57 ` H. J. Lu [this message]
2004-12-31 20:09 ` Daniel Berlin
2004-12-31 20:11 ` H. J. Lu
2004-12-31 20:16 ` Daniel Berlin
[not found] ` <20041231163806.GA1335@lucon.org>
[not found] ` <Pine.LNX.4.60.0412311158280.27590@dberlin.org>
[not found] ` <20041231184405.GA2182@lucon.org>
[not found] ` <Pine.LNX.4.60.0412311451060.6844@dberlin.org>
[not found] ` <Pine.LNX.4.60.0412311509360.6844@dberlin.org>
[not found] ` <20041231215010.GA5722@lucon.org>
[not found] ` <20041231215443.GA5853@lucon.org>
[not found] ` <Pine.LNX.4.60.0412311656360.6844@dberlin.org>
[not found] ` <20041231220324.GA5987@lucon.org>
2005-01-01 19:15 ` gcc 4.0 " H. J. Lu
2005-01-01 20:09 ` Daniel Jacobowitz
2005-01-01 20:50 ` Daniel Berlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041231195734.GA4125@lucon.org \
--to=hjl@lucon.org \
--cc=dberlin@dberlin.org \
--cc=drow@false.org \
--cc=gcc@gcc.gnu.org \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox