File index given line (libdw)

Sasha Da Rocha Pinheiro darochapinhe@wisc.edu
Thu Jul 13 17:33:00 GMT 2017


Hi Mark, 

given a Die, I want to associate each line (from dwarf_getsrclines) to a file (from dwarf_getsrcfiles). The only way to do this is get the filename returned by dwarf_linesrc, and search in the filenames given by dwarf_getsrcfiles and dwarf_filesrc. But this is expensive since this has to be done for each line. Instead, if I could get the file index in the array "struct Dwarf_Fileinfo_s info", I wouldn't need to search.


  
From: Mark Wielaard <mark@klomp.org>
Sent: Thursday, July 13, 2017 4:11:09 AM
To: Sasha Da Rocha Pinheiro
Cc: elfutils-devel@sourceware.org
Subject: Re: File index given line (libdw)
    
Hi Sasha,

On Thu, 2017-07-13 at 00:25 +0000, Sasha Da Rocha Pinheiro wrote:
> when we get the files given a Die and want to know the file given the
> line, the only way to do this is comparing the return of dwarf_linesrc
> with the list of filenames we had from dwarf_getsrcfiles?
> Why can't we get the index of the file given the line? Just return the unsigned int file in Dwarf_Line_s.

There could be a good reason for that. But I might be missing the bigger
picture of what you are trying to do. Could you give a more complete
code example? What extra information do you want by having the
Dwarf_Files index of the Dwarf_Line?

Thanks,

Mark
    


More information about the Elfutils-devel mailing list