This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH/RFC] PR other/22313: Hot/cold sections vs. dwarf2 (take 2)
- From: Roger Sayle <roger at eyesopen dot com>
- To: Nicolas Setton <setton at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Jason Merrill <jason at redhat dot com>
- Date: Fri, 8 Sep 2006 07:23:46 -0600 (MDT)
- Subject: Re: [PATCH/RFC] PR other/22313: Hot/cold sections vs. dwarf2 (take 2)
On Fri, 8 Sep 2006, Nicolas Setton wrote:
> I guess that this patch is incomplete, in that it breaks printing in
> the debugger of variables allocated on the stack and for which the
> dwarf-2 location is calculated relatively to the frame base.
> To exhibit the problem, consider the following code:
> typedef struct
> int a;
> } thing;
> int main (void)
> thing a;
> a.a = 7;
> return a.a;
> Then try to break in "main" and print variable "a", you'll get the
> following message:
> Could not find the frame base for "main".
> Further analysis. When compiling the example above with the patch
> included, on x86-linux, the location expression for the frame base
> starts with this:
> .long .LFB2-.Ltext0 # Location list begin address (*.LLST0)
> .long .LFB2-.Ltext0 # Location list end address (*.LLST0)
> The first location expression is a null address range, which is a
> list terminator in dwarf-2.
> I suspect that the problem comes from the current implementation of
> convert_cfa_to_loc_list, which currently expects only
> DW_CFA_advance_loc statements in the CFI instructions; it should be
> enhanced to expect and handle the DW_CFA_set_loc statements as well.
> What do the experts think about this?
Grr. Indeed you're right that it looks like convert_cfa_to_fb_loc_list
in dwarf2out.c doesn't appear to support set_loc. The following one
line patch appears to avoid the null range in your testcase on
x86-linux. I'm not really a dwarf expert, so I wonder if you could
confirm that the debugging information is now correct (and we can now
find "a" in "main"). From the source code, this looks like the correct
Thanks in advance,
2006-09-08 Roger Sayle <firstname.lastname@example.org>
Nicolas Setton <email@example.com>
* dwarf2out.c (convert_cfa_to_fb_loc_list): Handle DW_CFA_set_loc.
*** dwarf2out.c (revision 116509)
--- dwarf2out.c (working copy)
*************** convert_cfa_to_fb_loc_list (HOST_WIDE_IN
*** 10383,10388 ****
--- 10383,10389 ----
for (cfi = fde->dw_fde_cfi; cfi; cfi = cfi->dw_cfi_next)
+ case DW_CFA_set_loc:
Roger Sayle, E-mail: firstname.lastname@example.org
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833