Index: gdbarch.sh =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.sh,v retrieving revision 1.441 diff -u -p -r1.441 gdbarch.sh --- gdbarch.sh 3 Sep 2007 23:06:35 -0000 1.441 +++ gdbarch.sh 18 Sep 2007 22:37:31 -0000 @@ -652,6 +652,10 @@ F::void:skip_permanent_breakpoint:struct # Refresh overlay mapped state for section OSECT. F::void:overlay_update:struct obj_section *osect:osect + +# If defined, this function is called at the end of the creation +# of each symbol table and should build the associated line table. +F::void:buildsym_linetable_hook:void: EOF } Index: gdbarch.h =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.h,v retrieving revision 1.359 diff -u -p -r1.359 gdbarch.h --- gdbarch.h 3 Sep 2007 23:06:35 -0000 1.359 +++ gdbarch.h 18 Sep 2007 22:37:31 -0000 @@ -687,6 +687,15 @@ typedef void (gdbarch_overlay_update_fty extern void gdbarch_overlay_update (struct gdbarch *gdbarch, struct obj_section *osect); extern void set_gdbarch_overlay_update (struct gdbarch *gdbarch, gdbarch_overlay_update_ftype *overlay_update); +/* If defined, this function is called at the end of the creation + of each symbol table and should build the associated line table. */ + +extern int gdbarch_buildsym_linetable_hook_p (struct gdbarch *gdbarch); + +typedef void (gdbarch_buildsym_linetable_hook_ftype) (void); +extern void gdbarch_buildsym_linetable_hook (struct gdbarch *gdbarch); +extern void set_gdbarch_buildsym_linetable_hook (struct gdbarch *gdbarch, gdbarch_buildsym_linetable_hook_ftype *buildsym_linetable_hook); + extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); Index: gdbarch.c =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.c,v retrieving revision 1.403 diff -u -p -r1.403 gdbarch.c --- gdbarch.c 3 Sep 2007 23:06:35 -0000 1.403 +++ gdbarch.c 18 Sep 2007 22:37:31 -0000 @@ -230,6 +230,7 @@ struct gdbarch int vbit_in_delta; gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint; gdbarch_overlay_update_ftype *overlay_update; + gdbarch_buildsym_linetable_hook_ftype *buildsym_linetable_hook; }; @@ -352,6 +353,7 @@ struct gdbarch startup_gdbarch = 0, /* vbit_in_delta */ 0, /* skip_permanent_breakpoint */ 0, /* overlay_update */ + 0, /* buildsym_linetable_hook */ /* startup_gdbarch() */ }; @@ -599,6 +601,7 @@ verify_gdbarch (struct gdbarch *current_ /* Skip verify of vbit_in_delta, invalid_p == 0 */ /* Skip verify of skip_permanent_breakpoint, has predicate */ /* Skip verify of overlay_update, has predicate */ + /* Skip verify of buildsym_linetable_hook, has predicate */ buf = ui_file_xstrdup (log, &dummy); make_cleanup (xfree, buf); if (strlen (buf) > 0) @@ -684,6 +687,12 @@ gdbarch_dump (struct gdbarch *current_gd "gdbarch_dump: breakpoint_from_pc = <0x%lx>\n", (long) current_gdbarch->breakpoint_from_pc); fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_buildsym_linetable_hook_p() = %d\n", + gdbarch_buildsym_linetable_hook_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: buildsym_linetable_hook = <0x%lx>\n", + (long) current_gdbarch->buildsym_linetable_hook); + fprintf_unfiltered (file, "gdbarch_dump: byte_order = %s\n", paddr_d (current_gdbarch->byte_order)); fprintf_unfiltered (file, @@ -3001,6 +3010,30 @@ set_gdbarch_overlay_update (struct gdbar gdbarch->overlay_update = overlay_update; } +int +gdbarch_buildsym_linetable_hook_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->buildsym_linetable_hook != NULL; +} + +void +gdbarch_buildsym_linetable_hook (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->buildsym_linetable_hook != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_buildsym_linetable_hook called\n"); + gdbarch->buildsym_linetable_hook (); +} + +void +set_gdbarch_buildsym_linetable_hook (struct gdbarch *gdbarch, + gdbarch_buildsym_linetable_hook_ftype buildsym_linetable_hook) +{ + gdbarch->buildsym_linetable_hook = buildsym_linetable_hook; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ Index: buildsym.c =================================================================== RCS file: /cvs/src/src/gdb/buildsym.c,v retrieving revision 1.50 diff -u -p -r1.50 buildsym.c --- buildsym.c 23 Aug 2007 18:08:26 -0000 1.50 +++ buildsym.c 18 Sep 2007 22:37:08 -0000 @@ -933,10 +933,11 @@ end_symtab (CORE_ADDR end_addr, struct o &objfile->objfile_obstack); } -#ifndef PROCESS_LINENUMBER_HOOK -#define PROCESS_LINENUMBER_HOOK() -#endif - PROCESS_LINENUMBER_HOOK (); /* Needed for xcoff. */ + /* There are certain object formats such as XCOFF where we cannot + process the line table before having finished reading the debugging + info. If necessary, read the lineable now. */ + if (gdbarch_buildsym_linetable_hook_p (current_gdbarch)) + gdbarch_buildsym_linetable_hook (current_gdbarch); /* Now create the symtab objects proper, one for each subfile. */ /* (The main file is the last one on the chain.) */ Index: xcoffread.c =================================================================== RCS file: /cvs/src/src/gdb/xcoffread.c,v retrieving revision 1.54 diff -u -p -r1.54 xcoffread.c --- xcoffread.c 23 Aug 2007 18:08:47 -0000 1.54 +++ xcoffread.c 18 Sep 2007 22:38:23 -0000 @@ -55,6 +55,8 @@ /* For interface with stabsread.c. */ #include "aout/stab_gnu.h" +#include "xcoffread.h" + /* We put a pointer to this structure in the read_symtab_private field of the psymtab. */ Index: rs6000-aix-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/rs6000-aix-tdep.c,v retrieving revision 1.6 diff -u -p -r1.6 rs6000-aix-tdep.c --- rs6000-aix-tdep.c 30 Aug 2007 13:13:59 -0000 1.6 +++ rs6000-aix-tdep.c 18 Sep 2007 22:38:01 -0000 @@ -26,6 +26,7 @@ #include "regset.h" #include "rs6000-tdep.h" #include "ppc-tdep.h" +#include "xcoffread.h" /* Core file support. */ @@ -168,6 +169,12 @@ rs6000_aix_init_osabi (struct gdbarch_in /* Minimum possible text address in AIX. */ gdbarch_tdep (gdbarch)->text_segment_base = 0x10000000; + + /* In xcoff, we cannot process line numbers when we see them. This is + mainly because we don't know the boundaries of the include files. + So, we postpone that, and then enter and sort(?) the whole line table + at once, when we are closing the current symbol table in end_symtab(). */ + set_gdbarch_buildsym_linetable_hook (gdbarch, aix_process_linenos); } void Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.936 diff -u -p -r1.936 Makefile.in --- Makefile.in 5 Sep 2007 00:14:02 -0000 1.936 +++ Makefile.in 18 Sep 2007 22:36:51 -0000 @@ -836,6 +836,7 @@ vax_tdep_h = vax-tdep.h vec_h = vec.h $(gdb_assert_h) $(gdb_string_h) version_h = version.h wrapper_h = wrapper.h $(gdb_h) +xcoffread_h = xcoffread.h xcoffsolib_h = xcoffsolib.h xml_support_h = xml-support.h $(gdb_obstack_h) $(vec_h) xml_tdesc_h = xml-tdesc.h @@ -2539,7 +2540,8 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $ $(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \ $(frame_unwind_h) $(frame_base_h) $(rs6000_tdep_h) $(dwarf2_frame_h) rs6000-aix-tdep.o: rs6000-aix-tdep.c $(defs_h) $(gdb_string_h) $(osabi_h) \ - $(regcache_h) $(regset_h) $(rs6000_tdep_h) $(ppc_tdep_h) + $(regcache_h) $(regset_h) $(rs6000_tdep_h) $(ppc_tdep_h) \ + $(xcoffread_h) s390-nat.o: s390-nat.c $(defs_h) $(regcache_h) $(inferior_h) \ $(s390_tdep_h) $(target_h) $(linux_nat_h) s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \ @@ -2849,7 +2851,7 @@ xcoffread.o: xcoffread.c $(defs_h) $(bfd $(coff_internal_h) $(libcoff_h) $(coff_xcoff_h) $(libxcoff_h) \ $(coff_rs6000_h) $(symtab_h) $(gdbtypes_h) $(symfile_h) \ $(objfiles_h) $(buildsym_h) $(stabsread_h) $(expression_h) \ - $(complaints_h) $(gdb_stabs_h) $(aout_stab_gnu_h) + $(complaints_h) $(gdb_stabs_h) $(aout_stab_gnu_h) $(xcoffread_h) xcoffsolib.o: xcoffsolib.c $(defs_h) $(bfd_h) $(xcoffsolib_h) $(inferior_h) \ $(gdbcmd_h) $(symfile_h) $(frame_h) $(gdb_regex_h) xml-tdesc.o: xml-tdesc.c $(defs_h) $(target_h) $(target_descriptions_h) \ Index: config/powerpc/aix.mt =================================================================== RCS file: /cvs/src/src/gdb/config/powerpc/aix.mt,v retrieving revision 1.9 diff -u -p -r1.9 aix.mt --- config/powerpc/aix.mt 10 Feb 2006 20:56:15 -0000 1.9 +++ config/powerpc/aix.mt 18 Sep 2007 22:38:29 -0000 @@ -1,4 +1,3 @@ # Target: PowerPC running AIX TDEPFILES= rs6000-tdep.o rs6000-aix-tdep.o \ xcoffread.o ppc-sysv-tdep.o solib.o solib-svr4.o -DEPRECATED_TM_FILE= config/rs6000/tm-rs6000.h