Hi Omar, On Wed, Sep 27, 2023 at 11:20:55AM -0700, Omar Sandoval wrote: > Macro information references file names from the line number information > table, which is tricky in split DWARF for a couple of reasons. > > First, the line number information for a macro unit comes from the > .debug_line.dwo section in the split file, not the .debug_line section > in the skeleton file. This was not specified in the GNU DebugFission > design document [1] or the DWARF 5 standard, but it is how GCC and Clang > behave in practice and was clarified in DWARF standard issue > 200602.1 [2] for the upcoming DWARF 6 standard. > > dwarf_macro_getsrcfiles uses the line number information from whichever > Dwarf handle it was passed. This is error-prone, since the most natural > thing to do is to pass the skeleton Dwarf handle. Fix this by storing > the appropriate Dwarf handle in Dwarf_Macro_Op_Table and using that one.
Too bad we cannot fix the function signature because that would be an API break. But this makes sense (thanks again for the references). > Second, for .debug_macinfo.dwo in GNU DebugFission (generated by gcc > -gdwarf-4 -gstrict-dwarf -gsplit-dwarf), the offset into .debug_line.dwo > is implicitly 0. Again, this isn't in any specification, but it's how > GCC behaves in practice (Clang never generates macro information for > DWARF 4 split DWARF). Make get_macinfo_table default to 0 for split > DWARF when it can't find DW_AT_stmt_list. Makes sense, it cannot really be any other offset than zero. Applied, Mark