Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC/commit] Getting rid of tm-rs6000.h (PROCESS_LINENUMBER_HOOK)
@ 2007-09-18 23:15 Joel Brobecker
  2007-09-20  6:10 ` Mark Kettenis
  0 siblings, 1 reply; 8+ messages in thread
From: Joel Brobecker @ 2007-09-18 23:15 UTC (permalink / raw)
  To: gdb-patches

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

Hello,

There is only one macro left in tm-rs6000.h, which is:

    /* 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(). */
    
    #define PROCESS_LINENUMBER_HOOK()       aix_process_linenos ()
    extern void aix_process_linenos (void);

The AIX port is the only port that defines this macro, and it's only
used in one place: buildsym.c:end_symtab(). I think the most appropriate
way to define this notion is as a gdbarch method, set only in the case
of AIX. This is what this patch does.

I must say that I am really bad at finding names. I did my best for
the name of the gdbarch method, but better suggestions would be very
much appreciated.

2007-09-18  Joel Brobecker  <brobecker@adacore.com>

        * gdbarch.sh: Add new buildsym_linetable_hook gdbarch function.
        * gdbarch.h, gdbarch.c: Regenerate.
        * buildsym.c (end_symtab): Replace use of PROCESS_LINENUMBER_HOOK
        by use of gdbarch_buildsym_linetable_hook.
        * xcoffread.h: New file.
        * xcoffread.c: Add include of xcoffread.h.
        * rs6000-aix-tdep.c: Add include of xcoffread.h.
        (rs6000_aix_init_osabi): Set buildsym_linetable_hook gdbarch function.
        * Makefile.in (xcoffread_h): New variable.
        (rs6000-aix-tdep.o): Add dependency on xcoffread.h.
        (xcoffread.o): Likewise.
        * config/powerpc/aix.mt (DEPRECATED_TM_FILE): Delete.
        * config/rs6000/tm-rs6000.h: Delete.

The associated documentation update is pretty straightforward.

2007-09-18  Joel Brobecker  <brobecker@adacore.com>

        * gdbint.texinfo (Target Conditionals): Remove documentation
        of PROCESS_LINENUMBER_HOOK.

This was tested on powerpc-aix. Does it look good?

Thanks,
-- 
Joel

[-- Attachment #2: aix-hook.diff --]
[-- Type: text/plain, Size: 9197 bytes --]

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"
+
 \f
 /* 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

[-- Attachment #3: xcoffread.h --]
[-- Type: text/plain, Size: 823 bytes --]

/* Copyright (C) 2007
   Free Software Foundation, Inc.

   This file is part of GDB.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#ifndef XCOFFREAD_H
#define XCOFFREAD_H

extern void aix_process_linenos (void);

#endif

[-- Attachment #4: aix-hook-doc.diff --]
[-- Type: text/plain, Size: 691 bytes --]

Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.266
diff -u -p -r1.266 gdbint.texinfo
--- doc/gdbint.texinfo	5 Jul 2007 12:22:32 -0000	1.266
+++ doc/gdbint.texinfo	18 Sep 2007 22:38:39 -0000
@@ -3846,10 +3846,6 @@ instead of value.
 This method replaces @code{DEPRECATED_REG_STRUCT_HAS_ADDR}
 (@pxref{DEPRECATED_REG_STRUCT_HAS_ADDR}).
 
-@item PROCESS_LINENUMBER_HOOK
-@findex PROCESS_LINENUMBER_HOOK
-A hook defined for XCOFF reading.
-
 @item gdbarch_ps_regnum (@var{gdbarch}
 @findex gdbarch_ps_regnum
 If defined, this function returns the number of the processor status

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC/commit] Getting rid of tm-rs6000.h (PROCESS_LINENUMBER_HOOK)
  2007-09-18 23:15 [RFC/commit] Getting rid of tm-rs6000.h (PROCESS_LINENUMBER_HOOK) Joel Brobecker
@ 2007-09-20  6:10 ` Mark Kettenis
  2007-09-20  6:37   ` Joel Brobecker
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2007-09-20  6:10 UTC (permalink / raw)
  To: brobecker; +Cc: gdb-patches

> X-Spam-Check-By: sourceware.org
> Date: Tue, 18 Sep 2007 16:14:48 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> Content-Disposition: inline
> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm
> Sender: gdb-patches-owner@sourceware.org
> X-UTwente-MailScanner-Information: Scanned by MailScanner. Contact helpdesk@ITBE.utwente.nl for more information.
> X-UTwente-MailScanner: Found to be clean
> X-UTwente-MailScanner-From: gdb-patches-return-50837-m.m.kettenis=alumnus.utwente.nl@sourceware.org
> X-Spam-Status: No
> X-XS4ALL-DNSBL-Checked: mxdrop3.xs4all.nl checked 130.89.2.13 against DNS blacklists
> X-Virus-Scanned: by XS4ALL Virus Scanner
> X-XS4ALL-Spam-Score: 0.0 () DK_POLICY_SIGNSOME
> X-XS4ALL-Spam: NO
> X-CNFS-Analysis: v=1.0 c=1 a=5JwuhGrhyVAA:15 a=wfEPs4U+lFiAFA7pH+G9TA==:17 a=g1VYcl7afDL033UujJkA:9 a=oUFSmlPX7ia-zx2J8jsA:7 a=z6PKJkvbTO3t5axyC61YUgDJBJkA:4 a=b8hG5vVbyAkA:10 a=-y93oKWw6PMAJfIIPkkA:9 a=-0FndLuy2frk9IRV2UEA:7 a=zN-x5g51XQPJfcUlamfUbFjiEO0A:4 a=WZm9NgPvBkYA:10 a=5WZzfXpOq_gA:10 a=mDV3o1hIAAAA:8 a=vsAYgGIN1YtluYDjcCgA:9 a=al0t3wDx9O-uvKBlVngA:7 a=wYDCVDzEO6LVr6XnfH29QgUVgCgA:4 a=w2AolMDZV5cA:10 a=bClMUFNdNt6jSyT-7-0A:9 a=ZmXWUAE7x0GZgUYmYHgA:7 a=l2b_aCW9KmR25YviF7on3GO03rkA:4
> Envelope-To: mark.kettenis@xs4all.nl
> X-UIDL: 1190157346._smtp.mxdrop3.27993,S=16710
> 
> 
> --lrZ03NoBR/3+SXJZ
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> Hello,
> 
> There is only one macro left in tm-rs6000.h, which is:
> 
>     /* 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(). */
>     
>     #define PROCESS_LINENUMBER_HOOK()       aix_process_linenos ()
>     extern void aix_process_linenos (void);
> 
> The AIX port is the only port that defines this macro, and it's only
> used in one place: buildsym.c:end_symtab(). I think the most appropriate
> way to define this notion is as a gdbarch method, set only in the case
> of AIX. This is what this patch does.

Hmm, if this is something that is purely for a specific object/debug format,
I think the gdbarch vector is the wrong place to put it.

Mark


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC/commit] Getting rid of tm-rs6000.h (PROCESS_LINENUMBER_HOOK)
  2007-09-20  6:10 ` Mark Kettenis
