]> sourceware.org Git - binutils-gdb.git/commit
[gdb] Fix segfault in solib_contains_address_p
authorTom de Vries <tdevries@suse.de>
Wed, 14 Oct 2020 10:24:42 +0000 (12:24 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 14 Oct 2020 10:24:42 +0000 (12:24 +0200)
commit76547ab31b16b521e29892cab5a29b60b52291a5
treeed977f6bb0d35d24d8137921b1920eb8bb260f46
parent7b47a312561818d9853f8e89fa43a86304f7040c
[gdb] Fix segfault in solib_contains_address_p

Starting commit bb2a67773c "Use a std::vector in target_section_table" we run
into:
...
ERROR: GDB process no longer exists
GDB process exited with wait status 22239 exp12 0 0 CHILDKILLED SIGABRT
UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint
...
which reproduces as:
...
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
solib_contains_address_p (address=4196111, solib=0x1dd9970)
    at /home/vries/gdb_versions/devel/src/gdb/solib.c:1120
1120      for (target_section &p : solib->sections->sections)
(gdb) p solib->sections->sections
Cannot access memory at address 0x0
...

Fix this by handling solib->sections == nullptr in solib_contains_address_p.

Build and reg-tested on x86_64-linux.

gdb/ChangeLog:

2020-10-14  Tom de Vries  <tdevries@suse.de>

PR gdb/26733
* solib.c (solib_contains_address_p): Handle
'solib->sections == nullptr'.
gdb/ChangeLog
gdb/solib.c
This page took 0.038155 seconds and 5 git commands to generate.