AIX DWARF debugging sections

Message ID CAGWvnynk4jNchyUNitvTwD1Tq5t4geJvNTg1ALZsMdRYQx6Etg@mail.gmail.com
State New, archived
Headers

Commit Message

David Edelsohn Sept. 25, 2015, 2:53 p.m. UTC
  Initial AIX support for DWARF did not include location lists, debug
frame, and macinfo.  Support was added in a later update.

xcoffread defines most of the sections -- including some that were
included later and omitting some that were included in the initial
implementation.

Does anyone know why pbtyp and mac are not define?  I'm not sure if
AIX .dwamac is macinfo or macro or both.

Thanks, David

* xcoffread (dwrf2_xcoff_names): Add .dwmac and .dwpbtyp.

   { NULL, NULL }, /* eh_frame */
  

Comments

Tristan Gingold Sept. 28, 2015, 1:41 p.m. UTC | #1
> On 25 Sep 2015, at 16:53, David Edelsohn <dje.gcc@gmail.com> wrote:
> 
> Initial AIX support for DWARF did not include location lists, debug
> frame, and macinfo.  Support was added in a later update.
> 
> xcoffread defines most of the sections -- including some that were
> included later and omitting some that were included in the initial
> implementation.
> 
> Does anyone know why pbtyp and mac are not define?

AFAIK, .debug_pubtypes are not read by gdb.

>  I'm not sure if
> AIX .dwamac is macinfo or macro or both.
> 
> Thanks, David

Your patch looks ok to me, but should be approved by
a global maintainer.

Thanks,
Tristan.
  
Joel Brobecker Oct. 2, 2015, 9:32 p.m. UTC | #2
> > On 25 Sep 2015, at 16:53, David Edelsohn <dje.gcc@gmail.com> wrote:
> > 
> > Initial AIX support for DWARF did not include location lists, debug
> > frame, and macinfo.  Support was added in a later update.
> > 
> > xcoffread defines most of the sections -- including some that were
> > included later and omitting some that were included in the initial
> > implementation.
> > 
> > Does anyone know why pbtyp and mac are not define?
> 
> AFAIK, .debug_pubtypes are not read by gdb.
> 
> >  I'm not sure if
> > AIX .dwamac is macinfo or macro or both.
> > 
> > Thanks, David
> 
> Your patch looks ok to me, but should be approved by
> a global maintainer.

It looks odd to me that two entries would have the same name.
Wouldn't it cause GDB to decode the same section both as .debug_macinfo
and .debug_macro?
  
David Edelsohn Oct. 2, 2015, 10:35 p.m. UTC | #3
On Fri, Oct 2, 2015 at 5:32 PM, Joel Brobecker <brobecker@adacore.com> wrote:
>> > On 25 Sep 2015, at 16:53, David Edelsohn <dje.gcc@gmail.com> wrote:
>> >
>> > Initial AIX support for DWARF did not include location lists, debug
>> > frame, and macinfo.  Support was added in a later update.
>> >
>> > xcoffread defines most of the sections -- including some that were
>> > included later and omitting some that were included in the initial
>> > implementation.
>> >
>> > Does anyone know why pbtyp and mac are not define?
>>
>> AFAIK, .debug_pubtypes are not read by gdb.
>>
>> >  I'm not sure if
>> > AIX .dwamac is macinfo or macro or both.
>> >
>> > Thanks, David
>>
>> Your patch looks ok to me, but should be approved by
>> a global maintainer.
>
> It looks odd to me that two entries would have the same name.
> Wouldn't it cause GDB to decode the same section both as .debug_macinfo
> and .debug_macro?

Because the AIX section does not use the standard name, I am unsure
which it represents.  The documentation only states "dwmac", which
could expand to either name.

Thanks, David
  
Doug Evans Oct. 6, 2015, 12:29 a.m. UTC | #4
On Fri, Oct 2, 2015 at 3:35 PM, David Edelsohn <dje.gcc@gmail.com> wrote:
> On Fri, Oct 2, 2015 at 5:32 PM, Joel Brobecker <brobecker@adacore.com> wrote:
>>> > On 25 Sep 2015, at 16:53, David Edelsohn <dje.gcc@gmail.com> wrote:
>>> >
>>> > Initial AIX support for DWARF did not include location lists, debug
>>> > frame, and macinfo.  Support was added in a later update.
>>> >
>>> > xcoffread defines most of the sections -- including some that were
>>> > included later and omitting some that were included in the initial
>>> > implementation.
>>> >
>>> > Does anyone know why pbtyp and mac are not define?
>>>
>>> AFAIK, .debug_pubtypes are not read by gdb.
>>>
>>> >  I'm not sure if
>>> > AIX .dwamac is macinfo or macro or both.
>>> >
>>> > Thanks, David
>>>
>>> Your patch looks ok to me, but should be approved by
>>> a global maintainer.
>>
>> It looks odd to me that two entries would have the same name.
>> Wouldn't it cause GDB to decode the same section both as .debug_macinfo
>> and .debug_macro?
>
> Because the AIX section does not use the standard name, I am unsure
> which it represents.  The documentation only states "dwmac", which
> could expand to either name.
>
> Thanks, David

