aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-12-29 10:46:07 -0700
committerTom Tromey <tom@tromey.com>2019-01-06 09:31:51 -0700
commitf097f5ad808bd535236a65077f40e9d082a4ec0b (patch)
treefa4dc08ce6be4fd7368b1af3538c0b038e8722f9 /gdb/infcmd.c
parentbb86dd08b25624206c3943b56b79784928e58464 (diff)
downloadfsf-binutils-gdb-f097f5ad808bd535236a65077f40e9d082a4ec0b.zip
fsf-binutils-gdb-f097f5ad808bd535236a65077f40e9d082a4ec0b.tar.gz
fsf-binutils-gdb-f097f5ad808bd535236a65077f40e9d082a4ec0b.tar.bz2
Fix crash in "finish"
PR gdb/28155 notes a crash in "finish" that occurs with a particular source file compiled by clang. The bug is the typical gdb problem of a missing call to check_typedef. clang emits a function whose return type is a typedef to void. get_return_value asserts that the return type is not void, but the callers were not using check_typedef first. gdb/ChangeLog 2019-01-06 Tom Tromey <tom@tromey.com> PR gdb/28155: * python/py-finishbreakpoint.c (bpfinishpy_init): Use check_typedef. * infcmd.c (finish_command_fsm_should_stop): Use check_typedef. (print_return_value): Likewise. gdb/testsuite/ChangeLog 2019-01-06 Tom Tromey <tom@tromey.com> PR gdb/28155: * gdb.dwarf2/typedef-void-finish.exp: New file.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 182960a..3c3add8 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1706,7 +1706,8 @@ print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv)
void
print_return_value (struct ui_out *uiout, struct return_value_info *rv)
{
- if (rv->type == NULL || TYPE_CODE (rv->type) == TYPE_CODE_VOID)
+ if (rv->type == NULL
+ || TYPE_CODE (check_typedef (rv->type)) == TYPE_CODE_VOID)
return;
TRY
@@ -1800,7 +1801,7 @@ finish_command_fsm_should_stop (struct thread_fsm *self,
internal_error (__FILE__, __LINE__,
_("finish_command: function has no target type"));
- if (TYPE_CODE (rv->type) != TYPE_CODE_VOID)
+ if (TYPE_CODE (check_typedef (rv->type)) != TYPE_CODE_VOID)
{
struct value *func;