@ 2007-09-20  6:37   ` Joel Brobecker
  2007-09-20  9:04     ` Mark Kettenis
  2007-09-20 21:13     ` Joel Brobecker
  0 siblings, 2 replies; 8+ messages in thread
From: Joel Brobecker @ 2007-09-20  6:37 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

Hi Mark,

> > The AIX port is the only port that defines this macro, and it's only
> > used in one place: buildsym.c:end_symtab(). I think the most appropriate
> > way to define this notion is as a gdbarch method, set only in the case
> > of AIX. This is what this patch does.
> 
> Hmm, if this is something that is purely for a specific object/debug format,
> I think the gdbarch vector is the wrong place to put it.

Since the gdbarch vector is dependent on the ABI, we can set the method
when identifying XCOFF objects. That seemed the simplest approach at
the time.  But I agree that this is borderline. What do you think about
adding a new method inside struct sym_fns: 

        void (*sym_read_linetable) (void)

It would be null for all object formats except XCOFF.

I'll experiment with that... Thanks for your feedback!
-- 
Joel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC/commit] Getting rid of tm-rs6000.h (PROCESS_LINENUMBER_HOOK)
  2007-09-20  6:37   ` Joel Brobecker
@ 2007-09-20  9:04     ` Mark Kettenis
  2007-09-20 21:13     ` Joel Brobecker
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Kettenis @ 2007-09-20  9:04 UTC (permalink / raw)
  To: brobecker; +Cc: mark.kettenis, gdb-patches

