GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
py-breakpoint.c File Reference
#include "defs.h"
#include "value.h"
#include "python-internal.h"
#include "python.h"
#include "charset.h"
#include "breakpoint.h"
#include "gdbcmd.h"
#include "gdbthread.h"
#include "observable.h"
#include "cli/cli-script.h"
#include "ada-lang.h"
#include "arch-utils.h"
#include "language.h"
#include "location.h"
#include "py-event.h"
#include "linespec.h"

Go to the source code of this file.

Classes

struct  gdbpy_breakpoint_location_object
 
struct  pybp_code
 

Macros

#define BPLOCPY_REQUIRE_VALID(Breakpoint, Location)
 
#define BPLOCPY_SET_REQUIRE_VALID(Breakpoint, Location)
 
#define pybp_debug_printf(fmt, ...)    debug_prefixed_printf_cond (pybp_debug, "py-breakpoint", fmt, ##__VA_ARGS__)
 
#define PYBP_SCOPED_DEBUG_ENTER_EXIT    scoped_debug_enter_exit (pybp_debug, "py-breakpoint")
 

Functions

PyTypeObject breakpoint_location_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("breakpoint_location_object")
 
static void show_pybp_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static PyObjectbppy_is_valid (PyObject *self, PyObject *args)
 
static PyObjectbppy_get_enabled (PyObject *self, void *closure)
 
static PyObjectbppy_get_silent (PyObject *self, void *closure)
 
static int bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
 
static int bppy_set_silent (PyObject *self, PyObject *newvalue, void *closure)
 
static int bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure)
 
static int bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
 
static PyObjectbppy_delete_breakpoint (PyObject *self, PyObject *args)
 
static int bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
 
static int bppy_set_hit_count (PyObject *self, PyObject *newvalue, void *closure)
 
static PyObjectbppy_get_location (PyObject *self, void *closure)
 
static PyObjectbppy_get_expression (PyObject *self, void *closure)
 
static PyObjectbppy_get_condition (PyObject *self, void *closure)
 
static int bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
 
static PyObjectbppy_get_commands (PyObject *self, void *closure)
 
static int bppy_set_commands (PyObject *self, PyObject *newvalue, void *closure)
 
static PyObjectbppy_get_type (PyObject *self, void *closure)
 
static PyObjectbppy_get_visibility (PyObject *self, void *closure)
 
static PyObjectbppy_get_temporary (PyObject *self, void *closure)
 
static PyObjectbppy_get_pending (PyObject *self, void *closure)
 
static PyObjectbppy_get_number (PyObject *self, void *closure)
 
static PyObjectbppy_get_thread (PyObject *self, void *closure)
 
static PyObjectbppy_get_task (PyObject *self, void *closure)
 
static PyObjectbppy_get_hit_count (PyObject *self, void *closure)
 
static PyObjectbppy_get_ignore_count (PyObject *self, void *closure)
 
static PyObjectbppy_get_locations (PyObject *self, void *closure)
 
static int bppy_init_validate_args (const char *spec, char *source, char *function, char *label, char *line, enum bptype type)
 
static int bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
 
static bool build_bp_list (struct breakpoint *b, PyObject *list)
 
bool gdbpy_breakpoint_init_breakpoint_type ()
 
PyObjectgdbpy_breakpoints (PyObject *self, PyObject *args)
 
enum ext_lang_bp_stop gdbpy_breakpoint_cond_says_stop (const struct extension_language_defn *extlang, struct breakpoint *b)
 
int gdbpy_breakpoint_has_cond (const struct extension_language_defn *extlang, struct breakpoint *b)
 
static void gdbpy_breakpoint_created (struct breakpoint *bp)
 
static void gdbpy_breakpoint_deleted (struct breakpoint *b)
 
static void gdbpy_breakpoint_modified (struct breakpoint *b)
 
int gdbpy_initialize_breakpoints (void)
 
int gdbpy_initialize_breakpoint_locations ()
 
static int local_setattro (PyObject *self, PyObject *name, PyObject *v)
 
void _initialize_py_breakpoint ()
 
static int bplocpy_set_enabled (PyObject *py_self, PyObject *newvalue, void *closure)
 
static PyObjectbplocpy_get_enabled (PyObject *py_self, void *closure)
 
static PyObjectbplocpy_get_address (PyObject *py_self, void *closure)
 
static PyObjectbplocpy_get_owner (PyObject *py_self, void *closure)
 
static PyObjectbplocpy_get_source_location (PyObject *py_self, void *closure)
 
static PyObjectbplocpy_get_function (PyObject *py_self, void *closure)
 
static PyObjectbplocpy_get_thread_groups (PyObject *py_self, void *closure)
 
static PyObjectbplocpy_get_fullname (PyObject *py_self, void *closure)
 
static void bplocpy_dealloc (PyObject *py_self)
 

Variables

static bool pybp_debug
 
static int bppy_live
 
gdbpy_breakpoint_objectbppy_pending_object
 
static const char stop_func [] = "stop"
 
static struct pybp_code pybp_codes []
 
static struct pybp_code pybp_watch_types []
 
static gdb_PyGetSetDef breakpoint_object_getset []
 
static PyMethodDef breakpoint_object_methods []
 
PyTypeObject breakpoint_object_type
 
static gdb_PyGetSetDef bp_location_object_getset []
 
PyTypeObject breakpoint_location_object_type
 

Macro Definition Documentation

◆ BPLOCPY_REQUIRE_VALID

#define BPLOCPY_REQUIRE_VALID (   Breakpoint,
  Location 
)
Value:
do { \
if ((Breakpoint)->bp != (Location)->bp_loc->owner) \
return PyErr_Format (PyExc_RuntimeError, \
_("Breakpoint location is invalid.")); \
} while (0)

Definition at line 53 of file py-breakpoint.c.

◆ BPLOCPY_SET_REQUIRE_VALID

#define BPLOCPY_SET_REQUIRE_VALID (   Breakpoint,
  Location 
)
Value:
do { \
if ((Breakpoint)->bp != (Location)->bp_loc->owner) \
{ \
PyErr_Format (PyExc_RuntimeError, \
_("Breakpoint location is invalid.")); \
return -1; \
} \
} while (0)

Definition at line 62 of file py-breakpoint.c.

◆ pybp_debug_printf

#define pybp_debug_printf (   fmt,
  ... 
)     debug_prefixed_printf_cond (pybp_debug, "py-breakpoint", fmt, ##__VA_ARGS__)

Definition at line 87 of file py-breakpoint.c.

◆ PYBP_SCOPED_DEBUG_ENTER_EXIT

#define PYBP_SCOPED_DEBUG_ENTER_EXIT    scoped_debug_enter_exit (pybp_debug, "py-breakpoint")

Definition at line 92 of file py-breakpoint.c.

Function Documentation

◆ _initialize_py_breakpoint()

void _initialize_py_breakpoint ( )

Definition at line 1424 of file py-breakpoint.c.

Referenced by initialize_all_files().

◆ bplocpy_dealloc()

static void bplocpy_dealloc ( PyObject py_self)
static

Definition at line 1599 of file py-breakpoint.c.

◆ bplocpy_get_address()

static PyObject * bplocpy_get_address ( PyObject py_self,
void *  closure 
)
static

◆ bplocpy_get_enabled()

static PyObject * bplocpy_get_enabled ( PyObject py_self,
void *  closure 
)
static

Definition at line 1476 of file py-breakpoint.c.

References BPLOCPY_REQUIRE_VALID, and BPPY_REQUIRE_VALID.

◆ bplocpy_get_fullname()

static PyObject * bplocpy_get_fullname ( PyObject py_self,
void *  closure 
)
static

◆ bplocpy_get_function()

static PyObject * bplocpy_get_function ( PyObject py_self,
void *  closure 
)
static

◆ bplocpy_get_owner()

static PyObject * bplocpy_get_owner ( PyObject py_self,
void *  closure 
)
static

Definition at line 1503 of file py-breakpoint.c.

References BPLOCPY_REQUIRE_VALID, and BPPY_REQUIRE_VALID.

◆ bplocpy_get_source_location()

static PyObject * bplocpy_get_source_location ( PyObject py_self,
void *  closure 
)
static

◆ bplocpy_get_thread_groups()

static PyObject * bplocpy_get_thread_groups ( PyObject py_self,
void *  closure 
)
static

◆ bplocpy_set_enabled()

static int bplocpy_set_enabled ( PyObject py_self,
PyObject newvalue,
void *  closure 
)
static

◆ bppy_delete_breakpoint()

static PyObject * bppy_delete_breakpoint ( PyObject self,
PyObject args 
)
static

◆ bppy_get_commands()

static PyObject * bppy_get_commands ( PyObject self,
void *  closure 
)
static

◆ bppy_get_condition()

static PyObject * bppy_get_condition ( PyObject self,
void *  closure 
)
static

◆ bppy_get_enabled()

static PyObject * bppy_get_enabled ( PyObject self,
void *  closure 
)
static

◆ bppy_get_expression()

static PyObject * bppy_get_expression ( PyObject self,
void *  closure 
)
static

◆ bppy_get_hit_count()

static PyObject * bppy_get_hit_count ( PyObject self,
void *  closure 
)
static

◆ bppy_get_ignore_count()

static PyObject * bppy_get_ignore_count ( PyObject self,
void *  closure 
)
static

◆ bppy_get_location()

static PyObject * bppy_get_location ( PyObject self,
void *  closure 
)
static

◆ bppy_get_locations()

static PyObject * bppy_get_locations ( PyObject self,
void *  closure 
)
static

Definition at line 731 of file py-breakpoint.c.

References BPPY_REQUIRE_VALID, breakpoint_location_object_type, and loc.

◆ bppy_get_number()

static PyObject * bppy_get_number ( PyObject self,
void *  closure 
)
static

◆ bppy_get_pending()

static PyObject * bppy_get_pending ( PyObject self,
void *  closure 
)
static

◆ bppy_get_silent()

static PyObject * bppy_get_silent ( PyObject self,
void *  closure 
)
static

◆ bppy_get_task()

static PyObject * bppy_get_task ( PyObject self,
void *  closure 
)
static

◆ bppy_get_temporary()

static PyObject * bppy_get_temporary ( PyObject self,
void *  closure 
)
static

◆ bppy_get_thread()

static PyObject * bppy_get_thread ( PyObject self,
void *  closure 
)
static

◆ bppy_get_type()

static PyObject * bppy_get_type ( PyObject self,
void *  closure 
)
static

◆ bppy_get_visibility()

static PyObject * bppy_get_visibility ( PyObject self,
void *  closure 
)
static

◆ bppy_init()

static int bppy_init ( PyObject self,
PyObject args,
PyObject kwargs 
)
static

◆ bppy_init_validate_args()

static int bppy_init_validate_args ( const char *  spec,
char *  source,
char *  function,
char *  label,
char *  line,
enum bptype  type 
)
static

Definition at line 764 of file py-breakpoint.c.

References bp_watchpoint.

Referenced by bppy_init().

◆ bppy_is_valid()

static PyObject * bppy_is_valid ( PyObject self,
PyObject args 
)
static

Definition at line 139 of file py-breakpoint.c.

References gdbpy_breakpoint_object::bp.

◆ bppy_set_commands()

static int bppy_set_commands ( PyObject self,
PyObject newvalue,
void *  closure 
)
static

◆ bppy_set_condition()

static int bppy_set_condition ( PyObject self,
PyObject newvalue,
void *  closure 
)
static

◆ bppy_set_enabled()

static int bppy_set_enabled ( PyObject self,
PyObject newvalue,
void *  closure 
)
static

◆ bppy_set_hit_count()

static int bppy_set_hit_count ( PyObject self,
PyObject newvalue,
void *  closure 
)
static

◆ bppy_set_ignore_count()

static int bppy_set_ignore_count ( PyObject self,
PyObject newvalue,
void *  closure 
)
static

◆ bppy_set_silent()

static int bppy_set_silent ( PyObject self,
PyObject newvalue,
void *  closure 
)
static

◆ bppy_set_task()

static int bppy_set_task ( PyObject self,
PyObject newvalue,
void *  closure 
)
static

◆ bppy_set_thread()

static int bppy_set_thread ( PyObject self,
PyObject newvalue,
void *  closure 
)
static

◆ build_bp_list()

static bool build_bp_list ( struct breakpoint b,
PyObject list 
)
static

Definition at line 976 of file py-breakpoint.c.

References bp, and breakpoint::py_bp_object.

Referenced by gdbpy_breakpoints().

◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF()

PyTypeObject breakpoint_location_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "breakpoint_location_object"  )

