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/solib-dsbt.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/solib-dsbt.c')
-rw-r--r-- | gdb/solib-dsbt.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index e0aa7f1..c29b2b8 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -197,14 +197,16 @@ dsbt_print_loadmap (struct int_elf32_dsbt_loadmap *map) for (i = 0; i < map->nsegs; i++) gdb_printf ("%s:%s -> %s:%s\n", - print_core_address (target_gdbarch (), + print_core_address (current_inferior ()->arch (), map->segs[i].p_vaddr), - print_core_address (target_gdbarch (), - map->segs[i].p_vaddr - + map->segs[i].p_memsz), - print_core_address (target_gdbarch (), map->segs[i].addr), - print_core_address (target_gdbarch (), map->segs[i].addr - + map->segs[i].p_memsz)); + print_core_address (current_inferior ()->arch (), + (map->segs[i].p_vaddr + + map->segs[i].p_memsz)), + print_core_address (current_inferior ()->arch (), + map->segs[i].addr), + print_core_address (current_inferior ()->arch (), + (map->segs[i].addr + + map->segs[i].p_memsz))); } } @@ -213,7 +215,7 @@ dsbt_print_loadmap (struct int_elf32_dsbt_loadmap *map) static struct int_elf32_dsbt_loadmap * decode_loadmap (const gdb_byte *buf) { - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); + bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); const struct ext_elf32_dsbt_loadmap *ext_ldmbuf; struct int_elf32_dsbt_loadmap *int_ldmbuf; @@ -313,7 +315,7 @@ dsbt_get_initial_loadmaps (void) static struct int_elf32_dsbt_loadmap * fetch_loadmap (CORE_ADDR ldmaddr) { - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); + bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); struct ext_elf32_dsbt_loadmap ext_ldmbuf_partial; struct ext_elf32_dsbt_loadmap *ext_ldmbuf; struct int_elf32_dsbt_loadmap *int_ldmbuf; @@ -436,7 +438,7 @@ displacement_from_map (struct int_elf32_dsbt_loadmap *map, static CORE_ADDR lm_base (void) { - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); + bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); struct bound_minimal_symbol got_sym; CORE_ADDR addr; gdb_byte buf[TIC6X_PTR_SIZE]; @@ -518,7 +520,7 @@ lm_base (void) static struct so_list * dsbt_current_sos (void) { - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); + bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); CORE_ADDR lm_addr; struct so_list *sos_head = NULL; struct so_list **sos_next_ptr = &sos_head; @@ -771,7 +773,7 @@ enable_break (void) hex_string_custom (addr, 8)); /* Now (finally!) create the solib breakpoint. */ - create_solib_event_breakpoint (target_gdbarch (), addr); + create_solib_event_breakpoint (current_inferior ()->arch (), addr); ret = 1; } |