aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.h
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2014-12-09 11:45:41 +0100
committerMark Wielaard <mjw@redhat.com>2015-01-23 17:29:19 +0100
commit743649fd80776de922475362bf3ac8b44511bb24 (patch)
treebb0e90750f05a5d2840cbfca16aab939b703b283 /gdb/gdbtypes.h
parent198297aafb4f7a9717be8370581b048ae9107c14 (diff)
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.
Diffstat (limited to 'gdb/gdbtypes.h')
-rw-r--r--gdb/gdbtypes.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 7c06a4f48f..ba5c85723b 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1019,9 +1019,16 @@ struct func_type
{
/* * The calling convention for targets supporting multiple ABIs.
Right now this is only fetched from the Dwarf-2
- DW_AT_calling_convention attribute. */
+ DW_AT_calling_convention attribute. The value is one of the
+ DW_CC enum dwarf_calling_convention constants. */
- unsigned calling_convention;
+ unsigned calling_convention : 8;
+
+ /* * Whether this function normally returns to its caller. It is
+ set from the DW_AT_noreturn attribute if set on the
+ DW_TAG_subprogram. */
+
+ unsigned int is_noreturn : 1;
/* * Only those DW_TAG_GNU_call_site's in this function that have
DW_AT_GNU_tail_call set are linked in this list. Function
@@ -1245,6 +1252,7 @@ extern void allocate_gnat_aux_type (struct type *);
#define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
#define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
#define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->calling_convention
+#define TYPE_NO_RETURN(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->is_noreturn
#define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->tail_call_list
#define TYPE_BASECLASS(thistype,index) TYPE_FIELD_TYPE(thistype, index)
#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses