Use GCC5/DWARF5 DW_AT_noreturn to mark functions that don't return normally.
Add a flag field is_noreturn to struct func_type. Make calling_convention a small bit field to not increase the size of the struct. Set is_noreturn if the new GCC5/DWARF5 DW_AT_noreturn is set on a DW_TAG_subprogram. Use this information to warn the user before doing a finish or return from a function that does not return normally to its caller. (gdb) finish warning: Function endless does not return normally. Try to finish anyway? (y or n) (gdb) return warning: Function does not return normally to caller. Make endless return now? (y or n) gdb/ChangeLog * dwarf2read.c (read_subroutine_type): Set TYPE_NO_RETURN from DW_AT_noreturn. * gdbtypes.h (struct func_type): Add is_noreturn field flag. Make calling_convention an 8 bit bit field. (TYPE_NO_RETURN): New macro. * infcmd.c (finish_command): Query if function does not return normally. * stack.c (return_command): Likewise. gdb/testsuite/ChangeLog * gdb.base/noreturn-return.c: New file. * gdb.base/noreturn-return.exp: New file. * gdb.base/noreturn-finish.c: New file. * gdb.base/noreturn-finish.exp: New file. include/ChangeLog * dwarf2.def (DW_AT_noreturn): New DWARF5 attribute. The dwarf2.h addition and the code to emit the new attribute is already in the gcc tree.
This commit is contained in:
parent
198297aafb
commit
743649fd80
12 changed files with 218 additions and 5 deletions
|
@ -2462,8 +2462,12 @@ return_command (char *retval_exp, int from_tty)
|
|||
confirmed = query (_("%sMake selected stack frame return now? "),
|
||||
query_prefix);
|
||||
else
|
||||
confirmed = query (_("%sMake %s return now? "), query_prefix,
|
||||
SYMBOL_PRINT_NAME (thisfun));
|
||||
{
|
||||
if (TYPE_NO_RETURN (thisfun->type))
|
||||
warning ("Function does not return normally to caller.");
|
||||
confirmed = query (_("%sMake %s return now? "), query_prefix,
|
||||
SYMBOL_PRINT_NAME (thisfun));
|
||||
}
|
||||
if (!confirmed)
|
||||
error (_("Not confirmed"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue