From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [RFC/commit] Getting rid of tm-rs6000.h (PROCESS_LINENUMBER_HOOK)
Date: Tue, 18 Sep 2007 23:15:00 -0000 [thread overview]
Message-ID: <20070918231448.GS29127@adacore.com> (raw)
[-- 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
next reply other threads:[~2007-09-18 23:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 23:15 Joel Brobecker [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070918231448.GS29127@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox