GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions | Variables
py-inferior.c File Reference
#include "defs.h"
#include "auto-load.h"
#include "gdbcore.h"
#include "gdbthread.h"
#include "inferior.h"
#include "objfiles.h"
#include "observable.h"
#include "python-internal.h"
#include "arch-utils.h"
#include "language.h"
#include "gdbsupport/gdb_signals.h"
#include "py-event.h"
#include "py-stopevent.h"
#include "progspace-and-thread.h"
#include <unordered_map>

Go to the source code of this file.

Classes

struct  inferior_object
 
struct  infpy_deleter
 

Macros

#define INFPY_REQUIRE_VALID(Inferior)
 

Typedefs

using thread_map_t = std::unordered_map<thread_info *, gdbpy_ref<thread_object>>
 

Functions

PyTypeObject inferior_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("inferior_object")
 
static void python_on_normal_stop (struct bpstat *bs, int print_frame)
 
static void python_on_resume (ptid_t ptid)
 
static void python_on_inferior_call_pre (ptid_t thread, CORE_ADDR address)
 
static void python_on_inferior_call_post (ptid_t thread, CORE_ADDR address)
 
static void python_on_memory_change (struct inferior *inferior, CORE_ADDR addr, ssize_t len, const bfd_byte *data)
 
static void python_on_register_change (frame_info_ptr frame, int regnum)
 
static void python_inferior_exit (struct inferior *inf)
 
static void python_new_objfile (struct objfile *objfile)
 
static void python_all_objfiles_removed (program_space *pspace)
 
static void python_free_objfile (struct objfile *objfile)
 
gdbpy_ref< inferior_objectinferior_to_inferior_object (struct inferior *inferior)
 
static void python_new_inferior (struct inferior *inf)
 
static void python_inferior_deleted (struct inferior *inf)
 
gdbpy_ref thread_to_thread_object (thread_info *thr)
 
static void add_thread_object (struct thread_info *tp)
 
static void delete_thread_object (thread_info *tp, gdb::optional< ULONGEST >, bool)
 
static PyObjectinfpy_threads (PyObject *self, PyObject *args)
 
static PyObjectinfpy_get_num (PyObject *self, void *closure)
 
static PyObjectinfpy_get_connection (PyObject *self, void *closure)
 
static PyObjectinfpy_get_connection_num (PyObject *self, void *closure)
 
static PyObjectinfpy_get_pid (PyObject *self, void *closure)
 
static PyObjectinfpy_get_was_attached (PyObject *self, void *closure)
 
static PyObjectinfpy_get_progspace (PyObject *self, void *closure)
 
PyObjectgdbpy_inferiors (PyObject *unused, PyObject *unused2)
 
static PyObjectinfpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
 
static PyObjectinfpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
 
static PyObjectinfpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
 
static PyObjectinfpy_is_valid (PyObject *self, PyObject *args)
 
static PyObjectinfpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
 
static PyObjectinfpy_architecture (PyObject *self, PyObject *args)
 
static PyObjectinfpy_repr (PyObject *obj)
 
static PyObjectinfpy_clear_env (PyObject *obj)
 
static PyObjectinfpy_set_env (PyObject *obj, PyObject *args, PyObject *kw)
 
static PyObjectinfpy_unset_env (PyObject *obj, PyObject *args, PyObject *kw)
 
static PyObjectinfpy_get_args (PyObject *self, void *closure)
 
static int infpy_set_args (PyObject *self, PyObject *value, void *closure)
 
static PyObjectinfpy_get_main_name (PyObject *self, void *closure)
 
static void infpy_dealloc (PyObject *obj)
 
PyObjectgdbpy_selected_inferior (PyObject *self, PyObject *args)
 
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_inferior (void)
 
 GDBPY_INITIALIZE_FILE (gdbpy_initialize_inferior)
 

Variables

static const registry< inferior >::key< inferior_object, infpy_deleterinfpy_inf_data_key
 
static gdb_PyGetSetDef inferior_object_getset []
 
static PyMethodDef inferior_object_methods []
 
PyTypeObject inferior_object_type
 

Macro Definition Documentation

