aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-finishbreakpoint.c2
-rw-r--r--gdb/python/py-inferior.c14
-rw-r--r--gdb/python/py-objfile.c5
-rw-r--r--gdb/python/py-progspace.c5
-rw-r--r--gdb/python/py-record-btrace.c2
-rw-r--r--gdb/python/python.c2
6 files changed, 16 insertions, 14 deletions
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 42a7e07..627eb29 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -427,7 +427,7 @@ bpfinishpy_handle_stop (struct bpstat *bs, int print_frame)
static void
bpfinishpy_handle_exit (struct inferior *inf)
{
- gdbpy_enter enter_py (target_gdbarch ());
+ gdbpy_enter enter_py (current_inferior ()->arch ());
for (breakpoint &bp : all_breakpoints_safe ())
bpfinishpy_detect_out_scope_cb (&bp, nullptr, true);
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 50d20c3..c0bd6a6 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -107,7 +107,7 @@ python_on_resume (ptid_t ptid)
if (!gdb_python_initialized)
return;
- gdbpy_enter enter_py (target_gdbarch ());
+ gdbpy_enter enter_py (current_inferior ()->arch ());
if (emit_continue_event (ptid) < 0)
gdbpy_print_stack ();
@@ -119,7 +119,7 @@ python_on_resume (ptid_t ptid)
static void
python_on_inferior_call_pre (ptid_t thread, CORE_ADDR address)
{
- gdbpy_enter enter_py (target_gdbarch ());
+ gdbpy_enter enter_py (current_inferior ()->arch ());
if (emit_inferior_call_event (INFERIOR_CALL_PRE, thread, address) < 0)
gdbpy_print_stack ();
@@ -131,7 +131,7 @@ python_on_inferior_call_pre (ptid_t thread, CORE_ADDR address)
static void
python_on_inferior_call_post (ptid_t thread, CORE_ADDR address)
{
- gdbpy_enter enter_py (target_gdbarch ());
+ gdbpy_enter enter_py (current_inferior ()->arch ());
if (emit_inferior_call_event (INFERIOR_CALL_POST, thread, address) < 0)
gdbpy_print_stack ();
@@ -144,7 +144,7 @@ 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)
{
- gdbpy_enter enter_py (target_gdbarch ());
+ gdbpy_enter enter_py (current_inferior ()->arch ());
if (emit_memory_changed_event (addr, len) < 0)
gdbpy_print_stack ();
@@ -157,7 +157,7 @@ python_on_memory_change (struct inferior *inferior, CORE_ADDR addr, ssize_t len,
static void
python_on_register_change (frame_info_ptr frame, int regnum)
{
- gdbpy_enter enter_py (target_gdbarch ());
+ gdbpy_enter enter_py (current_inferior ()->arch ());
if (emit_register_changed_event (frame, regnum) < 0)
gdbpy_print_stack ();
@@ -171,7 +171,7 @@ python_inferior_exit (struct inferior *inf)
if (!gdb_python_initialized)
return;
- gdbpy_enter enter_py (target_gdbarch ());
+ gdbpy_enter enter_py (current_inferior ()->arch ());
if (inf->has_exit_code)
exit_code = &inf->exit_code;
@@ -202,7 +202,7 @@ python_all_objfiles_removed (program_space *pspace)
if (!gdb_python_initialized)
return;
- gdbpy_enter enter_py (target_gdbarch ());
+ gdbpy_enter enter_py (current_inferior ()->arch ());
if (emit_clear_objfiles_event (pspace) < 0)
gdbpy_print_stack ();
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index ad72f3f..bb5d0d9 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -25,6 +25,7 @@
#include "build-id.h"
#include "symtab.h"
#include "python.h"
+#include "inferior.h"
struct objfile_object
{
@@ -618,7 +619,7 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
struct objfile *objfile = nullptr;
if (by_build_id)
gdbarch_iterate_over_objfiles_in_search_order
- (target_gdbarch (),
+ (current_inferior ()->arch (),
[&objfile, name] (struct objfile *obj)
{
/* Don't return separate debug files. */
@@ -641,7 +642,7 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
}, gdbpy_current_objfile);
else
gdbarch_iterate_over_objfiles_in_search_order
- (target_gdbarch (),
+ (current_inferior ()->arch (),
[&objfile, name] (struct objfile *obj)
{
/* Don't return separate debug files. */
diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c
index 72a5d4f..f636ffd 100644
--- a/gdb/python/py-progspace.c
+++ b/gdb/python/py-progspace.c
@@ -28,6 +28,7 @@
#include "block.h"
#include "py-event.h"
#include "observable.h"
+#include "inferior.h"
struct pspace_object
{
@@ -69,11 +70,11 @@ struct pspace_deleter
this is one time when the current program space and current inferior
are not in sync: All inferiors that use PSPACE may no longer exist.
We don't need to do much here, and since "there is always an inferior"
- using target_gdbarch suffices.
+ using the current inferior's arch suffices.
Note: We cannot call get_current_arch because it may try to access
the target, which may involve accessing data in the pspace currently
being deleted. */
- struct gdbarch *arch = target_gdbarch ();
+ gdbarch *arch = current_inferior ()->arch ();
gdbpy_enter enter_py (arch);
gdbpy_ref<pspace_object> object (obj);
diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
index 7978f33..822ae18 100644
--- a/gdb/python/py-record-btrace.c
+++ b/gdb/python/py-record-btrace.c
@@ -302,7 +302,7 @@ recpy_bt_insn_decoded (PyObject *self, void *closure)
try
{
- gdb_print_insn (target_gdbarch (), insn->pc, &strfile, NULL);
+ gdb_print_insn (current_inferior ()->arch (), insn->pc, &strfile, NULL);
}
catch (const gdb_exception &except)
{
diff --git a/gdb/python/python.c b/gdb/python/python.c
index e56d246..d3dea08 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -254,7 +254,7 @@ gdbpy_enter::get_gdbarch ()
void
gdbpy_enter::finalize ()
{
- python_gdbarch = target_gdbarch ();
+ python_gdbarch = current_inferior ()->arch ();
}
/* A helper class to save and restore the GIL, but without touching