[commit/RFC/multiarch/hpux] HPUX_ELF osabi init routine incorrectly registered

Joel Brobecker
2003-08-14T00:32:28Z

[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]

Hello,

I noticed while working on the hppa64 target that the HPUX_ELF gdbarch
initialization routine was not called during the gdbarch initialization.
It turns out that we where using the default bfd arch_info descriptor
which corresponds to a 32bit ABI. So when we checked the compatibility
between the arch_info that we registered and the arch_info determined by
the sniffer, we determined that they do not match, and therefore did not
call the assiocated initialization routine.

I fixed the problem the best way I can, by using a hard-coded number
corresponding to the arch_info that corresponds to hppa2.0w. I don't
know BFD too well yet, but it looks like we should really be defining
new #defines in archures.c for each hppa machine numbers, and then use
them here instead of my hard-coded value. I added a FIXME to remind us,
and will send a patch to binutils shortly. In them meantime, this fixes
the problem.

Any opinions, maybe?

2003-08-13 J. Brobecker <brobecker@gnat.com>

* hppa-hpux-tdep.c (_initialize_hppa_hpux_tdep): Use the correct
bfd arch_info when registering the GDB_OSABI_HPUX_ELF initialization
routine.

Tested on hppa64-hpux11.

(I have some other no-brainer patches coming, but I keep being interrupted
by other tasks :-().

--
Joel

[-- Attachment #2: osabi.diff --]
[-- Type: text/plain, Size: 857 bytes --]

Index: hppa-hpux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
retrieving revision 1.8
diff -u -p -r1.8 hppa-hpux-tdep.c
--- hppa-hpux-tdep.c 27 Jul 2003 17:27:17 -0000 1.8
+++ hppa-hpux-tdep.c 14 Aug 2003 00:19:24 -0000
@@ -118,6 +118,9 @@ _initialize_hppa_hpux_tdep (void)
{
gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_HPUX_SOM,
hppa_hpux_som_init_abi);
- gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_HPUX_ELF,
+ /* FIXME brobecker 2003-08-13: The machine number 25 corresponds to
+ the hppa2.0w bfd arch_info. A #define should probably be defined
+ in bfd, instead of using this hard-coded number. */
+ gdbarch_register_osabi (bfd_arch_hppa, 25, GDB_OSABI_HPUX_ELF,
hppa_hpux_elf_init_abi);
}