OLD | NEW |
1 /* Python interface to stack frames | 1 /* Python interface to stack frames |
2 | 2 |
3 Copyright (C) 2008-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2008-2012 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GDB. | 5 This file is part of GDB. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 /* Require a valid frame. This must be called inside a TRY_CATCH, or | 48 /* Require a valid frame. This must be called inside a TRY_CATCH, or |
49 another context in which a gdb exception is allowed. */ | 49 another context in which a gdb exception is allowed. */ |
50 #define FRAPY_REQUIRE_VALID(frame_obj, frame) \ | 50 #define FRAPY_REQUIRE_VALID(frame_obj, frame) \ |
51 do { \ | 51 do { \ |
52 frame = frame_object_to_frame_info (frame_obj); \ | 52 frame = frame_object_to_frame_info (frame_obj); \ |
53 if (frame == NULL) \ | 53 if (frame == NULL) \ |
54 error (_("Frame is invalid.")); \ | 54 error (_("Frame is invalid.")); \ |
55 } while (0) | 55 } while (0) |
56 | 56 |
57 static PyTypeObject frame_object_type; | |
58 | |
59 /* Returns the frame_info object corresponding to the given Python Frame | 57 /* Returns the frame_info object corresponding to the given Python Frame |
60 object. If the frame doesn't exist anymore (the frame id doesn't | 58 object. If the frame doesn't exist anymore (the frame id doesn't |
61 correspond to any frame in the inferior), returns NULL. */ | 59 correspond to any frame in the inferior), returns NULL. */ |
62 | 60 |
63 struct frame_info * | 61 struct frame_info * |
64 frame_object_to_frame_info (PyObject *obj) | 62 frame_object_to_frame_info (PyObject *obj) |
65 { | 63 { |
66 frame_object *frame_obj = (frame_object *) obj; | 64 frame_object *frame_obj = (frame_object *) obj; |
67 struct frame_info *frame; | 65 struct frame_info *frame; |
68 | 66 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 Py_RETURN_TRUE; | 115 Py_RETURN_TRUE; |
118 } | 116 } |
119 | 117 |
120 /* Implementation of gdb.Frame.name (self) -> String. | 118 /* Implementation of gdb.Frame.name (self) -> String. |
121 Returns the name of the function corresponding to this frame. */ | 119 Returns the name of the function corresponding to this frame. */ |
122 | 120 |
123 static PyObject * | 121 static PyObject * |
124 frapy_name (PyObject *self, PyObject *args) | 122 frapy_name (PyObject *self, PyObject *args) |
125 { | 123 { |
126 struct frame_info *frame; | 124 struct frame_info *frame; |
127 char *name; | 125 const char *name; |
128 enum language lang; | 126 enum language lang; |
129 PyObject *result; | 127 PyObject *result; |
130 volatile struct gdb_exception except; | 128 volatile struct gdb_exception except; |
131 | 129 |
132 TRY_CATCH (except, RETURN_MASK_ALL) | 130 TRY_CATCH (except, RETURN_MASK_ALL) |
133 { | 131 { |
134 FRAPY_REQUIRE_VALID (self, frame); | 132 FRAPY_REQUIRE_VALID (self, frame); |
135 | 133 |
136 find_frame_funname (frame, &name, &lang, NULL); | 134 find_frame_funname (frame, &name, &lang, NULL); |
137 } | 135 } |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 { "newer", frapy_newer, METH_NOARGS, | 651 { "newer", frapy_newer, METH_NOARGS, |
654 "newer () -> gdb.Frame.\n\ | 652 "newer () -> gdb.Frame.\n\ |
655 Return the frame called by this frame." }, | 653 Return the frame called by this frame." }, |
656 { "find_sal", frapy_find_sal, METH_NOARGS, | 654 { "find_sal", frapy_find_sal, METH_NOARGS, |
657 "find_sal () -> gdb.Symtab_and_line.\n\ | 655 "find_sal () -> gdb.Symtab_and_line.\n\ |
658 Return the frame's symtab and line." }, | 656 Return the frame's symtab and line." }, |
659 { "read_var", frapy_read_var, METH_VARARGS, | 657 { "read_var", frapy_read_var, METH_VARARGS, |
660 "read_var (variable) -> gdb.Value.\n\ | 658 "read_var (variable) -> gdb.Value.\n\ |
661 Return the value of the variable in this frame." }, | 659 Return the value of the variable in this frame." }, |
662 { "select", frapy_select, METH_NOARGS, | 660 { "select", frapy_select, METH_NOARGS, |
error: old chunk mismatch |
None
OLD | NEW |