This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [rfc] -gdwarf-3 and DW_OP_call_frame_cfa
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 9 Jun 2009 09:55:46 +0200
- Subject: Re: [rfc] -gdwarf-3 and DW_OP_call_frame_cfa
- References: <4A2E09EC.8010207@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Jun 09, 2009 at 12:06:20AM -0700, Richard Henderson wrote:
> I don't necessarily take it as given that we want a switch to
> select DWARF 3 vs DWARF 2, given that we're already generating
> some DWARF 3 extensions unconditionally. We might simply want
> to do all of DWARF3 unconditionally and hope consumers can cope.
>
> That said, I've written this patch remembering the DWARF4 branch
> and the possibility that we do in fact want to cope with different
> versions of the standard.
>
> There is one quirk. Previously we'd accept options like -gdwarf-23
> and take that to mean dwarf2 debugging, verbosity level 3. Now
> you *must* write this as -gdwarf-2 -g3. Which, frankly, is what I
> thought we had to do beforehand and was surprised at the error
> message I got while testing the handling of -gdwarf-4.
>
> Comments?
If DW_OP_call_frame_cfa is conditional, you also want to disable
my recent changes for DW_AT_frame_base generation with -fdwarf2-cfi-asm:
--- gcc/dwarf2out.c 2009-06-08 11:53:58.000000000 +0200
+++ gcc/dwarf2out.c 2009-06-09 09:35:49.311079568 +0200
@@ -752,6 +752,10 @@ add_fde_cfi (const char *label, dw_cfi_r
break;
if (debug_info_level <= DINFO_LEVEL_TERSE)
break;
+ /* If DW_OP_call_frame_cfa can be emitted,
+ convert_cfa_to_fb_loc_list won't be called. */
+ if (dwarf2_level >= 3)
+ break;
if (*label == 0 || strcmp (label, "<do not output>") == 0)
label = dwarf2out_cfi_label (true);
And there is another thing. For .debug_info, .debug_line and .debug_frame
(and .eh_frame ?) DWARF3 says that the version numbers in them should be
3 if any of the new DWARF3 stuff is used in them, but we AFAIK emit
DWARF_VERSION (2) for .debug_info and .debug_line unconditionally (for
.debug_aranges, .debug_pubtypes and .debug_pubnames it should never be 3 and
so is correct) and for .dwarf_frame/.eh_frame we even emit 1 instead of 3.
>From quick look at bfd/elf-eh-frame.c, GNU ld should cope even with
.eh_frame version 3, not sure about gdb and other dwarf3 consumers.
Jakub