This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: New feature "source-id"


On Sunday, March 16, 2014 09:22:17 AM Doug Evans wrote:
> On Sat, Mar 15, 2014 at 7:34 PM, Doug Evans <dje@google.com> wrote:
> > Note that one concern I have is that it may be that some sites will
> > want to have some of gdb's state updated when source files are
> > automagically fetched.  E.g., maybe one would want to update the
> > source search path.  Maybe not, but at any rate I don't want this
> > feature to preclude doing things like that, and one can't do that if
> > the feature works by running an external program via popen.
> 
> As a data point,
> another way to go is to just have a convention for some global
> variables in the binary.
> With the debug info gdb can access them, and they could contain
> everything that would be in the .note section.
> 
> I don't have a preference, per se.
> I just mention it as a possibility, and if one went that route then
> doing this in Python/Guile would be while perhaps not required
> certainly easy.
That's an interesting idea. When I first read this comment I thought it would 
require code changes what would not be what I want. But indeed we can simply 
generate an own 'vcsinfo.c' file which gets compiled and linked with the 
executable. I think its even simpler to add a new C file than requiring GNU as 
to generate a new section.

example vcsinfo.c:
/* this file was genarated, bla bla, don't modifiy */
static const char vcs_type[] = "git";
static const char vcs_url[] = "git@github.com:gergap/source-id.git"
static const char vcs_version[] = "c2ec66e6a36451ba47422d186fd97311989ef278"

I just have to investigate how to access this debug info in GDB, as I'm still 
new to this code. I hope it is as easy as it was to access the ELF info ;-)

Do you see any problem with declaring the variables static? Doing so we can 
avoid name clashes.

How can we avoid that these variables get dropped by the linker if they are 
not referenced by any code? declaring them volatile?


-- 
mit freundlichen GrÃÃen / best regards

Gerhard Gappmeier
ascolab GmbH - automation systems communication laboratory
Tel.: +49 9131 691 123
Fax: +49 9131 691 128
Web: http://www.ascolab.com
GPG-KeyId: 5AAC50C4
GPG-Fingerprint: 967A 15F1 2788 164D CCA3 6C46 07CD 6F82 5AAC 50C4

--
ascolab GmbH
GeschÃftsfÃhrer: Gerhard Gappmeier, Matthias Damm, Uwe SteinkrauÃ
Sitz der Gesellschaft: Am Weichselgarten 7 â 91058 Erlangen â Germany
Registernummer: HRB 9360
Registergericht: Amtsgericht FÃrth

Attachment: signature.asc
Description: This is a digitally signed message part.


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