From 2231f1fb609de30056ec5d3f526b39ee146efcab Mon Sep 17 00:00:00 2001 From: Kevin Pouget Date: Thu, 27 Oct 2011 11:04:27 +0000 Subject: Move unwind reasons to an external .def file gdb/ * frame.c (frame_stop_reason_string): Rewrite using unwind_stop_reasons.def. * frame.h (enum unwind_stop_reason): Likewise. * python/py-frame.c (gdbpy_initialize_frames): Likewise. (gdbpy_frame_stop_reason_string): Use new enum unwind_stop_reason constants for bound-checking. * unwind_stop_reasons.def: New file. * stack.c (backtrace_command_1): Handle UNWIND_FIRST_ERROR as an alias instead of a distinct value. doc/ * gdb.texinfo ((Frames In Python): Document gdb.FRAME_UNWIND_FIRST_ERROR contant. --- gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 13 +++++++++++++ 2 files changed, 18 insertions(+) (limited to 'gdb/doc') diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 403675e..2001e0c 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2011-10-27 Kevin Pouget + + * gdb.texinfo ((Frames In Python): Document + gdb.FRAME_UNWIND_FIRST_ERROR contant. + 2011-10-26 Paul Koning * gdb.texinfo (gdb.types): Document new deepitems function. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index b451a6a..3e78832 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -23473,6 +23473,19 @@ stack corruption. @item gdb.FRAME_UNWIND_NO_SAVED_PC The frame unwinder did not find any saved PC, but we needed one to unwind further. + +@item gdb.FRAME_UNWIND_FIRST_ERROR +Any stop reason greater or equal to this value indicates some kind +of error. This special value facilitates writing code that tests +for errors in unwinding in a way that will work correctly even if +the list of the other values is modified in future @value{GDBN} +versions. Using it, you could write: +@smallexample +reason = gdb.selected_frame().unwind_stop_reason () +reason_str = gdb.frame_stop_reason_string (reason) +if reason >= gdb.FRAME_UNWIND_FIRST_ERROR: + print "An error occured: %s" % reason_str +@end smallexample @end table @end defun -- cgit v1.1