◆ gdbpy_breakpoint_cond_says_stop()

enum ext_lang_bp_stop gdbpy_breakpoint_cond_says_stop ( const struct extension_language_defn extlang,
struct breakpoint b 
)

◆ gdbpy_breakpoint_created()

static void gdbpy_breakpoint_created ( struct breakpoint bp)
static

◆ gdbpy_breakpoint_deleted()

static void gdbpy_breakpoint_deleted ( struct breakpoint b)
static

◆ gdbpy_breakpoint_has_cond()

int gdbpy_breakpoint_has_cond ( const struct extension_language_defn extlang,
struct breakpoint b 
)

Definition at line 1088 of file py-breakpoint.c.

References breakpoint::gdbarch, breakpoint::py_bp_object, and stop_func.

◆ gdbpy_breakpoint_init_breakpoint_type()

bool gdbpy_breakpoint_init_breakpoint_type ( )

◆ gdbpy_breakpoint_modified()

static void gdbpy_breakpoint_modified ( struct breakpoint b)
static

◆ gdbpy_breakpoints()

PyObject * gdbpy_breakpoints ( PyObject self,
PyObject args 
)

Definition at line 1013 of file py-breakpoint.c.

References all_breakpoints(), bp, bppy_live, and build_bp_list().

◆ gdbpy_initialize_breakpoint_locations()

int gdbpy_initialize_breakpoint_locations ( )

◆ gdbpy_initialize_breakpoints()

int gdbpy_initialize_breakpoints ( void  )

◆ local_setattro()

static int local_setattro ( PyObject self,
PyObject name,
PyObject v 
)
static

◆ show_pybp_debug()

static void show_pybp_debug ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 79 of file py-breakpoint.c.

References gdb_printf().

Variable Documentation

◆ bp_location_object_getset

gdb_PyGetSetDef bp_location_object_getset[]
static
Initial value:
= {
"Boolean telling whether the breakpoint is enabled.", NULL },
{ "owner", bplocpy_get_owner, NULL,
"Get the breakpoint owner object", NULL },
{ "address", bplocpy_get_address, NULL,
"Get address of where this location was set", NULL},
{ "source", bplocpy_get_source_location, NULL,
"Get file and line number of where this location was set", NULL},
{ "function", bplocpy_get_function, NULL,
"Get function of where this location was set", NULL },
{ "fullname", bplocpy_get_fullname, NULL,
"Get fullname of where this location was set", NULL },
{ "thread_groups", bplocpy_get_thread_groups, NULL,
"Get thread groups where this location is in", NULL },
{ NULL }
}
static int bplocpy_set_enabled(PyObject *py_self, PyObject *newvalue, void *closure)
static PyObject * bplocpy_get_owner(PyObject *py_self, void *closure)
static PyObject * bplocpy_get_source_location(PyObject *py_self, void *closure)
static PyObject * bplocpy_get_function(PyObject *py_self, void *closure)
static PyObject * bplocpy_get_thread_groups(PyObject *py_self, void *closure)
static PyObject * bplocpy_get_address(PyObject *py_self, void *closure)
static PyObject * bplocpy_get_enabled(PyObject *py_self, void *closure)
static PyObject * bplocpy_get_fullname(PyObject *py_self, void *closure)

Definition at line 1609 of file py-breakpoint.c.

◆ bppy_live

int bppy_live
static

◆ bppy_pending_object

gdbpy_breakpoint_object* bppy_pending_object

Definition at line 100 of file py-breakpoint.c.

Referenced by bpfinishpy_init(), bppy_init(), and gdbpy_breakpoint_created().

◆ breakpoint_location_object_type

PyTypeObject breakpoint_location_object_type

Definition at line 1627 of file py-breakpoint.c.

Referenced by bppy_get_locations(), and gdbpy_initialize_breakpoint_locations().

◆ breakpoint_object_getset

gdb_PyGetSetDef breakpoint_object_getset[]
static

Definition at line 1326 of file py-breakpoint.c.

◆ breakpoint_object_methods

PyMethodDef breakpoint_object_methods[]
static
Initial value:
=
{
{ "is_valid", bppy_is_valid, METH_NOARGS,
"Return true if this breakpoint is valid, false if not." },
{ "delete", bppy_delete_breakpoint, METH_NOARGS,
"Delete the underlying GDB breakpoint." },
{ NULL }
}
static PyObject * bppy_delete_breakpoint(PyObject *self, PyObject *args)
static PyObject * bppy_is_valid(PyObject *self, PyObject *args)

Definition at line 1372 of file py-breakpoint.c.

◆ breakpoint_object_type

PyTypeObject breakpoint_object_type

◆ pybp_codes

struct pybp_code pybp_codes[]
static
Initial value:
=
{
{ "BP_NONE", bp_none},
{ "BP_BREAKPOINT", bp_breakpoint},
{ "BP_HARDWARE_BREAKPOINT", bp_hardware_breakpoint},
{ "BP_WATCHPOINT", bp_watchpoint},
{ "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint},
{ "BP_READ_WATCHPOINT", bp_read_watchpoint},
{ "BP_ACCESS_WATCHPOINT", bp_access_watchpoint},
{ "BP_CATCHPOINT", bp_catchpoint},
{NULL}
}
@ bp_breakpoint
Definition breakpoint.h:86
@ bp_watchpoint
Definition breakpoint.h:91
@ bp_hardware_breakpoint
Definition breakpoint.h:87
@ bp_read_watchpoint
Definition breakpoint.h:93
@ bp_catchpoint
Definition breakpoint.h:182
@ bp_access_watchpoint
Definition breakpoint.h:94
@ bp_none
Definition breakpoint.h:85
@ bp_hardware_watchpoint
Definition breakpoint.h:92

Definition at line 115 of file py-breakpoint.c.

Referenced by gdbpy_initialize_breakpoints().

◆ pybp_debug

bool pybp_debug
static

Definition at line 74 of file py-breakpoint.c.

◆ pybp_watch_types

struct pybp_code pybp_watch_types[]
static
Initial value:
=
{
{ "WP_READ", hw_read},
{ "WP_WRITE", hw_write},
{ "WP_ACCESS", hw_access},
{NULL}
}

Definition at line 129 of file py-breakpoint.c.

Referenced by gdbpy_initialize_breakpoints().

◆ stop_func

const char stop_func[] = "stop"
static