diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2023-09-29 14:24:38 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2023-10-10 10:44:35 -0400 |
commit | 99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee (patch) | |
tree | 7f642c989f7c7b49bd40ab5873fc12be632e6ea9 /gdb/python/py-inferior.c | |
parent | 72c4529c85907a5e1e04960ff1362a5a185553a0 (diff) | |
download | binutils-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.zip binutils-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.tar.gz binutils-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.tar.bz2 |
gdb: remove target_gdbarch
This function is just a wrapper around the current inferior's gdbarch.
I find that having that wrapper just obscures where the arch is coming
from, and that it's often used as "I don't know which arch to use so
I'll use this magical target_gdbarch function that gets me an arch" when
the arch should in fact come from something in the context (a thread,
objfile, symbol, etc). I think that removing it and inlining
`current_inferior ()->arch ()` everywhere will make it a bit clearer
where that arch comes from and will trigger people into reflecting
whether this is the right place to get the arch or not.
Change-Id: I79f14b4e4934c88f91ca3a3155f5fc3ea2fadf6b
Reviewed-By: John Baldwin <jhb@FreeBSD.org>
Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/python/py-inferior.c')
-rw-r--r-- | gdb/python/py-inferior.c | 14 |
1 files changed, 7 insertions, 7 deletions
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 (); |