public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Sasha Da Rocha Pinheiro <darochapinhe@wisc.edu>
Cc: "elfutils-devel@sourceware.org" <elfutils-devel@sourceware.org>
Subject: Re: Read .debug_line without .debug_info
Date: Mon, 26 Mar 2018 19:12:00 -0000	[thread overview]
Message-ID: <20180326191201.GC9061@wildebeest.org> (raw)
In-Reply-To: <BY2PR06MB88661D28F002212597606E7A6AD0@BY2PR06MB886.namprd06.prod.outlook.com>

Hi Sasha,

On Mon, Mar 26, 2018 at 04:41:06PM +0000, Sasha Da Rocha Pinheiro wrote:
> is it possible to read contents of .debug_line section without the
> presence of a .debug_info section?

No, because .debug_line sections need some information from the CU
which comes from the .debug_info. In particular the directory table
starts with the compilation directory which can only be gotten from
the CU (DW_AT_comp_dir). The files in the file list (which don't have
an explicit dir associated) are all given relative to that comp dir.

A line table can only be gotten through a CU DIE (from the .debug_info).

But DWARF5 did make some changes that mean the .debug_line tables
can stand on their own (and have their own .debug_line_str section
for the dir and file names). I am about to post patches for that.
But I haven't thought about adding an interface to iterate through
the line tables without associated CUs. It would be nice if that
also worked for pre-DWARF5 line tables. But how to represent the
missing information?

> We have CUDA binaries being generated with only .debug_line, and we
> wish to use that. Is it possible to do that with libdw?

Not at the moment. Sorry.

> If not, any ideas of how to construct a minimum .debug_info in order
> to read it?

At the moment you need a minimal CU DIE with a DW_AT_stmt_list pointing
to the line table, a DW_AT_name for the primary source file and a
DW_AT_comp_dir for the compilation directory to resolve any relative
file.

Cheers,

Mark

  reply	other threads:[~2018-03-26 19:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-26 16:41 Sasha Da Rocha Pinheiro
2018-03-26 19:12 ` Mark Wielaard [this message]
2018-03-26 19:25   ` Torsten Polle
2018-03-27  9:09     ` 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=20180326191201.GC9061@wildebeest.org \
    --to=mark@klomp.org \
    --cc=darochapinhe@wisc.edu \
    --cc=elfutils-devel@sourceware.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).