RFC: fix hard-coded section index in hppa-tdep.c

Tom Tromey tromey@redhat.com
Wed Jan 23 20:42:00 GMT 2013


hppa-tdep.c passes 0 as the section index argument to ANOFFSET.  This
works ok since this is often the index of the text section.  However,
there's not really any requirement that this be true (it is true for SOM
due to how somread.c is currently written, but I doubt it is guaranteed
for other formats on HPPA).

This patch fixes the problem in the obvious way.

I built and tested this on HPUX as part of a much larger patch series.
However, I thought it was an obvious fix on its own.

In the absence of comments I plan to check it in after a few days.

Tom

	* hppa-tdep.c (read_unwind_info): Use SECT_OFF_TEXT, not "0".
---
 gdb/hppa-tdep.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index c82ea55..837b10c 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -327,7 +327,7 @@ read_unwind_info (struct objfile *objfile)
   struct hppa_unwind_info *ui;
   struct hppa_objfile_private *obj_private;
 
-  text_offset = ANOFFSET (objfile->section_offsets, 0);
+  text_offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
   ui = (struct hppa_unwind_info *) obstack_alloc (&objfile->objfile_obstack,
 					   sizeof (struct hppa_unwind_info));
 
-- 
1.7.7.6



More information about the Gdb-patches mailing list