Yeah, I think we need to figure out which one it is.
  
Joel Brobecker Oct. 6, 2015, 4:51 p.m. UTC | #5
> > Because the AIX section does not use the standard name, I am unsure
> > which it represents.  The documentation only states "dwmac", which
> > could expand to either name.
> >
> > Thanks, David
> 
> Yeah, I think we need to figure out which one it is.

That's what I have been trying to do, but I don't see any evidence
that GCC emits it, or that binutils handles it. So the answer must
lie somewhere on the system side. David?
  
David Edelsohn Oct. 6, 2015, 4:55 p.m. UTC | #6
On Tue, Oct 6, 2015 at 12:51 PM, Joel Brobecker <brobecker@adacore.com> wrote:
>> > Because the AIX section does not use the standard name, I am unsure
>> > which it represents.  The documentation only states "dwmac", which
>> > could expand to either name.
>> >
>> > Thanks, David
>>
>> Yeah, I think we need to figure out which one it is.
>
> That's what I have been trying to do, but I don't see any evidence
> that GCC emits it, or that binutils handles it. So the answer must
> lie somewhere on the system side. David?

GCC emits it when -g3 is enabled.  Ldebug_macinfo vs Ldebug_macro is
controlled by dwarf_strict.  The current GCC support for DWARF in AIX
uses the same section name for both.

I am asking the XLC team what they produce for the section.

Thanks, David
  
David Edelsohn Oct. 6, 2015, 6:24 p.m. UTC | #7
On Tue, Oct 6, 2015 at 12:51 PM, Joel Brobecker <brobecker@adacore.com> wrote:
>> > Because the AIX section does not use the standard name, I am unsure
>> > which it represents.  The documentation only states "dwmac", which
>> > could expand to either name.
>> >
>> > Thanks, David
>>
>> Yeah, I think we need to figure out which one it is.
>
> That's what I have been trying to do, but I don't see any evidence
> that GCC emits it, or that binutils handles it. So the answer must
> lie somewhere on the system side. David?

The official answer from IBM XLC is the section is for both
.debug_macinfo and .debug_macro

For DWARF4 and below, the dwmac section corresponds to .debug_macinfo.
For DWARF5 and above, the dwmac section corresponds to .debug_macro.

XLC currently does not generate any macro debugging information for DWARF4.

- David
  
Doug Evans Oct. 6, 2015, 7:59 p.m. UTC | #8
On Tue, Oct 6, 2015 at 11:24 AM, David Edelsohn <dje.gcc@gmail.com> wrote:
> On Tue, Oct 6, 2015 at 12:51 PM, Joel Brobecker <brobecker@adacore.com> wrote:
>>> > Because the AIX section does not use the standard name, I am unsure
>>> > which it represents.  The documentation only states "dwmac", which
>>> > could expand to either name.
>>> >
>>> > Thanks, David
>>>
>>> Yeah, I think we need to figure out which one it is.
>>
>> That's what I have been trying to do, but I don't see any evidence
>> that GCC emits it, or that binutils handles it. So the answer must
>> lie somewhere on the system side. David?
>
> The official answer from IBM XLC is the section is for both
> .debug_macinfo and .debug_macro
>
> For DWARF4 and below, the dwmac section corresponds to .debug_macinfo.
> For DWARF5 and above, the dwmac section corresponds to .debug_macro.
>
> XLC currently does not generate any macro debugging information for DWARF4.

Huh.
Let's make sure this is documented in the code.
  

Patch

diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 0d49751..998ca8f 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -159,11 +159,11 @@  static const struct dwarf2_debug_sections dwarf2_xcoff_nam
es = {
   { ".dwabrev", NULL },
   { ".dwline", NULL },
   { ".dwloc", NULL },
-  { NULL, NULL }, /* debug_macinfo */
-  { NULL, NULL }, /* debug_macro */
+  { ".dwmac", NULL },
+  { ".dwmac", NULL },
   { ".dwstr", NULL },
   { ".dwrnges", NULL },
-  { NULL, NULL }, /* debug_types */
+  { ".dwpbtyp", NULL },
   { NULL, NULL }, /* debug_addr */
   { ".dwframe", NULL },