public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] dwarf2out.c patch for AIX
@ 2017-07-23  3:29 David Edelsohn
  2017-07-26 20:25 ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: David Edelsohn @ 2017-07-23  3:29 UTC (permalink / raw)
  To: Jason Merrill; +Cc: GCC Patches

Recent versions of the AIX toolchain now support the debug_macinfo
section.  The section header of the macinfo_section includes a
reference to the debug lineptr. As with the earlier adjustment to the
debug line reference in the debug_info section, the debug_macinfo
section requires a similar adjustment.

The adjustment is necessary because the AIX assembler inserts the
debug line section length, which causes the GCC generated label for
the beginning of the section to point to the incorrect location
expected by debuggers, such as GDB.

This patch mirrors the earlier patch to copy debug_section_label into
dl_section_ref and append the adjustment when necessary.  With this
patch, GDB is able to report correct macro information.

Bootstrapped on powerpc-ibm-aix7.2.0.0

Okay?

Thanks, David

        * dwarf2out.c (output_macinfo): Copy debug_line_section_label
to dl_section_ref.  On AIX, append an expression to subtract the size
of the section length to dl_section_ref.

Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 250453)
+++ dwarf2out.c (working copy)
@@ -26975,6 +26975,7 @@ output_macinfo (void)
   macinfo_entry *ref;
   vec<macinfo_entry, va_gc> *files = NULL;
   macinfo_hash_type *macinfo_htab = NULL;
+  char dl_section_ref[MAX_ARTIFICIAL_LABEL_BYTES];

   if (! length)
     return;
@@ -26985,6 +26986,12 @@ output_macinfo (void)
              && (int) DW_MACINFO_start_file == (int) DW_MACRO_start_file
              && (int) DW_MACINFO_end_file == (int) DW_MACRO_end_file);

+  /* AIX Assembler inserts the length, so adjust the reference to match the
+     offset expected by debuggers.  */
+  strcpy (dl_section_ref, debug_line_section_label);
+  if (XCOFF_DEBUGGING_INFO)
+    strcat (dl_section_ref, DWARF_INITIAL_LENGTH_SIZE_STR);
+
   /* For .debug_macro emit the section header.  */
   if (!dwarf_strict || dwarf_version >= 5)
     {
@@ -26995,7 +27002,7 @@ output_macinfo (void)
       else
        dw2_asm_output_data (1, 2, "Flags: 32-bit, lineptr present");
       dw2_asm_output_offset (DWARF_OFFSET_SIZE,
-                             (!dwarf_split_debug_info ?
debug_line_section_label
+                             (!dwarf_split_debug_info ? dl_section_ref
                               : debug_skeleton_line_section_label),
                              debug_line_section, NULL);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dwarf2out.c patch for AIX
  2017-07-23  3:29 [PATCH] dwarf2out.c patch for AIX David Edelsohn
@ 2017-07-26 20:25 ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2017-07-26 20:25 UTC (permalink / raw)
  To: David Edelsohn, Jason Merrill; +Cc: GCC Patches

On 07/22/2017 08:29 PM, David Edelsohn wrote:
> This patch mirrors the earlier patch to copy debug_section_label into
> dl_section_ref and append the adjustment when necessary.  With this
> patch, GDB is able to report correct macro information.
> 
> Bootstrapped on powerpc-ibm-aix7.2.0.0

Debug related patches need to be tested with gdb testsuite runs, it 
isn't clear if you did that.  However, this one looks simple enough that 
it looks OK anyways.

Using XCOFF_DEBUGGING_INFO in dwarf2out.c looks funny to me, but I see 
that this is already done in multiple other places.  doc/tm.texi 
incidentally says that defining XCOFF_DEBUGGING_INFO enables generation 
of a DBX variant debug info, which is obviously not correct in this 
case.  Perhaps we should just update doc/tm.texi to reflect reality?

> Okay?

OK.

Jim

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-26 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-23  3:29 [PATCH] dwarf2out.c patch for AIX David Edelsohn
2017-07-26 20:25 ` Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).