This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [4/8] Eliminate current_gdbarch from *-tdep.c: hppa
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 27 Aug 2008 20:03:00 +0200 (CEST)
- Subject: [rfc] [4/8] Eliminate current_gdbarch from *-tdep.c: hppa
Hello,
the hppa internalize_unwinds routine is a bit unusual in that it is not
in the normal frame- or regcache-related call paths. Instead, it operates
solely on an objfile. Therefore, the patch below uses the per-objfile
arch to access the tdep->is_elf and tdep->solib_get_text_base.
Bye,
Ulrich
ChangeLog:
* hppa-tdep.c (internalize_unwinds): Use objfile architecture
instead of current_gdbarch.
diff -urNp gdb-orig/gdb/hppa-tdep.c gdb-head/gdb/hppa-tdep.c
--- gdb-orig/gdb/hppa-tdep.c 2008-08-26 00:05:35.000000000 +0200
+++ gdb-head/gdb/hppa-tdep.c 2008-08-26 00:06:38.000000000 +0200
@@ -230,6 +230,7 @@ internalize_unwinds (struct objfile *obj
if (size > 0)
{
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
unsigned long tmp;
unsigned i;
char *buf = alloca (size);
@@ -241,7 +242,7 @@ internalize_unwinds (struct objfile *obj
Note that when loading a shared library (text_offset != 0) the
unwinds are already relative to the text_offset that will be
passed in. */
- if (gdbarch_tdep (current_gdbarch)->is_elf && text_offset == 0)
+ if (gdbarch_tdep (gdbarch)->is_elf && text_offset == 0)
{
low_text_segment_address = -1;
@@ -251,9 +252,9 @@ internalize_unwinds (struct objfile *obj
text_offset = low_text_segment_address;
}
- else if (gdbarch_tdep (current_gdbarch)->solib_get_text_base)
+ else if (gdbarch_tdep (gdbarch)->solib_get_text_base)
{
- text_offset = gdbarch_tdep (current_gdbarch)->solib_get_text_base (objfile);
+ text_offset = gdbarch_tdep (gdbarch)->solib_get_text_base (objfile);
}
bfd_get_section_contents (objfile->obfd, section, buf, 0, size);
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com