Re: Getting access to environement variables
Jan Vrany <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
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 <
> > > [email protected]> 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
> >