[RFA/PATCH] Detect osabi in hppa gdbarch init

Joel Brobecker brobecker@gnat.com
Wed Nov 27 14:37:00 GMT 2002


This is part of the multi-arching conversion of the hppa targets.
It is depedent on 

    http://sources.redhat.com/ml/gdb-patches/2002-11/msg00692.html

(which adds the osabi enums, and the handling of HPUX ELF objfiles
in the elf generic osabi sniffer)

2002-11-27  J. Brobecker  <brobecker@gnat.com>

	* hppa-tdep.c: Add #include "osabi.h" (for hppa_gdbarch_init).
	(hppa_gdbarch_init): Detect osabi from objfile. Will be needed
	later to set the proper gdbarch methods depending on the osabi.
        * Makefile.in (hppa-tdep.o): Add dependency on osabi.h.

Tested on hppa2.0w-hp-hpux11.00.

I will apply this patch per the multi-arch rule as soon as the patch
above gets in. This gives us a few days to send objections, if you have
any.

Thanks,
-- 
Joel
-------------- next part --------------
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.35
diff -c -3 -p -r1.35 hppa-tdep.c
*** hppa-tdep.c	24 Nov 2002 19:48:12 -0000	1.35
--- hppa-tdep.c	27 Nov 2002 22:20:32 -0000
***************
*** 31,36 ****
--- 31,37 ----
  #include "regcache.h"
  #include "completer.h"
  #include "language.h"
+ #include "osabi.h"
  
  /* For argument passing to the inferior */
  #include "symtab.h"
*************** static struct gdbarch *
*** 4895,4900 ****
--- 4896,4915 ----
  hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
  {
    struct gdbarch *gdbarch;
+   enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
+   
+   /* Try to determine the ABI of the object we are loading.  */
+ 
+   if (info.abfd != NULL)
+     {
+       osabi = gdbarch_lookup_osabi (info.abfd);
+       if (osabi == GDB_OSABI_UNKNOWN)
+ 	{
+ 	  /* If it's a SOM file, assume it's HP/UX SOM.  */
+ 	  if (bfd_get_flavour (info.abfd) == bfd_target_som_flavour)
+ 	    osabi = GDB_OSABI_HPUX_SOM;
+ 	}
+     }
  
    /* find a candidate among the list of pre-declared architectures.  */
    arches = gdbarch_list_lookup_by_info (arches, &info);
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.286
diff -c -3 -p -r1.286 Makefile.in
*** Makefile.in	27 Nov 2002 19:13:08 -0000	1.286
--- Makefile.in	27 Nov 2002 22:20:33 -0000
*************** hpacc-abi.o: hpacc-abi.c $(defs_h) $(val
*** 1748,1754 ****
  hppa-tdep.o: hppa-tdep.c $(defs_h) $(frame_h) $(bfd_h) $(inferior_h) \
  	$(value_h) $(regcache_h) $(completer_h) $(symtab_h) $(a_out_encap_h) \
  	$(gdb_stat_h) $(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) \
! 	$(symfile_h) $(objfiles_h) $(language_h)
  hppab-nat.o: hppab-nat.c $(defs_h) $(inferior_h) $(target_h) $(regcache_h)
  hppah-nat.o: hppah-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
  	$(gdb_wait_h) $(regcache_h)
--- 1748,1754 ----
  hppa-tdep.o: hppa-tdep.c $(defs_h) $(frame_h) $(bfd_h) $(inferior_h) \
  	$(value_h) $(regcache_h) $(completer_h) $(symtab_h) $(a_out_encap_h) \
  	$(gdb_stat_h) $(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) \
! 	$(symfile_h) $(objfiles_h) $(language_h) $(osabi_h)
  hppab-nat.o: hppab-nat.c $(defs_h) $(inferior_h) $(target_h) $(regcache_h)
  hppah-nat.o: hppah-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
  	$(gdb_wait_h) $(regcache_h)


More information about the Gdb-patches mailing list