public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Sasha Da Rocha Pinheiro <darochapinhe@wisc.edu>
To: Mark Wielaard <mark@klomp.org>
Cc: "elfutils-devel@sourceware.org" <elfutils-devel@sourceware.org>
Subject: Re: File index given line (libdw)
Date: Mon, 17 Jul 2017 04:11:00 -0000	[thread overview]
Message-ID: <CY1PR0601MB169121ADDFA1CCBAD883D4EEA6A00@CY1PR0601MB1691.namprd06.prod.outlook.com> (raw)
In-Reply-To: <1500126960.14595.310.camel@klomp.org>

[Resending cause it seems it didn't go]

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.

What I need is direct access to the files I already have from a previous call to eliminate unnecessary search.

"Why is it important to match this particular filename to one in the vector you created from the Dwarf_Files?"
Because Dyninst needs to make its own parsing and fill its own data structures in the most efficient way.





From: Mark Wielaard <mark@klomp.org>
Sent: Saturday, July 15, 2017 8:56 AM
To: Sasha Da Rocha Pinheiro
Cc: elfutils-devel@sourceware.org
Subject: Re: File index given line (libdw)
    
On Sat, 2017-07-15 at 01:22 +0000, Sasha Da Rocha Pinheiro wrote:
> >But why do you want to do that?
> 
> Performance and save memory space.
> 
> >If we would add int dwarf_line_index (Dwarf_Line *line, size_t *idx) how
> >exactly would you use it?
> 
> I would get idx and save it in my data structure so I don't have to save the file name repeatedly for each line.

size_t and char * are the same size. Whether you use an index or a
string pointer doesn't mean the underlying strings are identical or not.
If you really need to know if they are equal you still need to compare
the actual strings.

> >A small example program would help to see what the exact semantics
> >should be.
> How it's currently being done :
> 
> 1. Dwarf_Files dfs <- dwarf_getsrcfiles
> 2. for each file in dfs get name (with dwarf_filesrc) -> save in vector filenames
> 3. Dwarf_Lines dls <- dwarf_getsrclines
> 4. for each line in dls get file name and "search this name in vector filenames"
> 
> We want to eliminate the "search this name in vector filenames", to
> make it from L F log(F) to L, by getting the index and consulting the
> file name of a line in the vector filenames directly.

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.

Do you get the Dwarf_Line from dwarf_onesrcline() or dwarf_getsrc_die()?

I assume you then use dwarf_linesrc() to get the filename associated
with the Dwarf_Line.

Why is it important to match this particular filename to one in the
vector you created from the Dwarf_Files?

There is indeed an association between the DwarfLines and the
Dwarf_Files. But currently that is an implementation detail. If we
expose the Dwarf_Line filename index associated with the Dwarf_Files
then it becomes a public interface.

I am not really that opposed to exposing this information. It might be
fine. But I would like to understand why you need/want this information.

Cheers,

Mark
    

  reply	other threads:[~2017-07-17  4:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-13  0:25 Sasha Da Rocha Pinheiro
2017-07-13  9:11 ` Mark Wielaard
2017-07-13 17:33   ` Sasha Da Rocha Pinheiro
2017-07-14 10:03     ` Mark Wielaard
2017-07-15  1:22       ` Sasha Da Rocha Pinheiro
2017-07-15 13:56         ` Mark Wielaard
2017-07-17  4:11           ` Sasha Da Rocha Pinheiro [this message]
2017-07-17 13:04             ` Mark Wielaard
2017-07-17 17:28               ` Sasha Da Rocha Pinheiro
2017-07-21 19:29                 ` Mark Wielaard
2017-07-26 21:25                   ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY1PR0601MB169121ADDFA1CCBAD883D4EEA6A00@CY1PR0601MB1691.namprd06.prod.outlook.com \
    --to=darochapinhe@wisc.edu \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).