> Date: Wed, 19 Sep 2007 23:37:14 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> 
> Hi Mark,
> 
> > > The AIX port is the only port that defines this macro, and it's only
> > > used in one place: buildsym.c:end_symtab(). I think the most appropriate
> > > way to define this notion is as a gdbarch method, set only in the case
> > > of AIX. This is what this patch does.
> > 
> > Hmm, if this is something that is purely for a specific object/debug format,
> > I think the gdbarch vector is the wrong place to put it.
> 
> Since the gdbarch vector is dependent on the ABI, we can set the method
> when identifying XCOFF objects. That seemed the simplest approach at
> the time.  But I agree that this is borderline. What do you think about
> adding a new method inside struct sym_fns: 
> 
>         void (*sym_read_linetable) (void)
> 
> It would be null for all object formats except XCOFF.
> 
> I'll experiment with that... Thanks for your feedback!

Seems like a better approach to me.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC/commit] Getting rid of tm-rs6000.h (PROCESS_LINENUMBER_HOOK)
  2007-09-20  6:37   ` Joel Brobecker
  2007-09-20  9:04     ` Mark Kettenis
@ 2007-09-20 21:13     ` Joel Brobecker
  2007-09-21  7:48       ` Mark Kettenis
  1 sibling, 1 reply; 8+ messages in thread
From: Joel Brobecker @ 2007-09-20 21:13 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

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

> What do you think about adding a new method inside struct sym_fns: 
> 
>         void (*sym_read_linetable) (void)
> 
> It would be null for all object formats except XCOFF.
> 
> I'll experiment with that... Thanks for your feedback!

Here is a patch that implements exactly this.

2007-09-20  Joel Brobecker  <brobecker@adacore.com>

        * symfile.h (struct sym_fns): Add new field sym_read_linetable.
        * coffread.c, dbxread.c, elfread.c, mipsread.c somread.c:
        Adjust the struct sym_fns object accordingly by setting
        the new field to NULL.
        * xcoffread.c (aix_process_linenos): Make static.
        (xcoff_sym_fns): Set new field to aix_process_linenos.
        * buildsym.c (end_symtab): Replace call to PROCESS_LINENUMBER_HOOK
        by call to new the new sym_fns sym_read_linetable function.
        * config/powerpc/aix.mt (DEPRECATED_TM_FILE): Delete.
        * config/rs6000/tm-rs6000.h: Delete.

Tested on powerpc-aix and x86-linux, no regression. Does it look good?

Thank you,
-- 
Joel

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

Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.40
diff -u -p -r1.40 symfile.h
--- symfile.h	23 Aug 2007 18:08:42 -0000	1.40
+++ symfile.h	20 Sep 2007 21:07:30 -0000
@@ -157,6 +157,11 @@ struct sym_fns
 
   struct symfile_segment_data *(*sym_segments) (bfd *abfd);
 
+  /* This function should read the linetable from the objfile when
+     the line table cannot be read while processing the debugging
+     information.  */
+  void (*sym_read_linetable) (void);
+
   /* Finds the next struct sym_fns.  They are allocated and
      initialized in whatever module implements the functions pointed
      to; an initializer calls add_symtab_fns to add them to the global
Index: coffread.c
===================================================================
RCS file: /cvs/src/src/gdb/coffread.c,v
retrieving revision 1.74
diff -u -p -r1.74 coffread.c
--- coffread.c	23 Aug 2007 18:08:27 -0000	1.74
+++ coffread.c	20 Sep 2007 20:22:11 -0000
@@ -2100,6 +2100,7 @@ static struct sym_fns coff_sym_fns =
   default_symfile_offsets,	/* sym_offsets:  xlate external to internal form */
   default_symfile_segments,	/* sym_segments: Get segment information from
 				   a file.  */
