aboutsummaryrefslogtreecommitdiff
path: root/gdb/sol-thread.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-09-29 14:24:38 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-10-10 10:44:35 -0400
commit99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee (patch)
tree7f642c989f7c7b49bd40ab5873fc12be632e6ea9 /gdb/sol-thread.c
parent72c4529c85907a5e1e04960ff1362a5a185553a0 (diff)
downloadgdb-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/sol-thread.c')
-rw-r--r--gdb/sol-thread.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index c152b44..537acdb 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -847,7 +847,7 @@ ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
= get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ ptid, current_inferior ()->arch ());
target_fetch_registers (regcache, -1);
fill_gregset (regcache, (gdb_gregset_t *) gregset, -1);
@@ -864,7 +864,7 @@ ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid,
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
= get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ ptid, current_inferior ()->arch ());
supply_gregset (regcache, (const gdb_gregset_t *) gregset);
target_store_registers (regcache, -1);
@@ -917,7 +917,7 @@ ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
= get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ ptid, current_inferior ()->arch ());
target_fetch_registers (regcache, -1);
fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1);
@@ -934,7 +934,7 @@ ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
= get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ ptid, current_inferior ()->arch ());
supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset);
target_store_registers (regcache, -1);
@@ -1079,7 +1079,8 @@ info_cb (const td_thrhandle_t *th, void *s)
gdb_printf (" startfunc=%s",
msym.minsym
? msym.minsym->print_name ()
- : paddress (target_gdbarch (), ti.ti_startfunc));
+ : paddress (current_inferior ()->arch (),
+ ti.ti_startfunc));
}
/* If thread is asleep, print function that went to sleep. */
@@ -1091,7 +1092,7 @@ info_cb (const td_thrhandle_t *th, void *s)
gdb_printf (" sleepfunc=%s",
msym.minsym
? msym.minsym->print_name ()
- : paddress (target_gdbarch (), ti.ti_pc));
+ : paddress (current_inferior ()->arch (), ti.ti_pc));
}
gdb_printf ("\n");