* [patch/resend/rfa] (4/4) Make frame-rewind code dependent on ELF attribute of target
@ 2004-04-14 6:24 Randolph Chung
2004-04-15 17:31 ` Andrew Cagney
0 siblings, 1 reply; 3+ messages in thread
From: Randolph Chung @ 2004-04-14 6:24 UTC (permalink / raw)
To: gdb-patches
2004-04-13 Randolph Chung <tausq@debian.org>
* Makefile.in (hppa-hpux-tdep.o): Add $(hppa_tdep_h).
* hppa-hpux-tdep.c (hppa-linux-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.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.538
diff -u -p -r1.538 Makefile.in
--- Makefile.in 12 Apr 2004 19:49:48 -0000 1.538
+++ Makefile.in 14 Apr 2004 05:01:18 -0000
@@ -1819,7 +1819,7 @@ hpacc-abi.o: hpacc-abi.c $(defs_h) $(val
hppah-nat.o: hppah-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_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) \
- $(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) \
$(value_h) $(regcache_h) $(completer_h) $(language_h) $(osabi_h) \
$(gdb_assert_h) $(infttrace_h) $(arch_utils_h) $(symtab_h) \
Index: hppa-hpux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
retrieving revision 1.14
diff -u -p -r1.14 hppa-hpux-tdep.c
--- hppa-hpux-tdep.c 8 Apr 2004 21:18:12 -0000 1.14
+++ hppa-hpux-tdep.c 14 Apr 2004 05:01:20 -0000
@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suit
#include "objfiles.h"
#include "inferior.h"
#include "infcall.h"
+#include "hppa-linux-tdep.h"
#include <dl.h>
#include <machine/save_state.h>
@@ -721,12 +722,18 @@ hppa_hpux_init_abi (struct gdbarch_info
static void
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);
}
static void
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);
}
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.143
diff -u -p -r1.143 hppa-tdep.c
--- hppa-tdep.c 11 Apr 2004 04:20:51 -0000 1.143
+++ hppa-tdep.c 14 Apr 2004 05:01:21 -0000
@@ -352,15 +345,18 @@ compare_unwind_entries (const void *arg1
return 0;
}
-static CORE_ADDR low_text_segment_address;
-
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))
- && 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
@@ -370,30 +366,29 @@ internalize_unwinds (struct objfile *obj
{
/* We will read the unwind entries into temporary memory, then
fill in the actual unwind table. */
+
if (size > 0)
{
unsigned long tmp;
unsigned i;
char *buf = alloca (size);
+ CORE_ADDR low_text_segment_address;
- low_text_segment_address = -1;
-
- /* If addresses are 64 bits wide, then unwinds are supposed to
+ /* For ELF targets, then unwinds are supposed to
be segment relative offsets instead of absolute addresses.
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 (TARGET_PTR_BIT == 64 && text_offset == 0)
+ if (gdbarch_tdep (current_gdbarch)->is_elf && text_offset == 0)
{
+ low_text_segment_address = -1;
+
bfd_map_over_sections (objfile->obfd,
- record_text_segment_lowaddr, NULL);
+ record_text_segment_lowaddr,
+ &low_text_segment_address);
- /* ?!? Mask off some low bits. Should this instead subtract
- out the lowest section's filepos or something like that?
- This looks very hokey to me. */
- 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);
@@ -2621,7 +2601,7 @@ hppa_gdbarch_init (struct gdbarch_info i
return (arches->gdbarch);
/* If none found, then allocate and initialize one. */
- tdep = XMALLOC (struct gdbarch_tdep);
+ tdep = XZALLOC (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
/* Determine from the bfd_arch_info structure if we are dealing with
@@ -2734,7 +2719,11 @@ hppa_gdbarch_init (struct gdbarch_info i
static void
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
Index: hppa-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.h,v
retrieving revision 1.1
diff -u -p -r1.1 hppa-tdep.h
--- hppa-tdep.h 15 Aug 2003 23:02:03 -0000 1.1
+++ hppa-tdep.h 14 Apr 2004 05:27:02 -0000
@@ -27,6 +27,9 @@ struct gdbarch_tdep
/* The number of bytes in an address. For now, this field is designed
to allow us to differentiate hppa32 from hppa64 targets. */
int bytes_per_address;
+
+ /* Is this an ELF target? This can be 64-bit HP-UX, or 32/64-bit Linux */
+ int is_elf;
};
#endif /* HPPA_TDEP_H */
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch/resend/rfa] (4/4) Make frame-rewind code dependent on ELF attribute of target
2004-04-14 6:24 [patch/resend/rfa] (4/4) Make frame-rewind code dependent on ELF attribute of target Randolph Chung
@ 2004-04-15 17:31 ` Andrew Cagney
2004-04-17 17:42 ` Randolph Chung
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2004-04-15 17:31 UTC (permalink / raw)
To: Randolph Chung; +Cc: gdb-patches
> 2004-04-13 Randolph Chung <tausq@debian.org>
>
> * Makefile.in (hppa-hpux-tdep.o): Add $(hppa_tdep_h).
> * hppa-hpux-tdep.c (hppa-linux-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.
(If I've read the previous thread correctly, Joel was ok.)
> Index: hppa-hpux-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
> retrieving revision 1.14
> diff -u -p -r1.14 hppa-hpux-tdep.c
> --- hppa-hpux-tdep.c 8 Apr 2004 21:18:12 -0000 1.14
> +++ hppa-hpux-tdep.c 14 Apr 2004 05:01:20 -0000
> @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suit
> #include "objfiles.h"
> #include "inferior.h"
> #include "infcall.h"
> +#include "hppa-linux-tdep.h"
I suspect this should have been "hppa-tdep.h".
> +
> + /* Is this an ELF target? This can be 64-bit HP-UX, or 32/64-bit Linux */
> + int is_elf;
And coding nit. End sentences with a full-stop and two spaces; and
"GNU/Linux" for the system, "Linux kernel" for the kernel. thus:
.... 32/64-bit GNU/Linux system. */
otherwize, yep, ok.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch/resend/rfa] (4/4) Make frame-rewind code dependent on ELF attribute of target
2004-04-15 17:31 ` Andrew Cagney
@ 2004-04-17 17:42 ` Randolph Chung
0 siblings, 0 replies; 3+ messages in thread
From: Randolph Chung @ 2004-04-17 17:42 UTC (permalink / raw)
To: gdb-patches
commited. -randolph
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.5706
diff -u -p -r1.5706 ChangeLog
--- ChangeLog 17 Apr 2004 17:31:40 -0000 1.5706
+++ ChangeLog 17 Apr 2004 17:39:35 -0000
@@ -1,5 +1,20 @@
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>
+
* hppa-tdep.c (hppa_pseudo_register_read): Define.
(hppa_gdbarch_init): Set pseudo_register_read.
* config/pa/tm-hppa.h (DEPRECATED_CLEAN_UP_REGISTER_VALUE): Remove.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.544
diff -u -p -r1.544 Makefile.in
--- Makefile.in 17 Apr 2004 17:19:27 -0000 1.544
+++ Makefile.in 17 Apr 2004 17:39:36 -0000
@@ -1826,7 +1826,7 @@ hpacc-abi.o: hpacc-abi.c $(defs_h) $(val
hppah-nat.o: hppah-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_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) \
- $(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) \
$(value_h) $(regcache_h) $(completer_h) $(language_h) $(osabi_h) \
$(gdb_assert_h) $(infttrace_h) $(arch_utils_h) $(symtab_h) \
Index: hppa-hpux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
retrieving revision 1.14
diff -u -p -r1.14 hppa-hpux-tdep.c
--- hppa-hpux-tdep.c 8 Apr 2004 21:18:12 -0000 1.14
+++ hppa-hpux-tdep.c 17 Apr 2004 17:39:36 -0000
@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suit
#include "objfiles.h"
#include "inferior.h"
#include "infcall.h"
+#include "hppa-tdep.h"
#include <dl.h>
#include <machine/save_state.h>
@@ -721,12 +722,18 @@ hppa_hpux_init_abi (struct gdbarch_info
static void
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);
}
static void
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);
}
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.146
diff -u -p -r1.146 hppa-tdep.c
--- hppa-tdep.c 17 Apr 2004 17:31:40 -0000 1.146
+++ hppa-tdep.c 17 Apr 2004 17:39:37 -0000
@@ -351,15 +351,18 @@ compare_unwind_entries (const void *arg1
return 0;
}
-static CORE_ADDR low_text_segment_address;
-
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))
- && 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
@@ -369,30 +372,29 @@ internalize_unwinds (struct objfile *obj
{
/* We will read the unwind entries into temporary memory, then
fill in the actual unwind table. */
+
if (size > 0)
{
unsigned long tmp;
unsigned i;
char *buf = alloca (size);
+ CORE_ADDR low_text_segment_address;
- low_text_segment_address = -1;
-
- /* If addresses are 64 bits wide, then unwinds are supposed to
+ /* For ELF targets, then unwinds are supposed to
be segment relative offsets instead of absolute addresses.
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 (TARGET_PTR_BIT == 64 && text_offset == 0)
+ if (gdbarch_tdep (current_gdbarch)->is_elf && text_offset == 0)
{
+ low_text_segment_address = -1;
+
bfd_map_over_sections (objfile->obfd,
- record_text_segment_lowaddr, NULL);
+ record_text_segment_lowaddr,
+ &low_text_segment_address);
- /* ?!? Mask off some low bits. Should this instead subtract
- out the lowest section's filepos or something like that?
- This looks very hokey to me. */
- 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);
@@ -2607,7 +2609,7 @@ hppa_gdbarch_init (struct gdbarch_info i
return (arches->gdbarch);
/* If none found, then allocate and initialize one. */
- tdep = XMALLOC (struct gdbarch_tdep);
+ tdep = XZALLOC (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
/* Determine from the bfd_arch_info structure if we are dealing with
@@ -2722,7 +2724,11 @@ hppa_gdbarch_init (struct gdbarch_info i
static void
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
Index: hppa-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.h,v
retrieving revision 1.2
diff -u -p -r1.2 hppa-tdep.h
--- hppa-tdep.h 17 Apr 2004 17:19:28 -0000 1.2
+++ hppa-tdep.h 17 Apr 2004 17:39:37 -0000
@@ -29,6 +29,10 @@ struct gdbarch_tdep
/* The number of bytes in an address. For now, this field is designed
to allow us to differentiate hppa32 from hppa64 targets. */
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;
};
/*
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-04-17 17:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-14 6:24 [patch/resend/rfa] (4/4) Make frame-rewind code dependent on ELF attribute of target Randolph Chung
2004-04-15 17:31 ` Andrew Cagney
2004-04-17 17:42 ` Randolph Chung
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox