This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: fix hard-coded section index in hppa-tdep.c
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 24 Jan 2013 17:55:06 +0000
- Subject: Re: RFC: fix hard-coded section index in hppa-tdep.c
- References: <87zjzztyvd.fsf@fleche.redhat.com>
On 01/23/2013 08:42 PM, Tom Tromey wrote:
> 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".
I can't begin to imagine how this could be wrong...
Well, maybe I can. Maybe what the code wanted was the offset of
the segment, and if some other section ends up before text, that's
the offset you want. But the variable is called text_offset,
so that's not very plausible, and not the simplest explanation...
I think you should put this in. If this ever needs to be reverted,
it should gain a comment.
--
Pedro Alves