+  NULL,                         /* sym_read_linetable  */
   NULL				/* next: pointer to next struct sym_fns */
 };
 
Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.86
diff -u -p -r1.86 dbxread.c
--- dbxread.c	23 Aug 2007 18:08:28 -0000	1.86
+++ dbxread.c	20 Sep 2007 20:22:26 -0000
@@ -3513,6 +3513,7 @@ static struct sym_fns aout_sym_fns =
   default_symfile_offsets,	/* sym_offsets: parse user's offsets to internal form */
   default_symfile_segments,	/* sym_segments: Get segment information from
 				   a file.  */
+  NULL,                         /* sym_read_linetable */
   NULL				/* next: pointer to next struct sym_fns */
 };
 
Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.62
diff -u -p -r1.62 elfread.c
--- elfread.c	23 Aug 2007 18:08:28 -0000	1.62
+++ elfread.c	20 Sep 2007 20:22:33 -0000
@@ -813,6 +813,7 @@ static struct sym_fns elf_sym_fns =
   default_symfile_offsets,	/* sym_offsets:  Translate ext. to int. relocation */
   elf_symfile_segments,		/* sym_segments: Get segment information from
 				   a file.  */
+  NULL,                         /* sym_read_linetable */
   NULL				/* next: pointer to next struct sym_fns */
 };
 
Index: mipsread.c
===================================================================
RCS file: /cvs/src/src/gdb/mipsread.c,v
retrieving revision 1.24
diff -u -p -r1.24 mipsread.c
--- mipsread.c	23 Aug 2007 18:08:36 -0000	1.24
+++ mipsread.c	20 Sep 2007 20:23:19 -0000
@@ -394,6 +394,7 @@ static struct sym_fns ecoff_sym_fns =
   default_symfile_offsets,	/* sym_offsets: dummy FIXME til implem sym reloc */
   default_symfile_segments,	/* sym_segments: Get segment information from
 				   a file.  */
+  NULL,                         /* sym_read_linetable */
   NULL				/* next: pointer to next struct sym_fns */
 };
 
Index: somread.c
===================================================================
RCS file: /cvs/src/src/gdb/somread.c,v
retrieving revision 1.37
diff -u -p -r1.37 somread.c
--- somread.c	23 Aug 2007 18:08:38 -0000	1.37
+++ somread.c	20 Sep 2007 20:23:42 -0000
@@ -438,6 +438,7 @@ static struct sym_fns som_sym_fns =
   som_symfile_offsets,		/* sym_offsets:  Translate ext. to int. relocation */
   default_symfile_segments,	/* sym_segments: Get segment information from
 				   a file.  */
+  NULL,                         /* sym_read_linetable */
   NULL				/* next: pointer to next struct sym_fns */
 };
 
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	20 Sep 2007 20:24:11 -0000
@@ -727,7 +727,7 @@ return_after_cleanup:
   memset (&main_subfile, '\0', sizeof (struct subfile));
 }
 
