diff options
author | Andrew Burgess <aburgess@redhat.com> | 2024-06-08 11:06:02 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2024-12-24 14:15:24 +0000 |
commit | 600456716565103241530d7bd429cd9fb6c6258b (patch) | |
tree | 204e36685a73841d870d5924b9694a7c3048afce /gdb/linux-tdep.c | |
parent | d3d13bf876aae425ae0eff2ab0f1af9f7da0264a (diff) | |
download | fsf-binutils-gdb-600456716565103241530d7bd429cd9fb6c6258b.zip fsf-binutils-gdb-600456716565103241530d7bd429cd9fb6c6258b.tar.gz fsf-binutils-gdb-600456716565103241530d7bd429cd9fb6c6258b.tar.bz2 |
gdb: parse and set the inferior environment from core files
Extend the core file context parsing mechanism added in the previous
commit to also store the environment parsed from the core file.
This environment can then be injected into the inferior object.
The benefit of this is that when examining a core file in GDB, the
'show environment' command will now show the environment extracted
from a core file.
Consider this example:
$ env -i GDB_TEST_VAR=FOO ./gen-core
Segmentation fault (core dumped)
$ gdb -c ./core.1669829
...
[New LWP 1669829]
Core was generated by `./gen-core'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000401111 in ?? ()
(gdb) show environment
GDB_TEST_VAR=foo
(gdb)
There's a new test for this functionality.
Diffstat (limited to 'gdb/linux-tdep.c')
-rw-r--r-- | gdb/linux-tdep.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 8d506fe..6d90e89 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -2074,8 +2074,7 @@ linux_corefile_parse_exec_context_1 (struct gdbarch *gdbarch, bfd *cbfd) be pointing at the first environment string. */ ptr += ptr_bytes; - /* Parse the environment strings. Nothing is done with this yet, but - will be in a later commit. */ + /* Parse the environment strings. */ std::vector<gdb::unique_xmalloc_ptr<char>> environment; while ((v = deref (ptr)) != 0) { @@ -2092,7 +2091,8 @@ linux_corefile_parse_exec_context_1 (struct gdbarch *gdbarch, bfd *cbfd) return {}; return core_file_exec_context (std::move (execfn), - std::move (arguments)); + std::move (arguments), + std::move (environment)); } /* Parse and return execution context details from core file CBFD. */ |