On Sun, Feb 13, 2022 at 1:43 PM stephen.t....@gmail.com <stephen.t.illingwo...@gmail.com> wrote: > > I've encountered something else that I don't understand. This time regarding > dwarf.AttrDeclFile and how the value of that field relates to the list of > source files in the project > > From what I can understand, the value of AttrDeclFile is an index into an > array of filenames. If the number is zero then the indicates that no source > file has been specified. > > The dwarf package allows retrieval of the file list with LineReader.Files() > function - the LineReader being created with reference to the current > compilation unit. > > For most ELF/DWARF examples I have, my understanding seems correct. However, > in one example I have, the value of AttrDeclFile can exceed the length of the > file array returned by LineReader.Files(). An invalid reference in other > words. > > Moreover, for AttrDeclFiles values that are within range of the array, they > are most definitely referencing the wrong file. > > I'm I misunderstanding the relationship between AttrDeclFile and > LineReader.Files(), is there some other way of accessing the file array, or > has something gone horribly wrong?
What you write sounds correct. Can you show us the output "readelf --debug" on the file in question, and point out the problematic case? Thanks. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcX-1Nt4aFmW8B62pNHpNGaqbC0mu6yRtQM7ZTBhP%3DQfQw%40mail.gmail.com.