51 #define FRAPY_REQUIRE_VALID(frame_obj, frame) \ 53 frame = frame_object_to_frame_info (frame_obj); \ 55 error (_("Frame is invalid.")); \ 87 return PyString_FromString (strfile.
c_str ());
140 result = PyUnicode_Decode (
name.get (), strlen (
name.get ()),
173 return PyInt_FromLong (
type);
252 const char *regnum_str;
253 struct value *val = NULL;
255 if (!PyArg_ParseTuple (args,
"s", ®num_str))
267 strlen (regnum_str));
272 PyErr_SetString (PyExc_ValueError,
_(
"Unknown register."));
303 for (fn_block =
block;
310 PyErr_SetString (PyExc_RuntimeError,
311 _(
"Cannot locate block for frame."));
331 struct symbol *sym = NULL;
363 if (frame_obj == NULL)
377 frame_obj->frame_id_is_next = 1;
382 frame_obj->frame_id_is_next = 0;
393 return (PyObject *) frame_obj.
release ();
404 PyObject *prev_obj = NULL;
437 PyObject *next_obj = NULL;
469 PyObject *sal_obj = NULL;
498 PyObject *sym_obj, *block_obj = NULL;
499 struct symbol *var = NULL;
501 struct value *val = NULL;
503 if (!PyArg_ParseTuple (args,
"O|O", &sym_obj, &block_obj))
521 PyErr_SetString (PyExc_RuntimeError,
522 _(
"Second argument must be block."));
547 PyErr_Format (PyExc_ValueError,
548 _(
"Variable '%s' not found."), var_name.get ());
555 PyErr_SetString (PyExc_TypeError,
556 _(
"Argument must be a symbol or string."));
648 if (!PyArg_ParseTuple (args,
"i", &reason))
651 if (reason < UNWIND_FIRST || reason > UNWIND_LAST)
653 PyErr_SetString (PyExc_ValueError,
654 _(
"Invalid frame stop reason."));
659 return PyUnicode_Decode (str, strlen (str),
host_charset (), NULL);
672 || (op != Py_EQ && op != Py_NE))
674 Py_INCREF (Py_NotImplemented);
675 return Py_NotImplemented;
704 || PyModule_AddIntConstant (
gdb_module,
"TAILCALL_FRAME",
706 || PyModule_AddIntConstant (
gdb_module,
"SIGTRAMP_FRAME",
709 || PyModule_AddIntConstant (
gdb_module,
"SENTINEL_FRAME",
713 #define SET(name, description) \ 714 if (PyModule_AddIntConstant (gdb_module, "FRAME_"#name, name) < 0) \ 716 #include "unwind_stop_reasons.def" 727 "is_valid () -> Boolean.\n\ 728 Return true if this frame is valid, false if not." },
730 "name () -> String.\n\ 731 Return the function name of the frame, or None if it can't be determined." },
733 "type () -> Integer.\n\ 734 Return the type of the frame." },
736 "architecture () -> gdb.Architecture.\n\ 737 Return the architecture of the frame." },
739 "unwind_stop_reason () -> Integer.\n\ 740 Return the reason why it's not possible to find frames older than this." },
743 Return the frame's resume address." },
745 "read_register (register_name) -> gdb.Value\n\ 746 Return the value of the register in the frame." },
748 "block () -> gdb.Block.\n\ 749 Return the frame's code block." },
751 "function () -> gdb.Symbol.\n\ 752 Returns the symbol for the function corresponding to this frame." },
754 "older () -> gdb.Frame.\n\ 755 Return the frame that called this frame." },
757 "newer () -> gdb.Frame.\n\ 758 Return the frame called by this frame." },
760 "find_sal () -> gdb.Symtab_and_line.\n\ 761 Return the frame's symtab and line." },
763 "read_var (variable) -> gdb.Value.\n\ 764 Return the value of the variable in this frame." },
766 "Select this frame as the user's current frame." },
static PyObject * frapy_arch(PyObject *self, PyObject *args)
struct frame_info * frame_find_by_id(struct frame_id id)
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
PyObject * gdbpy_selected_frame(PyObject *self, PyObject *args)
struct frame_info * get_selected_frame(const char *message)
PyObject * block_to_block_object(const struct block *block, struct objfile *objfile)
CORE_ADDR get_frame_pc(struct frame_info *frame)
PyObject * symtab_and_line_to_sal_object(struct symtab_and_line sal)
struct frame_info * get_current_frame(void)
static PyObject * frapy_read_register(PyObject *self, PyObject *args)
struct frame_info * get_prev_frame(struct frame_info *this_frame)
int gdbpy_is_string(PyObject *obj)
static PyObject * frapy_newer(PyObject *self, PyObject *args)
static PyObject * frapy_unwind_stop_reason(PyObject *self, PyObject *args)
void select_frame(struct frame_info *fi)
static PyObject * frapy_older(PyObject *self, PyObject *args)
int gdbpy_initialize_frames(void)
static PyObject * frapy_block(PyObject *self, PyObject *args)
static PyObject * frapy_find_sal(PyObject *self, PyObject *args)
PyObject * frame_info_to_frame_object(struct frame_info *frame)
#define gdb_py_long_from_ulongest
static PyObject * frapy_read_var(PyObject *self, PyObject *args)
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
struct symbol * symbol_object_to_symbol(PyObject *obj)
#define PyVarObject_HEAD_INIT(type, size)
static PyObject * frapy_is_valid(PyObject *self, PyObject *args)
PyTypeObject frame_object_type
struct objfile * symbol_objfile(const struct symbol *symbol)
#define BLOCK_FUNCTION(bl)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
PyTypeObject symbol_object_type
PyObject * gdbarch_to_arch_object(struct gdbarch *gdbarch)
PyObject * gdbpy_frame_stop_reason_string(PyObject *self, PyObject *args)
int frame_id_eq(struct frame_id l, struct frame_id r)
const char * unwind_stop_reason_to_string(enum unwind_stop_reason reason)
#define FRAPY_REQUIRE_VALID(frame_obj, frame)
enum frame_type get_frame_type(struct frame_info *frame)
static PyObject * frapy_str(PyObject *self)
struct frame_id get_frame_id(struct frame_info *fi)
#define CATCH(EXCEPTION, MASK)
std::unique_ptr< T, xfree_deleter< T > > unique_xmalloc_ptr
enum unwind_stop_reason get_frame_unwind_stop_reason(struct frame_info *frame)
struct value * read_var_value(struct symbol *var, const struct block *var_block, struct frame_info *frame)
const struct block * block
const struct block * get_frame_block(struct frame_info *frame, CORE_ADDR *addr_in_block)
static PyObject * frapy_select(PyObject *self, PyObject *args)
PyObject * gdbpy_newest_frame(PyObject *self, PyObject *args)
static PyMethodDef frame_object_methods[]
const struct block * block_object_to_block(PyObject *obj)
#define BLOCK_SUPERBLOCK(bl)
PyObject * value_to_value_object(struct value *val)
PyObject_HEAD struct frame_id frame_id
static PyObject * frapy_type(PyObject *self, PyObject *args)
int user_reg_map_name_to_regnum(struct gdbarch *gdbarch, const char *name, int len)
symtab_and_line find_frame_sal(frame_info *frame)
struct frame_info * get_next_frame(struct frame_info *this_frame)
enum unwind_stop_reason stop_reason
void gdbpy_convert_exception(struct gdb_exception exception)
struct value * value_of_register(int regnum, struct frame_info *frame)
static PyObject * frapy_name(PyObject *self, PyObject *args)
const char * c_str() const
gdb::unique_xmalloc_ptr< char > find_frame_funname(struct frame_info *frame, enum language *funlang, struct symbol **funcp)
void fprint_frame_id(struct ui_file *file, struct frame_id id)
static PyObject * frapy_richcompare(PyObject *self, PyObject *other, int op)
gdb::unique_xmalloc_ptr< char > python_string_to_target_string(PyObject *obj)
const char * host_charset(void)
PyObject * symbol_to_symbol_object(struct symbol *sym)
struct frame_info * frame_object_to_frame_info(PyObject *obj)
static PyObject * frapy_function(PyObject *self, PyObject *args)
static PyObject * frapy_pc(PyObject *self, PyObject *args)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)