Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: New feature "source-id"
Date: Sat, 15 Mar 2014 17:32:00 -0000	[thread overview]
Message-ID: <CADPb22RsRdFvr09HC_zj_tvBVLEScC6UzgNs=UCjpf3zWCt_gQ@mail.gmail.com> (raw)
In-Reply-To: <7365721.BnaR1nHazz@lt-gergap>

On Sat, Mar 15, 2014 at 3:49 AM, Gerhard Gappmeier
<gerhard.gappmeier@ascolab.com> wrote:
> Hi all,
>
> I've implemented a new feature that I call "source-id" analogous to the
> existing "build-id" functionality. Unlike fetching debug symbols automatically
> using build-ids this feature can fetch the correct source code from a version
> control system when debugging.
> The idea is that when you need to debug an executable or opening a coredump of
> an executable that was built with "source-id" and "build-id" enabled it just
> works. You don't need to care about how and where to get debug symbols and the
> correct sources.
>
> How does this works? The technical details are explained in the README.md
> hosted in my test repository: https://github.com/gergap/source-id
> (The content of README.md is shown on this site nicely formatted)
> This repository contains an example that I used to test the new feature.
> It also contains example "source-fetch-scripts" that are used by GDB to fetch
> the source code. This should probably be bundled with GDB itself. Just give me
> a hint where the best location would be to add these files in the GDB repo.
>
> The GDB patches you find here: https://github.com/gergap/binutils-gdb
> on the branch gergap/source-id-feature
>
> What has been changed in GDB:
> * add support for a new .note section ".note.gnu.source-id" to be able to
> store and retrieve the VCS data from an ELF file.
> * add new gdb commands: "set source-lookup <script>", "unset source-lookup",
> "show source-lookup". This way the source-lookup functionality can be enabled.
> * change function open_source_file to fetch the source file using the external
> fetch script.
> * disable mtime check when source-lookup is enabled to avoid the warning
> "Source file is more recent than executable". It is normal that the timestamp
> is newer when it was just fetched using a VCS like git.
>
> What I need from you guys:
> * Feedback if you like the feature or not. I really hope this feature can make
> it into mainline as it is really useful.
> * Feedback on the implementation: Security, CodingStyle, etc.
> * We need to make the new section ".note.gnu.source-id" official. I don't know
> who maintains this and this needs to be registered somewhere.
>
> Future work:
> * adding file hashes (SHA1) for each source file to the debug info. This way
> we can completely remove the mtime check and replace it with a check of the
> SHA1 sum. When we can replace the existing warning with a message like "The
> source file does not match the executable."
> * this hash can also be used to implement reliable caching for the "fetch-
> scripts"

Hi!
I would support including this feature in gdb.
But IMO the fetching of source must go through the Extension Language API.
See gdb/extension*.[ch].
I.e., don't do the popen in gdb.  Just call out to the extension
language via the API (e.g, Python), passing it the necessary
parameters.
[One could elaborate on this, following the
pretty-printer/debug-operator scheme and support having multiple
source fetchers that can be individually enabled/disabled.  Dunno if
it's necessary though, have to think about it some more.]

I didn't dig deeper into the implementation, but it is an interesting idea.


  reply	other threads:[~2014-03-15 17:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-15 10:49 Gerhard Gappmeier
2014-03-15 17:32 ` Doug Evans [this message]
2014-03-15 20:06   ` Eli Zaretskii
2014-03-16  2:34     ` Doug Evans
2014-03-16  9:43       ` Gerhard Gappmeier
2014-03-16 16:22       ` Doug Evans
2014-03-16 16:34         ` Eli Zaretskii
2014-03-17  8:49         ` Gerhard Gappmeier
2014-03-17 12:25           ` Matt Rice
2014-03-17 19:01             ` Gerhard Gappmeier
2014-03-18  0:25               ` Doug Evans
2014-03-18  0:48                 ` Bruce Dawson
2014-03-18  1:39                   ` Doug Evans
2014-03-18 17:44                     ` Bruce Dawson
2014-03-18 17:57                       ` Doug Evans
2014-03-18 13:22 ` Mark Wielaard
2014-03-18 14:00   ` Gerhard Gappmeier
2014-03-18 15:03     ` Mark Wielaard
2014-03-18 16:40       ` Gerhard Gappmeier
2014-03-18 17:56         ` Bruce Dawson
2014-05-21 19:30           ` Tom Tromey
2014-05-21 20:42             ` Bruce Dawson

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='CADPb22RsRdFvr09HC_zj_tvBVLEScC6UzgNs=UCjpf3zWCt_gQ@mail.gmail.com' \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=gerhard.gappmeier@ascolab.com \
    /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