◆ INFPY_REQUIRE_VALID

#define INFPY_REQUIRE_VALID ( Inferior)

Typedef Documentation

◆ thread_map_t

using thread_map_t = std::unordered_map<thread_info *, gdbpy_ref<thread_object>>

Definition at line 36 of file py-inferior.c.

Function Documentation

◆ add_thread_object()

static void add_thread_object ( struct thread_info * tp)
static

◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF()

PyTypeObject inferior_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "inferior_object" )
extern

◆ delete_thread_object()

static void delete_thread_object ( thread_info * tp,
gdb::optional< ULONGEST > ,
bool  )
static

◆ gdbpy_inferiors()

PyObject * gdbpy_inferiors ( PyObject * unused,
PyObject * unused2 )

Definition at line 506 of file py-inferior.c.

References all_inferiors(), and inferior_to_inferior_object().

◆ GDBPY_INITIALIZE_FILE()

GDBPY_INITIALIZE_FILE ( gdbpy_initialize_inferior )

◆ gdbpy_initialize_inferior()

static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_inferior ( void )
static

◆ gdbpy_selected_inferior()

PyObject * gdbpy_selected_inferior ( PyObject * self,
PyObject * args )

Definition at line 990 of file py-inferior.c.

References current_inferior(), and inferior_to_inferior_object().

◆ inferior_to_inferior_object()

gdbpy_ref< inferior_object > inferior_to_inferior_object ( struct inferior * inferior)

◆ infpy_architecture()

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

Definition at line 784 of file py-inferior.c.

References gdbarch_to_arch_object(), and INFPY_REQUIRE_VALID.

◆ infpy_clear_env()

static PyObject * infpy_clear_env ( PyObject * obj)
static

◆ infpy_dealloc()

static void infpy_dealloc ( PyObject * obj)
static

Definition at line 966 of file py-inferior.c.

References inferior_object::inferior.

◆ infpy_get_args()

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

Definition at line 860 of file py-inferior.c.

References host_string_to_python_string(), and INFPY_REQUIRE_VALID.

◆ infpy_get_connection()

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

Definition at line 440 of file py-inferior.c.

References INFPY_REQUIRE_VALID, and target_to_connection_object().

◆ infpy_get_connection_num()

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

◆ infpy_get_main_name()

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

Definition at line 935 of file py-inferior.c.

References host_string_to_python_string(), INFPY_REQUIRE_VALID, main_name(), and name.

◆ infpy_get_num()

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

Definition at line 427 of file py-inferior.c.

References gdb_py_object_from_longest(), and INFPY_REQUIRE_VALID.

◆ infpy_get_pid()

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

Definition at line 468 of file py-inferior.c.

References gdb_py_object_from_longest(), INFPY_REQUIRE_VALID, and inf::pid.

◆ infpy_get_progspace()

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

Definition at line 491 of file py-inferior.c.

References INFPY_REQUIRE_VALID, and pspace_to_pspace_object().

◆ infpy_get_was_attached()

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

Definition at line 478 of file py-inferior.c.

References INFPY_REQUIRE_VALID.

◆ infpy_is_valid()

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

Definition at line 712 of file py-inferior.c.

◆ infpy_read_memory()

static PyObject * infpy_read_memory ( PyObject * self,
PyObject * args,
PyObject * kw )
static

◆ infpy_repr()

static PyObject * infpy_repr ( PyObject * obj)
static

Definition at line 796 of file py-inferior.c.

References inferior_object::inferior, and inf::pid.

◆ infpy_search_memory()

static PyObject * infpy_search_memory ( PyObject * self,
PyObject * args,
PyObject * kw )
static

◆ infpy_set_args()

static int infpy_set_args ( PyObject * self,
PyObject * value,
void * closure )
static

Definition at line 876 of file py-inferior.c.

References gdbpy_is_string(), and python_string_to_host_string().

◆ infpy_set_env()

static PyObject * infpy_set_env ( PyObject * obj,
PyObject * args,
PyObject * kw )
static

◆ infpy_thread_from_thread_handle()

static PyObject * infpy_thread_from_thread_handle ( PyObject * self,
PyObject * args,
PyObject * kw )
static

◆ infpy_threads()

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

◆ infpy_unset_env()

static PyObject * infpy_unset_env ( PyObject * obj,
PyObject * args,
PyObject * kw )
static

◆ infpy_write_memory()

static PyObject * infpy_write_memory ( PyObject * self,
PyObject * args,
PyObject * kw )
static

◆ python_all_objfiles_removed()

static void python_all_objfiles_removed ( program_space * pspace)
static

◆ python_free_objfile()

static void python_free_objfile ( struct objfile * objfile)
static

◆ python_inferior_deleted()

static void python_inferior_deleted ( struct inferior * inf)
static

◆ python_inferior_exit()

static void python_inferior_exit ( struct inferior * inf)
static

◆ python_new_inferior()

static void python_new_inferior ( struct inferior * inf)
static

◆ python_new_objfile()

static void python_new_objfile ( struct objfile * objfile)
static

◆ python_on_inferior_call_post()

static void python_on_inferior_call_post ( ptid_t thread,
CORE_ADDR address )
static

◆ python_on_inferior_call_pre()

static void python_on_inferior_call_pre ( ptid_t thread,
CORE_ADDR address )
static

◆ python_on_memory_change()

static void python_on_memory_change ( struct inferior * inferior,
CORE_ADDR addr,
ssize_t len,
const bfd_byte * data )
static

◆ python_on_normal_stop()

static void python_on_normal_stop ( struct bpstat * bs,
int print_frame )
static

◆ python_on_register_change()

static void python_on_register_change ( frame_info_ptr frame,
int regnum )
static

◆ python_on_resume()

static void python_on_resume ( ptid_t ptid)
static

◆ thread_to_thread_object()

gdbpy_ref thread_to_thread_object ( thread_info * thr)

Variable Documentation

◆ inferior_object_getset

gdb_PyGetSetDef inferior_object_getset[]
static
Initial value:
=
{
{ "arguments", infpy_get_args, infpy_set_args,
"Arguments to this program.", nullptr },
{ "num", infpy_get_num, NULL, "ID of inferior, as assigned by GDB.", NULL },
{ "connection", infpy_get_connection, NULL,
"The gdb.TargetConnection for this inferior.", NULL },
{ "connection_num", infpy_get_connection_num, NULL,
"ID of inferior's connection, as assigned by GDB.", NULL },
{ "pid", infpy_get_pid, NULL, "PID of inferior, as assigned by the OS.",
NULL },
{ "was_attached", infpy_get_was_attached, NULL,
"True if the inferior was created using 'attach'.", NULL },
{ "progspace", infpy_get_progspace, NULL, "Program space of this inferior" },
{ "main_name", infpy_get_main_name, nullptr,
"Name of 'main' function, if known.", nullptr },
{ NULL }
}
static PyObject * infpy_get_was_attached(PyObject *self, void *closure)
static int infpy_set_args(PyObject *self, PyObject *value, void *closure)
static PyObject * infpy_get_num(PyObject *self, void *closure)
static PyObject * infpy_get_progspace(PyObject *self, void *closure)
static PyObject * infpy_get_pid(PyObject *self, void *closure)
static PyObject * infpy_get_main_name(PyObject *self, void *closure)
static PyObject * infpy_get_args(PyObject *self, void *closure)
static PyObject * infpy_get_connection_num(PyObject *self, void *closure)
static PyObject * infpy_get_connection(PyObject *self, void *closure)

Definition at line 1038 of file py-inferior.c.

◆ inferior_object_methods

PyMethodDef inferior_object_methods[]
static

Definition at line 1057 of file py-inferior.c.

◆ inferior_object_type

PyTypeObject inferior_object_type

Definition at line 1101 of file py-inferior.c.

Referenced by gdbpy_initialize_inferior(), and inferior_to_inferior_object().

◆ infpy_inf_data_key

const registry<inferior>::key<inferior_object, infpy_deleter> infpy_inf_data_key
static

Definition at line 71 of file py-inferior.c.

Referenced by inferior_to_inferior_object().