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/bsd-uthread.c | |
parent | 72c4529c85907a5e1e04960ff1362a5a185553a0 (diff) | |
download | gdb-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.zip gdb-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.tar.gz gdb-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/bsd-uthread.c')
-rw-r--r-- | gdb/bsd-uthread.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index e27e88a..8765fb7 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -125,7 +125,7 @@ bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch, static void bsd_uthread_check_magic (CORE_ADDR addr) { - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); + bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); ULONGEST magic = read_memory_unsigned_integer (addr, 4, byte_order); if (magic != BSD_UTHREAD_PTHREAD_MAGIC) @@ -169,7 +169,7 @@ bsd_uthread_lookup_address (const char *name, struct objfile *objfile) static int bsd_uthread_lookup_offset (const char *name, struct objfile *objfile) { - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); + bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); CORE_ADDR addr; addr = bsd_uthread_lookup_address (name, objfile); @@ -182,7 +182,8 @@ bsd_uthread_lookup_offset (const char *name, struct objfile *objfile) static CORE_ADDR bsd_uthread_read_memory_address (CORE_ADDR addr) { - struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr; + type *ptr_type + = builtin_type (current_inferior ()->arch ())->builtin_data_ptr; return read_memory_typed_address (addr, ptr_type); } @@ -193,7 +194,7 @@ bsd_uthread_read_memory_address (CORE_ADDR addr) static int bsd_uthread_activate (struct objfile *objfile) { - struct gdbarch *gdbarch = target_gdbarch (); + gdbarch *gdbarch = current_inferior ()->arch (); struct bsd_uthread_ops *ops = get_bsd_uthread (gdbarch); /* Skip if the thread stratum has already been activated. */ @@ -374,7 +375,7 @@ ptid_t bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status, target_wait_flags options) { - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); + bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); CORE_ADDR addr; process_stratum_target *beneath = as_process_stratum_target (this->beneath ()); @@ -432,7 +433,7 @@ bsd_uthread_target::resume (ptid_t ptid, int step, enum gdb_signal sig) bool bsd_uthread_target::thread_alive (ptid_t ptid) { - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); + bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); CORE_ADDR addr = ptid.tid (); if (addr != 0) @@ -513,7 +514,7 @@ static const char * const bsd_uthread_state[] = const char * bsd_uthread_target::extra_thread_info (thread_info *info) { - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); + bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); CORE_ADDR addr = info->ptid.tid (); if (addr != 0) |