aboutsummaryrefslogtreecommitdiff
path: root/gdb/objc-lang.c
diff options
context:
space:
mode:
authorAntoine Tremblay <antoine.tremblay@ericsson.com>2017-01-26 10:47:27 -0500
committerAntoine Tremblay <antoine.tremblay@ericsson.com>2017-01-26 10:47:27 -0500
commit874a1c8c32036f790fa527acfab3f6f18740f089 (patch)
treebe2f4ea77f43b64780a1da05989977f6e3a9f95e /gdb/objc-lang.c
parentd8b49cf0c891d09dd58de05ad5cfe396b612cf3b (diff)
downloadgdb-874a1c8c32036f790fa527acfab3f6f18740f089.zip
gdb-874a1c8c32036f790fa527acfab3f6f18740f089.tar.gz
gdb-874a1c8c32036f790fa527acfab3f6f18740f089.tar.bz2
Fix crash when loading a core with unexpected register section size
When loading a core without an executable like so: $ gdb --core core for example often the gdbarch won't contain the iterate_over_regset_sections method. For example on ARM. This will generate a call to get_core_register_section with a NULL regset like at corelow.c:628 get_core_register_section (regcache, NULL, ".reg", 0, 0, "general-purpose", 1); However a check for REGSET_VARIABLE_SIZE in get_core_register_section assumes that regset is != NULL thus leading to a crash with this backtrace: (gdb) bt #0 0x000000000065907b in get_core_register_section (regcache=regcache@entry=0x2c26260, regset=regset@entry=0x0, name=name@entry=0xdbf7b2 ".reg", min_size=min_size@entry=0, which=which@entry=0, human_name=human_name@entry=0xdbac28 "general-purpose", required=1) at ../../gdb/corelow.c:542 #1 0x0000000000659b70 in get_core_registers (ops=<optimized out>, regcache=0x2c26260, regno=<optimized out>) at ../../gdb/corelow.c:628 #2 0x000000000076e5fb in target_fetch_registers (regcache=regcache@entry=0x2c26260, regno=regno@entry=15) at ../../gdb/target.c:3590 Note that commit: f962539ad23759 ("Warn if core file register section is larger than expected") introduced this issue. Thus releases > 7.8.2 are affected. Also, this would have been caught by gdb.base/corefile.exp but the problem is that this triggers only if the core dump is missing some data so that it's not recognized as a linux core dump, or it's not a linux core dump and the core file register section is larger than expected. So if you just create a core and read it on linux with ARM the osabi is detected properly and iterate_over_regset_sections is present and so the problem is not triggered. Thus creating a linux test for this with a crafted core that meets the problem requirements is non-trivial. This patch fixes this crash by adding a check for regset existence before running the condition. gdb/ChangeLog: * corelow.c (get_core_register_section): Check for regset existence before checking for REGSET_VARIABLE_SIZE.
Diffstat (limited to 'gdb/objc-lang.c')
0 files changed, 0 insertions, 0 deletions