From f097f5ad808bd535236a65077f40e9d082a4ec0b Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 29 Dec 2018 10:46:07 -0700 Subject: 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 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 PR gdb/28155: * gdb.dwarf2/typedef-void-finish.exp: New file. --- gdb/python/py-finishbreakpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/python/py-finishbreakpoint.c') diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c index bc22582..6ad79cd 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -253,7 +253,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) if (function != NULL) { struct type *ret_type = - TYPE_TARGET_TYPE (SYMBOL_TYPE (function)); + check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (function))); /* Remember only non-void return types. */ if (TYPE_CODE (ret_type) != TYPE_CODE_VOID) -- cgit v1.1