summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Earnshaw <richard.earnshaw@arm.com>2002-02-04 11:55:36 +0000
committerRichard Earnshaw <richard.earnshaw@arm.com>2002-02-04 11:55:36 +0000
commitb4d36c6176242f2563e9500b106a84bd0c94b3e7 (patch)
tree5e4b5a89fe43bc794647f1af0df321bee7c31270
parent2b2120170a82d0794f0e9a5ccb12cb331bf4c7a1 (diff)
downloadgdb-b4d36c6176242f2563e9500b106a84bd0c94b3e7.tar.gz
* gdbarch.sh (copyright): Update years in generated header.
(SMASH_TEXT_ADDRESS): Add rule. *gdbarch.h, gdbarch.c: Re-generate. * coffread.c: Multi-arch uses of SMASH_TEXT_ADDRESS. * dbxread.c: Likewise. * dwarfread.c: Likewise. * elfread.c: Likewise. * somread.c: Likewise. * arm-tdep.c (arm_smash_text_address): New function. * config/arm/tm-arm.h (SMASH_TEXT_ADDRESS): Define in terms of above.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/arm-tdep.c9
-rw-r--r--gdb/coffread.c7
-rw-r--r--gdb/config/arm/tm-arm.h11
-rw-r--r--gdb/dbxread.c6
-rw-r--r--gdb/dwarfread.c8
-rw-r--r--gdb/elfread.c6
-rw-r--r--gdb/gdbarch.c35
-rw-r--r--gdb/gdbarch.h22
-rwxr-xr-xgdb/gdbarch.sh7
-rw-r--r--gdb/somread.c30
11 files changed, 103 insertions, 52 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 135bdfc02ab..dce8cbc1cc7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2002-02-04 Richard Earnshaw <rearnsha@arm.com>
+
+ * gdbarch.sh (copyright): Update years in generated header.
+ (SMASH_TEXT_ADDRESS): Add rule.
+ *gdbarch.h, gdbarch.c: Re-generate.
+ * coffread.c: Multi-arch uses of SMASH_TEXT_ADDRESS.
+ * dbxread.c: Likewise.
+ * dwarfread.c: Likewise.
+ * elfread.c: Likewise.
+ * somread.c: Likewise.
+
+ * arm-tdep.c (arm_smash_text_address): New function.
+ * config/arm/tm-arm.h (SMASH_TEXT_ADDRESS): Define in terms of above.
+
2002-02-04 Pierre Muller <muller@ics.u-strasbg.fr>
Add support for hardware watchpoints on win32 native.
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 1539d0d17ec..f9ffa71b901 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -282,6 +282,7 @@ arm_pc_is_thumb_dummy (CORE_ADDR memaddr)
return 0;
}
+/* Remove useless bits from addresses in a running program. */
CORE_ADDR
arm_addr_bits_remove (CORE_ADDR val)
{
@@ -291,6 +292,14 @@ arm_addr_bits_remove (CORE_ADDR val)
return (val & (arm_apcs_32 ? 0xfffffffc : 0x03fffffc));
}
+/* When reading symbols, we need to zap the low bit of the address,
+ which may be set to 1 for Thumb functions. */
+CORE_ADDR
+arm_smash_text_address (CORE_ADDR val)
+{
+ return val & ~1;
+}
+
CORE_ADDR
arm_saved_pc_after_call (struct frame_info *frame)
{
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 69d06bae590..d8c5527a4c9 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1,6 +1,6 @@
/* Read coff symbol tables and convert to internal format, for GDB.
Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
- 1997, 1998, 1999, 2000, 2001
+ 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu).
@@ -944,10 +944,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
|| cs->c_sclass == C_THUMBEXT ?
mst_text : mst_file_text;
-#ifdef SMASH_TEXT_ADDRESS
- if (tmpaddr & 1) /* FIXME: delete this line */
- SMASH_TEXT_ADDRESS (tmpaddr);
-#endif
+ tmpaddr = SMASH_TEXT_ADDRESS (tmpaddr);
}
else if (sec == SECT_OFF_DATA (objfile))
{
diff --git a/gdb/config/arm/tm-arm.h b/gdb/config/arm/tm-arm.h
index 4a1648f5ccf..4f0f8d2ad94 100644
--- a/gdb/config/arm/tm-arm.h
+++ b/gdb/config/arm/tm-arm.h
@@ -34,16 +34,11 @@ struct value;
? &floatformat_ieee_double_big \
: &floatformat_ieee_double_littlebyte_bigword)
-/* When reading symbols, we need to zap the low bit of the address,
- which may be set to 1 for Thumb functions. */
-
-#define SMASH_TEXT_ADDRESS(addr) ((addr) &= ~0x1)
-
-/* Remove useless bits from addresses in a running program. */
+CORE_ADDR arm_smash_text_address(CORE_ADDR);
+#define SMASH_TEXT_ADDRESS(ADDR) arm_smash_text_address (ADDR)
CORE_ADDR arm_addr_bits_remove (CORE_ADDR);
-
-#define ADDR_BITS_REMOVE(val) (arm_addr_bits_remove (val))
+#define ADDR_BITS_REMOVE(VAL) arm_addr_bits_remove (VAL)
/* Offset from address of function to start of its code. Zero on most
machines. */
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 61bd930ed0a..e9c2a854afb 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1,6 +1,6 @@
/* Read dbx symbol tables and convert to internal format, for GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1997, 1998, 1999, 2000, 2001
+ 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GDB.
@@ -2759,9 +2759,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
/* Relocate for dynamic loading */
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
-#ifdef SMASH_TEXT_ADDRESS
- SMASH_TEXT_ADDRESS (valu);
-#endif
+ valu = SMASH_TEXT_ADDRESS (valu);
goto define_a_symbol;
case N_LBRAC:
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index d5a62cce2ba..dc72f87661d 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -1,6 +1,6 @@
/* DWARF debugging format support for GDB.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001
+ 2001, 2002
Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support. Portions based on dbxread.c,
mipsread.c, coffread.c, and dwarfread.c from a Data General SVR4 gdb port.
@@ -1952,11 +1952,9 @@ process_dies (char *thisdie, char *enddie, struct objfile *objfile)
{
nextdie = thisdie + di.die_length;
}
-#ifdef SMASH_TEXT_ADDRESS
/* I think that these are always text, not data, addresses. */
- SMASH_TEXT_ADDRESS (di.at_low_pc);
- SMASH_TEXT_ADDRESS (di.at_high_pc);
-#endif
+ di.at_low_pc = SMASH_TEXT_ADDRESS (di.at_low_pc);
+ di.at_high_pc = SMASH_TEXT_ADDRESS (di.at_high_pc);
switch (di.die_tag)
{
case TAG_compile_unit:
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 068d412b6e5..7d0fd03f884 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1,6 +1,6 @@
/* Read ELF (Executable and Linking Format) object files for GDB.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001
+ 2001, 2002
Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
@@ -173,10 +173,8 @@ record_minimal_symbol_and_info (char *name, CORE_ADDR address,
enum minimal_symbol_type ms_type, char *info, /* FIXME, is this really char *? */
asection *bfd_section, struct objfile *objfile)
{
-#ifdef SMASH_TEXT_ADDRESS
if (ms_type == mst_text || ms_type == mst_file_text)
- SMASH_TEXT_ADDRESS (address);
-#endif
+ address = SMASH_TEXT_ADDRESS (address);
return prim_record_minimal_symbol_and_info
(name, address, ms_type, info, bfd_section->index, bfd_section, objfile);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 0cc5a36104b..98da9916000 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -1,7 +1,7 @@
/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -250,6 +250,7 @@ struct gdbarch
const struct floatformat * long_double_format;
gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
gdbarch_addr_bits_remove_ftype *addr_bits_remove;
+ gdbarch_smash_text_address_ftype *smash_text_address;
gdbarch_software_single_step_ftype *software_single_step;
gdbarch_print_insn_ftype *print_insn;
gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
@@ -395,6 +396,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
generic_in_function_epilogue_p,
construct_inferior_arguments,
0,
@@ -505,6 +507,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->extra_stack_alignment_needed = 1;
current_gdbarch->convert_from_func_ptr_addr = core_addr_identity;
current_gdbarch->addr_bits_remove = core_addr_identity;
+ current_gdbarch->smash_text_address = core_addr_identity;
current_gdbarch->print_insn = legacy_print_insn;
current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
current_gdbarch->in_solib_call_trampoline = generic_in_solib_call_trampoline;
@@ -757,6 +760,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
gdbarch->long_double_format = &floatformat_unknown;
/* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
/* Skip verify of addr_bits_remove, invalid_p == 0 */
+ /* Skip verify of smash_text_address, invalid_p == 0 */
/* Skip verify of software_single_step, has predicate */
/* Skip verify of print_insn, invalid_p == 0 */
/* Skip verify of skip_trampoline_code, invalid_p == 0 */
@@ -1742,6 +1746,17 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->skip_trampoline_code
/*SKIP_TRAMPOLINE_CODE ()*/);
#endif
+#ifdef SMASH_TEXT_ADDRESS
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "SMASH_TEXT_ADDRESS(addr)",
+ XSTRING (SMASH_TEXT_ADDRESS (addr)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: SMASH_TEXT_ADDRESS = 0x%08lx\n",
+ (long) current_gdbarch->smash_text_address
+ /*SMASH_TEXT_ADDRESS ()*/);
+#endif
#ifdef SOFTWARE_SINGLE_STEP
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
@@ -4215,6 +4230,24 @@ set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch,
gdbarch->addr_bits_remove = addr_bits_remove;
}
+CORE_ADDR
+gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+ if (gdbarch->smash_text_address == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_smash_text_address invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_smash_text_address called\n");
+ return gdbarch->smash_text_address (addr);
+}
+
+void
+set_gdbarch_smash_text_address (struct gdbarch *gdbarch,
+ gdbarch_smash_text_address_ftype smash_text_address)
+{
+ gdbarch->smash_text_address = smash_text_address;
+}
+
int
gdbarch_software_single_step_p (struct gdbarch *gdbarch)
{
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index d3b6170fb97..b90a553551e 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1,7 +1,7 @@
/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -2040,6 +2040,26 @@ extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_
#endif
#endif
+/* It is not at all clear why SMASH_TEXT_ADDRESS is not folded into
+ ADDR_BITS_REMOVE. */
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (SMASH_TEXT_ADDRESS)
+#define SMASH_TEXT_ADDRESS(addr) (core_addr_identity (addr))
+#endif
+
+typedef CORE_ADDR (gdbarch_smash_text_address_ftype) (CORE_ADDR addr);
+extern CORE_ADDR gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr);
+extern void set_gdbarch_smash_text_address (struct gdbarch *gdbarch, gdbarch_smash_text_address_ftype *smash_text_address);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SMASH_TEXT_ADDRESS)
+#error "Non multi-arch definition of SMASH_TEXT_ADDRESS"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SMASH_TEXT_ADDRESS)
+#define SMASH_TEXT_ADDRESS(addr) (gdbarch_smash_text_address (current_gdbarch, addr))
+#endif
+#endif
+
/* FIXME/cagney/2001-01-18: This should be split in two. A target method that indicates if
the target needs software single step. An ISA method to implement it.
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 23998d5c9a6..766b74b6a6d 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1,7 +1,7 @@
#!/bin/sh -u
# Architecture commands for GDB, the GNU debugger.
-# Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -552,6 +552,9 @@ f:2:CONVERT_FROM_FUNC_PTR_ADDR:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR ad
# sort of generic thing to handle alignment or segmentation (it's
# possible it should be in TARGET_READ_PC instead).
f:2:ADDR_BITS_REMOVE:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr:::core_addr_identity::0
+# It is not at all clear why SMASH_TEXT_ADDRESS is not folded into
+# ADDR_BITS_REMOVE.
+f:2:SMASH_TEXT_ADDRESS:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr:::core_addr_identity::0
# FIXME/cagney/2001-01-18: This should be split in two. A target method that indicates if
# the target needs software single step. An ISA method to implement it.
#
@@ -642,7 +645,7 @@ cat <<EOF
/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/somread.c b/gdb/somread.c
index bab25d4d802..e4fec18ae62 100644
--- a/gdb/somread.c
+++ b/gdb/somread.c
@@ -1,5 +1,5 @@
/* Read HP PA/Risc object files for GDB.
- Copyright 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+ Copyright 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
@@ -157,9 +157,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
symname = bufp->name.n_strx + stringtab;
ms_type = mst_text;
bufp->symbol_value += text_offset;
-#ifdef SMASH_TEXT_ADDRESS
- SMASH_TEXT_ADDRESS (bufp->symbol_value);
-#endif
+ bufp->symbol_value = SMASH_TEXT_ADDRESS (bufp->symbol_value);
break;
case ST_ENTRY:
@@ -172,18 +170,14 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
else
ms_type = mst_text;
bufp->symbol_value += text_offset;
-#ifdef SMASH_TEXT_ADDRESS
- SMASH_TEXT_ADDRESS (bufp->symbol_value);
-#endif
+ bufp->symbol_value = SMASH_TEXT_ADDRESS (bufp->symbol_value);
break;
case ST_STUB:
symname = bufp->name.n_strx + stringtab;
ms_type = mst_solib_trampoline;
bufp->symbol_value += text_offset;
-#ifdef SMASH_TEXT_ADDRESS
- SMASH_TEXT_ADDRESS (bufp->symbol_value);
-#endif
+ bufp->symbol_value = SMASH_TEXT_ADDRESS (bufp->symbol_value);
break;
case ST_DATA:
@@ -211,9 +205,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
symname = bufp->name.n_strx + stringtab;
ms_type = mst_file_text;
bufp->symbol_value += text_offset;
-#ifdef SMASH_TEXT_ADDRESS
- SMASH_TEXT_ADDRESS (bufp->symbol_value);
-#endif
+ bufp->symbol_value = SMASH_TEXT_ADDRESS (bufp->symbol_value);
check_strange_names:
/* Utah GCC 2.5, FSF GCC 2.6 and later generate correct local
@@ -243,9 +235,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
symname = bufp->name.n_strx + stringtab;
ms_type = mst_file_text;
bufp->symbol_value += text_offset;
-#ifdef SMASH_TEXT_ADDRESS
- SMASH_TEXT_ADDRESS (bufp->symbol_value);
-#endif
+ bufp->symbol_value = SMASH_TEXT_ADDRESS (bufp->symbol_value);
break;
case ST_ENTRY:
@@ -258,18 +248,14 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
else
ms_type = mst_file_text;
bufp->symbol_value += text_offset;
-#ifdef SMASH_TEXT_ADDRESS
- SMASH_TEXT_ADDRESS (bufp->symbol_value);
-#endif
+ bufp->symbol_value = SMASH_TEXT_ADDRESS (bufp->symbol_value);
break;
case ST_STUB:
symname = bufp->name.n_strx + stringtab;
ms_type = mst_solib_trampoline;
bufp->symbol_value += text_offset;
-#ifdef SMASH_TEXT_ADDRESS
- SMASH_TEXT_ADDRESS (bufp->symbol_value);
-#endif
+ bufp->symbol_value = SMASH_TEXT_ADDRESS (bufp->symbol_value);
break;