49#define FRAPY_REQUIRE_VALID(frame_obj, frame) \
51 frame = frame_object_to_frame_info (frame_obj); \
53 error (_("Frame is invalid.")); \
83 return PyUnicode_FromString (fid.
to_string ().c_str ());
99 catch (
const gdb_exception &except)
117 gdb::unique_xmalloc_ptr<char>
name;
127 catch (
const gdb_exception &except)
134 result = PyUnicode_Decode (
name.get (), strlen (
name.get ()),
161 catch (
const gdb_exception &except)
182 catch (
const gdb_exception &except)
203 catch (
const gdb_exception &except)
228 catch (
const gdb_exception &except)
242 PyObject *pyo_reg_id;
243 struct value *val = NULL;
245 if (!PyArg_UnpackTuple (args,
"read_register", 1, 1, &pyo_reg_id))
262 PyErr_SetString (PyExc_ValueError, _(
"Can't read register."));
264 catch (
const gdb_exception &except)
286 catch (
const gdb_exception &except)
291 for (fn_block =
block;
292 fn_block != NULL && fn_block->
function () == NULL;
293 fn_block = fn_block->superblock ())
296 if (
block == NULL || fn_block == NULL || fn_block->
function () == NULL)
298 PyErr_SetString (PyExc_RuntimeError,
299 _(
"Cannot locate block for frame."));
319 struct symbol *sym = NULL;
328 gdb::unique_xmalloc_ptr<char> funname
331 catch (
const gdb_exception &except)
350 if (frame_obj == NULL)
364 frame_obj->frame_id_is_next = 1;
369 frame_obj->frame_id_is_next = 0;
373 catch (
const gdb_exception &except)
379 return (PyObject *) frame_obj.release ();
390 PyObject *prev_obj = NULL;
398 catch (
const gdb_exception &except)
422 PyObject *next_obj = NULL;
430 catch (
const gdb_exception &except)
453 PyObject *sal_obj = NULL;
462 catch (
const gdb_exception &except)
481 PyObject *sym_obj, *block_obj = NULL;
482 struct symbol *var = NULL;
484 struct value *val = NULL;
486 if (!PyArg_ParseTuple (args,
"O|O", &sym_obj, &block_obj))
493 gdb::unique_xmalloc_ptr<char>
504 PyErr_SetString (PyExc_RuntimeError,
505 _(
"Second argument must be block."));
521 catch (
const gdb_exception &except)
529 PyErr_Format (PyExc_ValueError,
530 _(
"Variable '%s' not found."), var_name.get ());
537 PyErr_SetString (PyExc_TypeError,
538 _(
"Argument must be a symbol or string."));
548 catch (
const gdb_exception &except)
569 catch (
const gdb_exception &except)
590 catch (
const gdb_exception &except)
613 catch (
const gdb_exception &except)
633 catch (
const gdb_exception &except)
653 catch (
const gdb_exception &except)
670 if (!PyArg_ParseTuple (args,
"i", &reason))
673 if (reason < UNWIND_FIRST || reason > UNWIND_LAST)
675 PyErr_SetString (PyExc_ValueError,
676 _(
"Invalid frame stop reason."));
681 return PyUnicode_Decode (str, strlen (str),
host_charset (), NULL);
694 || (op != Py_EQ && op != Py_NE))
696 Py_INCREF (Py_NotImplemented);
697 return Py_NotImplemented;
729 || PyModule_AddIntConstant (
gdb_module,
"TAILCALL_FRAME",
731 || PyModule_AddIntConstant (
gdb_module,
"SIGTRAMP_FRAME",
734 || PyModule_AddIntConstant (
gdb_module,
"SENTINEL_FRAME",
738#define SET(name, description) \
739 if (PyModule_AddIntConstant (gdb_module, "FRAME_"#name, name) < 0) \
741#include "unwind_stop_reasons.def"
752 "is_valid () -> Boolean.\n\
753Return true if this frame is valid, false if not." },
755 "name () -> String.\n\
756Return the function name of the frame, or None if it can't be determined." },
758 "type () -> Integer.\n\
759Return the type of the frame." },
761 "architecture () -> gdb.Architecture.\n\
762Return the architecture of the frame." },
764 "unwind_stop_reason () -> Integer.\n\
765Return the reason why it's not possible to find frames older than this." },
768Return the frame's resume address." },
770 "read_register (register_name) -> gdb.Value\n\
771Return the value of the register in the frame." },
773 "block () -> gdb.Block.\n\
774Return the frame's code block." },
776 "function () -> gdb.Symbol.\n\
777Returns the symbol for the function corresponding to this frame." },
779 "older () -> gdb.Frame.\n\
780Return the frame that called this frame." },
782 "newer () -> gdb.Frame.\n\
783Return the frame called by this frame." },
785 "find_sal () -> gdb.Symtab_and_line.\n\
786Return the frame's symtab and line." },
788 "read_var (variable) -> gdb.Value.\n\
789Return the value of the variable in this frame." },
791 "Select this frame as the user's current frame." },
793 "The stack level of this frame." },
795 "The language of this frame." },
800 PyVarObject_HEAD_INIT (NULL, 0)
const struct block * get_frame_block(frame_info_ptr frame, CORE_ADDR *addr_in_block)
const char * host_charset(void)
struct value * value_of_register(int regnum, frame_info_ptr frame)
struct value * read_var_value(struct symbol *var, const struct block *var_block, frame_info_ptr frame)
frame_info_ptr get_next_frame(frame_info_ptr this_frame)
enum unwind_stop_reason get_frame_unwind_stop_reason(frame_info_ptr frame)
int frame_relative_level(frame_info_ptr fi)
void select_frame(frame_info_ptr fi)
CORE_ADDR get_frame_pc(frame_info_ptr frame)
const char * unwind_stop_reason_to_string(enum unwind_stop_reason reason)
struct gdbarch * get_frame_arch(frame_info_ptr this_frame)
enum frame_type get_frame_type(frame_info_ptr frame)
frame_info_ptr get_selected_frame(const char *message)
frame_info_ptr frame_find_by_id(struct frame_id id)
enum language get_frame_language(frame_info_ptr frame)
frame_info_ptr get_current_frame(void)
struct frame_id get_frame_id(frame_info_ptr fi)
frame_info_ptr get_prev_frame(frame_info_ptr this_frame)
symtab_and_line find_frame_sal(frame_info_ptr frame)
const struct language_defn * language_def(enum language lang)
PyObject * gdbarch_to_arch_object(struct gdbarch *gdbarch)
PyObject * block_to_block_object(const struct block *block, struct objfile *objfile)
const struct block * block_object_to_block(PyObject *obj)
static PyObject * frapy_read_register(PyObject *self, PyObject *args)
static PyObject * frapy_str(PyObject *self)
PyObject * gdbpy_frame_stop_reason_string(PyObject *self, PyObject *args)
static PyObject * frapy_older(PyObject *self, PyObject *args)
static PyObject * frapy_is_valid(PyObject *self, PyObject *args)
static PyObject * frapy_arch(PyObject *self, PyObject *args)
static PyObject * frapy_language(PyObject *self, PyObject *args)
#define FRAPY_REQUIRE_VALID(frame_obj, frame)
int gdbpy_initialize_frames(void)
PyObject * frame_info_to_frame_object(frame_info_ptr frame)
static PyObject * frapy_richcompare(PyObject *self, PyObject *other, int op)
static PyObject * frapy_pc(PyObject *self, PyObject *args)
static PyObject * frapy_block(PyObject *self, PyObject *args)
static PyObject * frapy_find_sal(PyObject *self, PyObject *args)
PyObject * gdbpy_selected_frame(PyObject *self, PyObject *args)
static PyObject * frapy_name(PyObject *self, PyObject *args)
static PyObject * frapy_level(PyObject *self, PyObject *args)
PyObject * gdbpy_newest_frame(PyObject *self, PyObject *args)
PyTypeObject frame_object_type
static PyObject * frapy_unwind_stop_reason(PyObject *self, PyObject *args)
static PyObject * frapy_type(PyObject *self, PyObject *args)
static PyObject * frapy_function(PyObject *self, PyObject *args)
frame_info_ptr frame_object_to_frame_info(PyObject *obj)
static PyObject * frapy_read_var(PyObject *self, PyObject *args)
static PyObject * frapy_newer(PyObject *self, PyObject *args)
static PyMethodDef frame_object_methods[]
static PyObject * frapy_select(PyObject *self, PyObject *args)
gdb::ref_ptr< T, gdbpy_ref_policy< T > > gdbpy_ref
bool gdbpy_parse_register_id(struct gdbarch *gdbarch, PyObject *pyo_reg_id, int *reg_num)
struct symbol * symbol_object_to_symbol(PyObject *obj)
PyObject * symbol_to_symbol_object(struct symbol *sym)
PyTypeObject symbol_object_type
PyObject * symtab_and_line_to_sal_object(struct symtab_and_line sal)
gdbpy_ref host_string_to_python_string(const char *str)
gdb::unique_xmalloc_ptr< char > python_string_to_target_string(PyObject *obj)
gdbpy_ref gdb_py_object_from_longest(LONGEST l)
void gdbpy_convert_exception(const struct gdb_exception &exception)
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
int gdbpy_is_string(PyObject *obj)
gdbpy_ref gdb_py_object_from_ulongest(ULONGEST l)
PyObject * value_to_value_object(struct value *val)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
gdb::unique_xmalloc_ptr< char > find_frame_funname(frame_info_ptr frame, enum language *funlang, struct symbol **funcp)
const struct block * block
symbol * function() const
std::string to_string() const
PyObject_HEAD struct frame_id frame_id
virtual const char * name() const =0
struct objfile * objfile() const
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)