This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: File index given line (libdw)


I understand your argument. Since I was doing:
   
   dwarf_getsrclines(&cuDIE, &lineBuffer, &lineCount)
   dwarf_getsrcfiles(&cuDIE, &files, &filecount)

I knew they were related because I used the same DIE. But someone trying to use a function which returns only the index could be confusing about what Dwarf_Files it came from. 

But, with

extern int *
dwarf_line_files (Dwarf_Line *line, Dwarf_Files **files, size_t *idx);

they would know what Dwarf_Files the line is related to. For me, though, I could pass NULL for files, since I already knew what it is.




From: Mark Wielaard <mark@klomp.org>
Sent: Monday, July 17, 2017 8:04 AM
To: Sasha Da Rocha Pinheiro
Cc: elfutils-devel@sourceware.org
Subject: Re: File index given line (libdw)
    
On Mon, 2017-07-17 at 04:10 +0000, Sasha Da Rocha Pinheiro wrote:
> [Resending cause it seems it didn't go]

Probably because it had an HTML attachement.
The mailinglist rejects emails with HTML.

> You understood what I need when you said:
> "So you want to keep a vector with filenames for a particular CU. And
> then given Dwarf_Lines you want to associate each Dwarf_Line with a
> particular filename from that vector."
> 
> I agree with this "But currently that is an implementation detail. "
> But I don't see why this would change. Deliberately sort the files
> names so it doesn't match with the lines? I don't think so.

But newer versions of DWARF could have a different way of sharing the
source files or directory table between CUs. The issue is that the index
from the Dwarf_Lines only makes sense if you know which CU the
corresponding Dwarf_Files came from. So instead of providing the
relationship between a Dwarf_Line and a Dwarf_File I rather would not
depend on something indirect like the index into some Dwarf_Files table.
If we do provide it then I think we should be explicit about what it is
an index into. So maybe a function like:

extern int *
dwarf_line_files (Dwarf_Line *line, Dwarf_Files **files, size_t *idx);

Where files and idx are returned in a way that make them useful with
dwarf_filesrc. Would the above be helpful for your usecase?

Cheers,

Mark
    

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]