aboutsummaryrefslogtreecommitdiff
path: root/gdb/rust-lang.c
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2018-10-11 14:47:30 +0100
committerAlan Hayward <alan.hayward@arm.com>2018-11-16 13:45:38 +0000
commit38a72da0f1d968432ae6a2a9697ba55932dc075e (patch)
treeb25e8c746263a3201b2a32bf60f2bc094eb8f46f /gdb/rust-lang.c
parentcf84fa6bcf514157df8343d32885050bafc396f7 (diff)
downloadbinutils-38a72da0f1d968432ae6a2a9697ba55932dc075e.zip
binutils-38a72da0f1d968432ae6a2a9697ba55932dc075e.tar.gz
binutils-38a72da0f1d968432ae6a2a9697ba55932dc075e.tar.bz2
Aarch64: Fix segfault when casting dummy calls
The following will segfault on aarch64 if foo is in another object, was compiled as c++ and has no debug symbols: (gdb) p (int)foo() This is because aarch64_push_dummy_call determines the return type of the function and then does not check for null pointer. A null pointer for the return type means the call has no debug information. For the code to get here, then the call must have been cast, otherwise we'd error out sooner. In the case of a no-debug-info call cast, the return type is the type the user had cast the call to, but we do not have that information available here. However, aarch64_push_dummy_call only requires the return type in order to calculate lang_struct_return. This information is available in the return_method enum. The fix is to simply use this instead. Adds testcase to check calls across objects, with all combinations of c, c++, debug and no debug. gdb/ChangeLog: PR gdb/22736: * aarch64-tdep.c (aarch64_push_dummy_call): Remove lang_struct_return code. gdb/testsuite/ChangeLog: PR gdb/22736: * gdb.cp/infcall-nodebug-lib.c: New test. * gdb.cp/infcall-nodebug-main.c: New test. * gdb.cp/infcall-nodebug.exp: New file.
Diffstat (limited to 'gdb/rust-lang.c')
0 files changed, 0 insertions, 0 deletions