This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc/rft] [1/3] Remove stabs target macros: VARIABLES_INSIDE_BLOCK
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 5 Oct 2007 20:05:13 +0200 (CEST)
- Subject: [rfc/rft] [1/3] Remove stabs target macros: VARIABLES_INSIDE_BLOCK
Hello,
this converts the VARIABLES_INSIDE_BLOCK target macro into a gdbarch callback.
Bye,
Ulrich
ChangeLog:
* gdbarch.sh (variables_inside_block): New gdbarch callback.
* gdbarch.c, gdbarch.h: Regenerate.
* dbxread.c (process_one_symbol): Use gdbarch_variables_inside_block
instead of VARIABLES_INSIDE_BLOCK.
* arm-tdep.c (arm_variables_inside_block): New function.
(arm_gdbarch_init): Install it.
* config/arm/embed.mt (DEPRECATED_TM_FILE): Remove.
* config/arm/linux.mt (DEPRECATED_TM_FILE): Remove.
* config/arm/wince.mt (DEPRECATED_TM_FILE): Remove.
* config/arm/tm-arm.h: Remove file.
doc/ChangeLog:
* gdbint.texinfo: Document gdbarch_variables_inside_block
instead of VARIABLES_INSIDE_BLOCK.
diff -urNp gdb-orig/gdb/arm-tdep.c gdb-head/gdb/arm-tdep.c
--- gdb-orig/gdb/arm-tdep.c 2007-10-05 14:54:59.000000000 +0200
+++ gdb-head/gdb/arm-tdep.c 2007-10-05 17:47:39.689478517 +0200
@@ -2653,6 +2653,15 @@ value_of_arm_user_reg (struct frame_info
const int *reg_p = baton;
return value_of_register (*reg_p, frame);
}
+
+/* Specify that for the native compiler variables for a particular
+ lexical context are listed after the beginning LBRAC instead of
+ before in the executables list of symbols. */
+static int
+arm_variables_inside_block (int desc, int gcc_p)
+{
+ return !gcc_p;
+}
static enum gdb_osabi
arm_elf_osabi_sniffer (bfd *abfd)
@@ -3001,6 +3010,9 @@ arm_gdbarch_init (struct gdbarch_info in
set_gdbarch_coff_make_msymbol_special (gdbarch,
arm_coff_make_msymbol_special);
+ /* Specical STABS overrides. */
+ set_gdbarch_variables_inside_block (gdbarch, arm_variables_inside_block);
+
/* Virtual tables. */
set_gdbarch_vbit_in_delta (gdbarch, 1);
diff -urNp gdb-orig/gdb/config/arm/embed.mt gdb-head/gdb/config/arm/embed.mt
--- gdb-orig/gdb/config/arm/embed.mt 2007-10-05 14:54:59.000000000 +0200
+++ gdb-head/gdb/config/arm/embed.mt 2007-10-05 17:47:39.736471747 +0200
@@ -1,6 +1,5 @@
# Target: ARM embedded system
TDEPFILES= arm-tdep.o
-DEPRECATED_TM_FILE= tm-arm.h
SIM_OBS = remote-sim.o
SIM = ../sim/arm/libsim.a
diff -urNp gdb-orig/gdb/config/arm/linux.mt gdb-head/gdb/config/arm/linux.mt
--- gdb-orig/gdb/config/arm/linux.mt 2007-10-05 14:54:59.000000000 +0200
+++ gdb-head/gdb/config/arm/linux.mt 2007-10-05 17:47:39.740471171 +0200
@@ -1,5 +1,4 @@
# Target: ARM based machine running GNU/Linux
-DEPRECATED_TM_FILE= tm-arm.h
TDEPFILES= arm-tdep.o arm-linux-tdep.o glibc-tdep.o solib.o \
solib-svr4.o solib-legacy.o symfile-mem.o \
corelow.o
diff -urNp gdb-orig/gdb/config/arm/tm-arm.h gdb-head/gdb/config/arm/tm-arm.h
--- gdb-orig/gdb/config/arm/tm-arm.h 2007-10-05 14:54:59.000000000 +0200
+++ gdb-head/gdb/config/arm/tm-arm.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,28 +0,0 @@
-/* Definitions to target GDB to ARM targets.
- Copyright 1986, 1987, 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 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 TM_ARM_H
-#define TM_ARM_H
-
-/* Specify that for the native compiler variables for a particular
- lexical context are listed after the beginning LBRAC instead of
- before in the executables list of symbols. */
-#define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p))
-
-#endif /* TM_ARM_H */
diff -urNp gdb-orig/gdb/config/arm/wince.mt gdb-head/gdb/config/arm/wince.mt
--- gdb-orig/gdb/config/arm/wince.mt 2007-10-05 14:54:59.000000000 +0200
+++ gdb-head/gdb/config/arm/wince.mt 2007-10-05 17:47:39.770466850 +0200
@@ -1,4 +1,3 @@
# Target: ARM based machine running Windows CE (win32)
-DEPRECATED_TM_FILE= tm-arm.h
TDEPFILES= arm-tdep.o arm-wince-tdep.o corelow.o \
solib.o solib-target.o
diff -urNp gdb-orig/gdb/dbxread.c gdb-head/gdb/dbxread.c
--- gdb-orig/gdb/dbxread.c 2007-10-05 14:55:00.000000000 +0200
+++ gdb-head/gdb/dbxread.c 2007-10-05 17:47:39.780465409 +0200
@@ -2655,6 +2655,8 @@ process_one_symbol (int type, int desc,
struct objfile *objfile)
{
struct context_stack *new;
+ int variables_inside_block;
+
/* This remembers the address of the start of a function. It is
used because in Solaris 2, N_LBRAC, N_RBRAC, and N_SLINE entries
are relative to the current function's start address. On systems
@@ -2799,13 +2801,16 @@ process_one_symbol (int type, int desc,
true. DESC is N_DESC from the N_RBRAC symbol. GCC_P is true
if we've detected the GCC_COMPILED_SYMBOL or the
GCC2_COMPILED_SYMBOL. */
-#if !defined (VARIABLES_INSIDE_BLOCK)
-#define VARIABLES_INSIDE_BLOCK(desc, gcc_p) 0
-#endif
+ if (gdbarch_variables_inside_block_p (current_gdbarch))
+ variables_inside_block
+ = gdbarch_variables_inside_block (current_gdbarch, desc,
+ processing_gcc_compilation);
+ else
+ variables_inside_block = 0;
/* Can only use new->locals as local symbols here if we're in
GCC or on a machine that puts them before the lbrack. */
- if (!VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))
+ if (!variables_inside_block)
{
if (local_symbols != NULL)
{
@@ -2816,7 +2821,7 @@ process_one_symbol (int type, int desc,
there are some compilers which legitimately put local
symbols within an LBRAC/RBRAC block; this complaint
might also help sort out problems in which
- VARIABLES_INSIDE_BLOCK is incorrectly defined. */
+ gdbarch_variables_inside_block is incorrectly defined. */
complaint (&symfile_complaints, _("\
misplaced N_LBRAC entry; discarding local symbols which have \
no enclosing block"));
@@ -2824,8 +2829,7 @@ no enclosing block"));
local_symbols = new->locals;
}
- if (context_stack_depth
- > !VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))
+ if (context_stack_depth > !variables_inside_block)
{
/* This is not the outermost LBRAC...RBRAC pair in the
function, its local symbols preceded it, and are the ones
@@ -2858,7 +2862,7 @@ no enclosing block"));
within_function = 0;
}
- if (VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))
+ if (variables_inside_block)
/* Now pop locals of block just finished. */
local_symbols = new->locals;
break;
diff -urNp gdb-orig/gdb/doc/gdbint.texinfo gdb-head/gdb/doc/gdbint.texinfo
--- gdb-orig/gdb/doc/gdbint.texinfo 2007-10-05 14:55:00.000000000 +0200
+++ gdb-head/gdb/doc/gdbint.texinfo 2007-10-05 17:47:39.842456479 +0200
@@ -4178,10 +4178,10 @@ This method has been deprecated in favou
Convert a value of type @var{type} into the raw contents of a register.
@xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}.
-@item VARIABLES_INSIDE_BLOCK (@var{desc}, @var{gcc_p})
-@findex VARIABLES_INSIDE_BLOCK
+@item int gdbarch_variables_inside_block (@var{desc}, @var{gcc_p})
+@findex gdbarch_variables_inside_block
For dbx-style debugging information, if the compiler puts variable
-declarations inside LBRAC/RBRAC blocks, this should be defined to be
+declarations inside LBRAC/RBRAC blocks, this should be defined to return
nonzero. @var{desc} is the value of @code{n_desc} from the
@code{N_RBRAC} symbol, and @var{gcc_p} is true if @value{GDBN} has noticed the
presence of either the @code{GCC_COMPILED_SYMBOL} or the
diff -urNp gdb-orig/gdb/gdbarch.c gdb-head/gdb/gdbarch.c
--- gdb-orig/gdb/gdbarch.c 2007-10-05 14:55:00.000000000 +0200
+++ gdb-head/gdb/gdbarch.c 2007-10-05 17:48:28.595880539 +0200
@@ -231,6 +231,7 @@ struct gdbarch
gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint;
gdbarch_overlay_update_ftype *overlay_update;
gdbarch_core_read_description_ftype *core_read_description;
+ gdbarch_variables_inside_block_ftype *variables_inside_block;
};
@@ -354,6 +355,7 @@ struct gdbarch startup_gdbarch =
0, /* skip_permanent_breakpoint */
0, /* overlay_update */
0, /* core_read_description */
+ 0, /* variables_inside_block */
/* startup_gdbarch() */
};
@@ -602,6 +604,7 @@ verify_gdbarch (struct gdbarch *current_
/* Skip verify of skip_permanent_breakpoint, has predicate */
/* Skip verify of overlay_update, has predicate */
/* Skip verify of core_read_description, has predicate */
+ /* Skip verify of variables_inside_block, has predicate */
buf = ui_file_xstrdup (log, &dummy);
make_cleanup (xfree, buf);
if (strlen (buf) > 0)
@@ -1038,6 +1041,12 @@ gdbarch_dump (struct gdbarch *current_gd
"gdbarch_dump: value_to_register = <0x%lx>\n",
(long) current_gdbarch->value_to_register);
fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_variables_inside_block_p() = %d\n",
+ gdbarch_variables_inside_block_p (current_gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: variables_inside_block = <0x%lx>\n",
+ (long) current_gdbarch->variables_inside_block);
+ fprintf_unfiltered (file,
"gdbarch_dump: vbit_in_delta = %s\n",
paddr_d (current_gdbarch->vbit_in_delta));
fprintf_unfiltered (file,
@@ -3034,6 +3043,30 @@ set_gdbarch_core_read_description (struc
gdbarch->core_read_description = core_read_description;
}
+int
+gdbarch_variables_inside_block_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->variables_inside_block != NULL;
+}
+
+int
+gdbarch_variables_inside_block (struct gdbarch *gdbarch, int desc, int gcc_p)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->variables_inside_block != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_variables_inside_block called\n");
+ return gdbarch->variables_inside_block (desc, gcc_p);
+}
+
+void
+set_gdbarch_variables_inside_block (struct gdbarch *gdbarch,
+ gdbarch_variables_inside_block_ftype variables_inside_block)
+{
+ gdbarch->variables_inside_block = variables_inside_block;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */
diff -urNp gdb-orig/gdb/gdbarch.h gdb-head/gdb/gdbarch.h
--- gdb-orig/gdb/gdbarch.h 2007-10-05 14:55:00.000000000 +0200
+++ gdb-head/gdb/gdbarch.h 2007-10-05 17:48:10.052758289 +0200
@@ -693,6 +693,16 @@ typedef const struct target_desc * (gdba
extern const struct target_desc * gdbarch_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd);
extern void set_gdbarch_core_read_description (struct gdbarch *gdbarch, gdbarch_core_read_description_ftype *core_read_description);
+/* Specify that for the native compiler variables for a particular
+ lexical context are listed after the beginning LBRAC instead of
+ before in the executables list of symbols. */
+
+extern int gdbarch_variables_inside_block_p (struct gdbarch *gdbarch);
+
+typedef int (gdbarch_variables_inside_block_ftype) (int desc, int gcc_p);
+extern int gdbarch_variables_inside_block (struct gdbarch *gdbarch, int desc, int gcc_p);
+extern void set_gdbarch_variables_inside_block (struct gdbarch *gdbarch, gdbarch_variables_inside_block_ftype *variables_inside_block);
+
extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
diff -urNp gdb-orig/gdb/gdbarch.sh gdb-head/gdb/gdbarch.sh
--- gdb-orig/gdb/gdbarch.sh 2007-10-05 14:55:00.000000000 +0200
+++ gdb-head/gdb/gdbarch.sh 2007-10-05 17:48:01.870740645 +0200
@@ -654,6 +654,11 @@ F::void:skip_permanent_breakpoint:struct
F::void:overlay_update:struct obj_section *osect:osect
M::const struct target_desc *:core_read_description:struct target_ops *target, bfd *abfd:target, abfd
+
+# Specify that for the native compiler variables for a particular
+# lexical context are listed after the beginning LBRAC instead of
+# before in the executables list of symbols.
+F::int:variables_inside_block:int desc, int gcc_p:desc, gcc_p
EOF
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com