-void
+static void
 aix_process_linenos (void)
 {
   /* process line numbers and enter them into line vector */
@@ -3012,6 +3012,7 @@ static struct sym_fns xcoff_sym_fns =
   xcoff_symfile_offsets,	/* sym_offsets: xlate offsets ext->int form */
   default_symfile_segments,	/* sym_segments: Get segment information from
 				   a file.  */
+  aix_process_linenos,          /* sym_read_linetable */
   NULL				/* next: pointer to next struct sym_fns */
 };
 
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	20 Sep 2007 20:22:08 -0000
@@ -933,10 +933,9 @@ 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. */
+  /* Read the line table if it has to be read separately.  */
+  if (objfile->sf->sym_read_linetable != NULL)
+    objfile->sf->sym_read_linetable ();
 
   /* Now create the symtab objects proper, one for each subfile.  */
   /* (The main file is the last one on the chain.)  */
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	20 Sep 2007 20:24:17 -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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC/commit] Getting rid of tm-rs6000.h (PROCESS_LINENUMBER_HOOK)
  2007-09-20 21:13     ` Joel Brobecker
@ 2007-09-21  7:48       ` Mark Kettenis
  2007-09-21 18:03         ` Joel Brobecker
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2007-09-21  7:48 UTC (permalink / raw)
  To: brobecker; +Cc: gdb-patches

> Date: Thu, 20 Sep 2007 14:13:11 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> 
> --+HP7ph2BbKc20aGI
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> > What do you think about adding a new method inside struct sym_fns: 
> > 
> >         void (*sym_read_linetable) (void)
> > 
> > It would be null for all object formats except XCOFF.
> > 
> > I'll experiment with that... Thanks for your feedback!
> 
> Here is a patch that implements exactly this.
> 
> 2007-09-20  Joel Brobecker  <brobecker@adacore.com>
> 
>         * symfile.h (struct sym_fns): Add new field sym_read_linetable.
>         * coffread.c, dbxread.c, elfread.c, mipsread.c somread.c:
>         Adjust the struct sym_fns object accordingly by setting
>         the new field to NULL.
>         * xcoffread.c (aix_process_linenos): Make static.
>         (xcoff_sym_fns): Set new field to aix_process_linenos.
>         * buildsym.c (end_symtab): Replace call to PROCESS_LINENUMBER_HOOK
>         by call to new the new sym_fns sym_read_linetable function.
>         * config/powerpc/aix.mt (DEPRECATED_TM_FILE): Delete.
>         * config/rs6000/tm-rs6000.h: Delete.
> 
> Tested on powerpc-aix and x86-linux, no regression. Does it look good?

Looks very good to me.

Mark


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC/commit] Getting rid of tm-rs6000.h (PROCESS_LINENUMBER_HOOK)
  2007-09-21  7:48       ` Mark Kettenis
@ 2007-09-21 18:03         ` Joel Brobecker
  2007-10-02 17:38           ` Ulrich Weigand
  0 siblings, 1 reply; 8+ messages in thread
From: Joel Brobecker @ 2007-09-21 18:03 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

> > 2007-09-20  Joel Brobecker  <brobecker@adacore.com>
> > 
> >         * symfile.h (struct sym_fns): Add new field sym_read_linetable.
> >         * coffread.c, dbxread.c, elfread.c, mipsread.c somread.c:
> >         Adjust the struct sym_fns object accordingly by setting
> >         the new field to NULL.
> >         * xcoffread.c (aix_process_linenos): Make static.
> >         (xcoff_sym_fns): Set new field to aix_process_linenos.
> >         * buildsym.c (end_symtab): Replace call to PROCESS_LINENUMBER_HOOK
> >         by call to new the new sym_fns sym_read_linetable function.
> >         * config/powerpc/aix.mt (DEPRECATED_TM_FILE): Delete.
> >         * config/rs6000/tm-rs6000.h: Delete.
> > 
> > Tested on powerpc-aix and x86-linux, no regression. Does it look good?
> 
> Looks very good to me.

Thanks a lot. I just checked this in, so one less tm file!
As of today, there are now only 8 left...

-- 
Joel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC/commit] Getting rid of tm-rs6000.h (PROCESS_LINENUMBER_HOOK)
  2007-09-21 18:03         ` Joel Brobecker
@ 2007-10-02 17:38           ` Ulrich Weigand
  0 siblings, 0 replies; 8+ messages in thread
From: Ulrich Weigand @ 2007-10-02 17:38 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Mark Kettenis, gdb-patches

Joel Brobecker wrote:

> Thanks a lot. I just checked this in, so one less tm file!
> As of today, there are now only 8 left...

Thanks for taking care of this!  Now that I'm back from
vacation I'll have a go at getting rid of some of the 
remaining ones ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-10-02 17:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-18 23:15 [RFC/commit] Getting rid of tm-rs6000.h (PROCESS_LINENUMBER_HOOK) Joel Brobecker
2007-09-20  6:10 ` Mark Kettenis
2007-09-20  6:37   ` Joel Brobecker
2007-09-20  9:04     ` Mark Kettenis
2007-09-20 21:13     ` Joel Brobecker
2007-09-21  7:48       ` Mark Kettenis
2007-09-21 18:03         ` Joel Brobecker
2007-10-02 17:38           ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox