public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jan Vrany <jan.vrany@fit.cvut.cz>
To: gdb@sourceware.org
Subject: Re: Getting access to environement variables
Date: Fri, 05 Feb 2021 14:34:07 +0000	[thread overview]
Message-ID: <6c05f6f35de09330538fbeca5d4c1c68964f108e.camel@fit.cvut.cz> (raw)
In-Reply-To: <0cb22341-6d2e-5889-d07c-3a00f29fcdd8@trusted-objects.com>

On Fri, 2021-02-05 at 15:28 +0100, vincent Dupaquis wrote:
> Good point !
> 
> That's something I already use when instrumenting gdb, but for some
> easy
> and quick scripting, it would have been easier to be able to access
> the
> environement variables directly from the gdb commands.

I have not tried, but I believe you can implement new convenience
function in Python that would allow you to write something like

   $ENV("MY_ENV_VARIABLE") 

See
https://sourceware.org/gdb/onlinedocs/gdb/Functions-In-Python.html#Functions-In-Python

HTH, Jan

> 
> Vincent.
> 
> Le 05/02/2021 à 15:06, Paul Koning a écrit :
> > 
> > > On Feb 5, 2021, at 4:58 AM, vincent Dupaquis <
> > > v.dupaquis@trusted-objects.com> wrote:
> > > 
> > >     Hello,
> > > 
> > >     I would like to point-out a possibly missing feature, which
> > > is the
> > > possibility of accessing ENV variables in GDB commands.
> > Assuming your GDB is built with Python scripting included, you can
> > do it via Python; "import os" then access environment variables as
> > elements of dictionary "os.environ".
> > 
> >         paul
> > 



  reply	other threads:[~2021-02-05 14:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05  9:58 vincent Dupaquis
2021-02-05 14:06 ` Paul Koning
2021-02-05 14:28   ` vincent Dupaquis
2021-02-05 14:34     ` Jan Vrany [this message]
2021-02-05 14:51       ` vincent Dupaquis

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=6c05f6f35de09330538fbeca5d4c1c68964f108e.camel@fit.cvut.cz \
    --to=jan.vrany@fit.cvut.cz \
    --cc=gdb@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).