diff options
author | Kevin Pouget <kpouget@sourceware.org> | 2011-10-27 11:04:27 +0000 |
---|---|---|
committer | Kevin Pouget <kpouget@sourceware.org> | 2011-10-27 11:04:27 +0000 |
commit | 2231f1fb609de30056ec5d3f526b39ee146efcab (patch) | |
tree | c7f513cc242b04a687017f406ba7507fca657df7 /gdb/python | |
parent | f77b9a5df0dca976e9fa9c8731c313d5b54befe1 (diff) | |
download | gdb-2231f1fb609de30056ec5d3f526b39ee146efcab.zip gdb-2231f1fb609de30056ec5d3f526b39ee146efcab.tar.gz gdb-2231f1fb609de30056ec5d3f526b39ee146efcab.tar.bz2 |
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.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-frame.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index e192ffa..20064ca 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -553,7 +553,7 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "i", &reason)) return NULL; - if (reason < 0 || reason > UNWIND_NO_SAVED_PC) + if (reason < UNWIND_FIRST || reason > UNWIND_LAST) { PyErr_SetString (PyExc_ValueError, _("Invalid frame stop reason.")); @@ -610,18 +610,13 @@ gdbpy_initialize_frames (void) PyModule_AddIntConstant (gdb_module, "SIGTRAMP_FRAME", SIGTRAMP_FRAME); PyModule_AddIntConstant (gdb_module, "ARCH_FRAME", ARCH_FRAME); PyModule_AddIntConstant (gdb_module, "SENTINEL_FRAME", SENTINEL_FRAME); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_NO_REASON", UNWIND_NO_REASON); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_NULL_ID", UNWIND_NULL_ID); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_FIRST_ERROR", UNWIND_FIRST_ERROR); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_INNER_ID", UNWIND_INNER_ID); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_SAME_ID", UNWIND_SAME_ID); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_NO_SAVED_PC", UNWIND_NO_SAVED_PC); + +#define SET(name, description) \ + PyModule_AddIntConstant (gdb_module, "FRAME_"#name, name); +#define FIRST_ERROR(name) \ + PyModule_AddIntConstant (gdb_module, "FRAME_"#name, name); +#include "unwind_stop_reasons.def" +#undef SET Py_INCREF (&frame_object_type); PyModule_AddObject (gdb_module, "Frame", (PyObject *) &frame_object_type); |