2004-04-17 Randolph Chung <tausq@debian.org>
* Makefile.in (hppa-hpux-tdep.o): Add $(hppa_tdep_h). * hppa-hpux-tdep.c (hppa-tdep.h): Include. (hppa_hpux_som_init_abi): Set is_elf to 0. (hppa_hpux_elf_init_abi): Set is_elf to 1. * hppa-tdep.c (low_text_segment_address): Remove global. (record_text_segment_lowaddr): Pass in low address as parameter. Use section offset to calculate segment address. (internalize_unwinds): Define low_text_segment_address as local and pass to record_text_segment_lowaddr for ELF targets. (hppa_gdbarch_init): Zero fill tdep structure. (hppa_dump_tdep): Print tdep structure. * hppa-tdep.h (gdbarch_tdep): Add is_elf member to tdep structure.
This commit is contained in:
parent
0f8d9d59e8
commit
fdd72f950f
5 changed files with 52 additions and 20 deletions
|
@ -1,3 +1,18 @@
|
||||||
|
2004-04-17 Randolph Chung <tausq@debian.org>
|
||||||
|
|
||||||
|
* Makefile.in (hppa-hpux-tdep.o): Add $(hppa_tdep_h).
|
||||||
|
* hppa-hpux-tdep.c (hppa-tdep.h): Include.
|
||||||
|
(hppa_hpux_som_init_abi): Set is_elf to 0.
|
||||||
|
(hppa_hpux_elf_init_abi): Set is_elf to 1.
|
||||||
|
* hppa-tdep.c (low_text_segment_address): Remove global.
|
||||||
|
(record_text_segment_lowaddr): Pass in low address as parameter. Use
|
||||||
|
section offset to calculate segment address.
|
||||||
|
(internalize_unwinds): Define low_text_segment_address as local and
|
||||||
|
pass to record_text_segment_lowaddr for ELF targets.
|
||||||
|
(hppa_gdbarch_init): Zero fill tdep structure.
|
||||||
|
(hppa_dump_tdep): Print tdep structure.
|
||||||
|
* hppa-tdep.h (gdbarch_tdep): Add is_elf member to tdep structure.
|
||||||
|
|
||||||
2004-04-17 Randolph Chung <tausq@debian.org>
|
2004-04-17 Randolph Chung <tausq@debian.org>
|
||||||
|
|
||||||
* hppa-tdep.c (hppa_pseudo_register_read): Define.
|
* hppa-tdep.c (hppa_pseudo_register_read): Define.
|
||||||
|
|
|
@ -1826,7 +1826,7 @@ hpacc-abi.o: hpacc-abi.c $(defs_h) $(value_h) $(gdb_regex_h) $(gdb_string_h) \
|
||||||
hppah-nat.o: hppah-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
|
hppah-nat.o: hppah-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
|
||||||
$(gdb_wait_h) $(regcache_h) $(gdb_string_h) $(infttrace_h)
|
$(gdb_wait_h) $(regcache_h) $(gdb_string_h) $(infttrace_h)
|
||||||
hppa-hpux-tdep.o: hppa-hpux-tdep.c $(defs_h) $(arch_utils_h) $(gdbcore_h) \
|
hppa-hpux-tdep.o: hppa-hpux-tdep.c $(defs_h) $(arch_utils_h) $(gdbcore_h) \
|
||||||
$(osabi_h) $(gdb_string_h) $(frame_h)
|
$(osabi_h) $(gdb_string_h) $(frame_h) $(hppa_tdep_h)
|
||||||
hppa-tdep.o: hppa-tdep.c $(defs_h) $(frame_h) $(bfd_h) $(inferior_h) \
|
hppa-tdep.o: hppa-tdep.c $(defs_h) $(frame_h) $(bfd_h) $(inferior_h) \
|
||||||
$(value_h) $(regcache_h) $(completer_h) $(language_h) $(osabi_h) \
|
$(value_h) $(regcache_h) $(completer_h) $(language_h) $(osabi_h) \
|
||||||
$(gdb_assert_h) $(infttrace_h) $(arch_utils_h) $(symtab_h) \
|
$(gdb_assert_h) $(infttrace_h) $(arch_utils_h) $(symtab_h) \
|
||||||
|
|
|
@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
#include "infcall.h"
|
#include "infcall.h"
|
||||||
|
#include "hppa-tdep.h"
|
||||||
|
|
||||||
#include <dl.h>
|
#include <dl.h>
|
||||||
#include <machine/save_state.h>
|
#include <machine/save_state.h>
|
||||||
|
@ -721,12 +722,18 @@ hppa_hpux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||||
static void
|
static void
|
||||||
hppa_hpux_som_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
hppa_hpux_som_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||||
|
|
||||||
|
tdep->is_elf = 0;
|
||||||
hppa_hpux_init_abi (info, gdbarch);
|
hppa_hpux_init_abi (info, gdbarch);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hppa_hpux_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
hppa_hpux_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||||
|
|
||||||
|
tdep->is_elf = 1;
|
||||||
hppa_hpux_init_abi (info, gdbarch);
|
hppa_hpux_init_abi (info, gdbarch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -351,15 +351,18 @@ compare_unwind_entries (const void *arg1, const void *arg2)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR low_text_segment_address;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
record_text_segment_lowaddr (bfd *abfd, asection *section, void *ignored)
|
record_text_segment_lowaddr (bfd *abfd, asection *section, void *data)
|
||||||
{
|
{
|
||||||
if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
|
if ((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
|
||||||
== (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
|
== (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
|
||||||
&& section->vma < low_text_segment_address)
|
{
|
||||||
low_text_segment_address = section->vma;
|
bfd_vma value = section->vma - section->filepos;
|
||||||
|
CORE_ADDR *low_text_segment_address = (CORE_ADDR *)data;
|
||||||
|
|
||||||
|
if (value < *low_text_segment_address)
|
||||||
|
*low_text_segment_address = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -369,30 +372,29 @@ internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table,
|
||||||
{
|
{
|
||||||
/* We will read the unwind entries into temporary memory, then
|
/* We will read the unwind entries into temporary memory, then
|
||||||
fill in the actual unwind table. */
|
fill in the actual unwind table. */
|
||||||
|
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
unsigned long tmp;
|
unsigned long tmp;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char *buf = alloca (size);
|
char *buf = alloca (size);
|
||||||
|
CORE_ADDR low_text_segment_address;
|
||||||
|
|
||||||
low_text_segment_address = -1;
|
/* For ELF targets, then unwinds are supposed to
|
||||||
|
|
||||||
/* If addresses are 64 bits wide, then unwinds are supposed to
|
|
||||||
be segment relative offsets instead of absolute addresses.
|
be segment relative offsets instead of absolute addresses.
|
||||||
|
|
||||||
Note that when loading a shared library (text_offset != 0) the
|
Note that when loading a shared library (text_offset != 0) the
|
||||||
unwinds are already relative to the text_offset that will be
|
unwinds are already relative to the text_offset that will be
|
||||||
passed in. */
|
passed in. */
|
||||||
if (TARGET_PTR_BIT == 64 && text_offset == 0)
|
if (gdbarch_tdep (current_gdbarch)->is_elf && text_offset == 0)
|
||||||
{
|
{
|
||||||
bfd_map_over_sections (objfile->obfd,
|
low_text_segment_address = -1;
|
||||||
record_text_segment_lowaddr, NULL);
|
|
||||||
|
|
||||||
/* ?!? Mask off some low bits. Should this instead subtract
|
bfd_map_over_sections (objfile->obfd,
|
||||||
out the lowest section's filepos or something like that?
|
record_text_segment_lowaddr,
|
||||||
This looks very hokey to me. */
|
&low_text_segment_address);
|
||||||
low_text_segment_address &= ~0xfff;
|
|
||||||
text_offset += low_text_segment_address;
|
text_offset = low_text_segment_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
bfd_get_section_contents (objfile->obfd, section, buf, 0, size);
|
bfd_get_section_contents (objfile->obfd, section, buf, 0, size);
|
||||||
|
@ -2607,7 +2609,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||||
return (arches->gdbarch);
|
return (arches->gdbarch);
|
||||||
|
|
||||||
/* If none found, then allocate and initialize one. */
|
/* If none found, then allocate and initialize one. */
|
||||||
tdep = XMALLOC (struct gdbarch_tdep);
|
tdep = XZALLOC (struct gdbarch_tdep);
|
||||||
gdbarch = gdbarch_alloc (&info, tdep);
|
gdbarch = gdbarch_alloc (&info, tdep);
|
||||||
|
|
||||||
/* Determine from the bfd_arch_info structure if we are dealing with
|
/* Determine from the bfd_arch_info structure if we are dealing with
|
||||||
|
@ -2722,7 +2724,11 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||||
static void
|
static void
|
||||||
hppa_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
|
hppa_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
|
||||||
{
|
{
|
||||||
/* Nothing to print for the moment. */
|
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
|
||||||
|
|
||||||
|
fprintf_unfiltered (file, "bytes_per_address = %d\n",
|
||||||
|
tdep->bytes_per_address);
|
||||||
|
fprintf_unfiltered (file, "elf = %s\n", tdep->is_elf ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -29,6 +29,10 @@ struct gdbarch_tdep
|
||||||
/* The number of bytes in an address. For now, this field is designed
|
/* The number of bytes in an address. For now, this field is designed
|
||||||
to allow us to differentiate hppa32 from hppa64 targets. */
|
to allow us to differentiate hppa32 from hppa64 targets. */
|
||||||
int bytes_per_address;
|
int bytes_per_address;
|
||||||
|
|
||||||
|
/* Is this an ELF target? This can be 64-bit HP-UX, or a 32/64-bit GNU/Linux
|
||||||
|
system. */
|
||||||
|
int is_elf;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue