This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] Remove macro DEPRECATED_FUNCTION_START_OFFSET
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Wed, 13 Jun 2007 21:04:07 +0200
- Subject: [rfc] Remove macro DEPRECATED_FUNCTION_START_OFFSET
Hello,
this patch completely removes macro DEPRECATED_FUNCTION_START_OFFSET. This macro is deprecated
and was replaced by gdbarch_convert_from_func_ptr_addr. Build and test on x86. Testsuite showed no regression.
ChangeLog:
* gdbarch.sh (DEPRECATED_FUNCTION_START_OFFSET): Remove.
* cli/cli-cmds.ci (disassemble_command): Replace
DEPRECATED_FUNCTION_START_OFFSET by gdbarch_convert_from_func_ptr_addr.
* symtab.c (skip_prologue_using_sal,find_function_start_sal): Likewise.
* linespec.c (minsym_found): Likewise.
(target.h): New include.
* infrun.c (handle_inferior_event): Likewise.
* infcall.c (find_function_addr): Likewise.
* Makefile.in (linespec.o): Update dependency to target.h.
* gdbarch.c, gdbarch.h: Regenerate.
Is this ok to commit?
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urN src/gdb/cli/cli-cmds.c dev/gdb/cli/cli-cmds.c
--- src/gdb/cli/cli-cmds.c 2007-02-27 20:46:04.000000000 +0100
+++ dev/gdb/cli/cli-cmds.c 2007-06-13 20:56:54.000000000 +0200
@@ -925,7 +925,8 @@
/* FIXME: cagney/2004-02-07: This should be an observer. */
low = tui_get_low_disassembly_address (low, pc);
#endif
- low += DEPRECATED_FUNCTION_START_OFFSET;
+ low = gdbarch_convert_from_func_ptr_addr
+ (current_gdbarch, low, ¤t_target);
}
else if (!(space_index = (char *) strchr (arg, ' ')))
{
@@ -940,7 +941,8 @@
/* FIXME: cagney/2004-02-07: This should be an observer. */
low = tui_get_low_disassembly_address (low, pc);
#endif
- low += DEPRECATED_FUNCTION_START_OFFSET;
+ low = gdbarch_convert_from_func_ptr_addr
+ (current_gdbarch, low, ¤t_target);
}
else
{
diff -urN src/gdb/gdbarch.c dev/gdb/gdbarch.c
--- src/gdb/gdbarch.c 2007-06-13 20:02:38.000000000 +0200
+++ dev/gdb/gdbarch.c 2007-06-13 20:37:04.000000000 +0200
@@ -197,7 +197,6 @@
gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint;
CORE_ADDR decr_pc_after_break;
- CORE_ADDR deprecated_function_start_offset;
gdbarch_remote_register_number_ftype *remote_register_number;
gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address;
CORE_ADDR frame_args_skip;
@@ -321,7 +320,6 @@
0, /* memory_insert_breakpoint */
0, /* memory_remove_breakpoint */
0, /* decr_pc_after_break */
- 0, /* deprecated_function_start_offset */
default_remote_register_number, /* remote_register_number */
0, /* fetch_tls_load_module_address */
0, /* frame_args_skip */
@@ -571,7 +569,6 @@
/* Skip verify of memory_insert_breakpoint, invalid_p == 0 */
/* Skip verify of memory_remove_breakpoint, invalid_p == 0 */
/* Skip verify of decr_pc_after_break, invalid_p == 0 */
- /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
/* Skip verify of remote_register_number, invalid_p == 0 */
/* Skip verify of fetch_tls_load_module_address, has predicate */
/* Skip verify of frame_args_skip, invalid_p == 0 */
@@ -759,14 +756,6 @@
fprintf_unfiltered (file,
"gdbarch_dump: deprecated_fp_regnum = %s\n",
paddr_d (current_gdbarch->deprecated_fp_regnum));
-#ifdef DEPRECATED_FUNCTION_START_OFFSET
- fprintf_unfiltered (file,
- "gdbarch_dump: DEPRECATED_FUNCTION_START_OFFSET # %s\n",
- XSTRING (DEPRECATED_FUNCTION_START_OFFSET));
-#endif
- fprintf_unfiltered (file,
- "gdbarch_dump: deprecated_function_start_offset = 0x%s\n",
- paddr_nz (current_gdbarch->deprecated_function_start_offset));
#ifdef DEPRECATED_REG_STRUCT_HAS_ADDR_P
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -2424,23 +2413,6 @@
gdbarch->decr_pc_after_break = decr_pc_after_break;
}
-CORE_ADDR
-gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_function_start_offset called\n");
- return gdbarch->deprecated_function_start_offset;
-}
-
-void
-set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch,
- CORE_ADDR deprecated_function_start_offset)
-{
- gdbarch->deprecated_function_start_offset = deprecated_function_start_offset;
-}
-
int
gdbarch_remote_register_number (struct gdbarch *gdbarch, int regno)
{
diff -urN src/gdb/gdbarch.h dev/gdb/gdbarch.h
--- src/gdb/gdbarch.h 2007-06-13 20:02:38.000000000 +0200
+++ dev/gdb/gdbarch.h 2007-06-13 20:36:54.000000000 +0200
@@ -551,23 +551,6 @@
extern CORE_ADDR gdbarch_decr_pc_after_break (struct gdbarch *gdbarch);
extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break);
-/* A function can be addressed by either it's "pointer" (possibly a
- descriptor address) or "entry point" (first executable instruction).
- The method "convert_from_func_ptr_addr" converting the former to the
- latter. DEPRECATED_FUNCTION_START_OFFSET is being used to implement
- a simplified subset of that functionality - the function's address
- corresponds to the "function pointer" and the function's start
- corresponds to the "function entry point" - and hence is redundant. */
-
-extern CORE_ADDR gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch, CORE_ADDR deprecated_function_start_offset);
-#if !defined (GDB_TM_FILE) && defined (DEPRECATED_FUNCTION_START_OFFSET)
-#error "Non multi-arch definition of DEPRECATED_FUNCTION_START_OFFSET"
-#endif
-#if !defined (DEPRECATED_FUNCTION_START_OFFSET)
-#define DEPRECATED_FUNCTION_START_OFFSET (gdbarch_deprecated_function_start_offset (current_gdbarch))
-#endif
-
/* Return the remote protocol register number associated with this
register. Normally the identity mapping. */
diff -urN src/gdb/gdbarch.sh dev/gdb/gdbarch.sh
--- src/gdb/gdbarch.sh 2007-06-13 20:02:38.000000000 +0200
+++ dev/gdb/gdbarch.sh 2007-06-13 20:36:45.000000000 +0200
@@ -549,16 +549,6 @@
f::int:memory_remove_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_remove_breakpoint::0
v::CORE_ADDR:decr_pc_after_break:::0:::0
-# A function can be addressed by either it's "pointer" (possibly a
-# descriptor address) or "entry point" (first executable instruction).
-# The method "convert_from_func_ptr_addr" converting the former to the
-# latter. DEPRECATED_FUNCTION_START_OFFSET is being used to implement
-# a simplified subset of that functionality - the function's address
-# corresponds to the "function pointer" and the function's start
-# corresponds to the "function entry point" - and hence is redundant.
-
-v:=:CORE_ADDR:deprecated_function_start_offset:::0:::0
-
# Return the remote protocol register number associated with this
# register. Normally the identity mapping.
m::int:remote_register_number:int regno:regno::default_remote_register_number::0
diff -urN src/gdb/infcall.c dev/gdb/infcall.c
--- src/gdb/infcall.c 2007-06-08 05:38:50.000000000 +0200
+++ dev/gdb/infcall.c 2007-06-13 20:54:51.000000000 +0200
@@ -232,7 +232,8 @@
if (retval_type != NULL)
*retval_type = value_type;
- return funaddr + DEPRECATED_FUNCTION_START_OFFSET;
+ return gdbarch_convert_from_func_ptr_addr
+ (current_gdbarch, funaddr, ¤t_target);
}
/* Call breakpoint_auto_delete on the current contents of the bpstat
diff -urN src/gdb/infrun.c dev/gdb/infrun.c
--- src/gdb/infrun.c 2007-06-11 11:31:57.000000000 +0200
+++ dev/gdb/infrun.c 2007-06-13 20:47:24.000000000 +0200
@@ -1806,7 +1806,9 @@
will both be 0 if it doesn't work. */
find_pc_partial_function (stop_pc, &ecs->stop_func_name,
&ecs->stop_func_start, &ecs->stop_func_end);
- ecs->stop_func_start += DEPRECATED_FUNCTION_START_OFFSET;
+ ecs->stop_func_start
+ = gdbarch_convert_from_func_ptr_addr
+ (current_gdbarch, ecs->stop_func_start, ¤t_target);
ecs->another_trap = 0;
bpstat_clear (&stop_bpstat);
stop_step = 0;
diff -urN src/gdb/linespec.c dev/gdb/linespec.c
--- src/gdb/linespec.c 2007-06-11 11:31:57.000000000 +0200
+++ dev/gdb/linespec.c 2007-06-13 20:49:31.000000000 +0200
@@ -38,6 +38,7 @@
#include "linespec.h"
#include "exceptions.h"
#include "language.h"
+#include "target.h"
/* We share this one with symtab.c, but it is not exported widely. */
@@ -1833,7 +1834,10 @@
values.sals[0].section = SYMBOL_BFD_SECTION (msymbol);
if (funfirstline)
{
- values.sals[0].pc += DEPRECATED_FUNCTION_START_OFFSET;
+ values.sals[0].pc
+ = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+ values.sals[0].pc,
+ ¤t_target);
values.sals[0].pc = gdbarch_skip_prologue
(current_gdbarch, values.sals[0].pc);
}
diff -urN src/gdb/Makefile.in dev/gdb/Makefile.in
--- src/gdb/Makefile.in 2007-06-13 20:32:46.000000000 +0200
+++ dev/gdb/Makefile.in 2007-06-13 20:50:38.000000000 +0200
@@ -2214,7 +2214,7 @@
linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
$(symfile_h) $(objfiles_h) $(source_h) $(demangle_h) $(value_h) \
$(completer_h) $(cp_abi_h) $(parser_defs_h) $(block_h) \
- $(objc_lang_h) $(linespec_h) $(exceptions_h)
+ $(objc_lang_h) $(linespec_h) $(exceptions_h) $(target_h)
linux-fork.o: linux-fork.c $(defs_h) $(inferior_h) $(regcache_h) $(gdbcmd_h) \
$(infcall_h) $(gdb_assert_h) $(gdb_string_h) $(linux_fork_h) \
$(linux_nat_h)
diff -urN src/gdb/symtab.c dev/gdb/symtab.c
--- src/gdb/symtab.c 2007-06-13 20:02:39.000000000 +0200
+++ dev/gdb/symtab.c 2007-06-13 20:55:53.000000000 +0200
@@ -2527,7 +2527,8 @@
!section_is_mapped (section))
pc = overlay_unmapped_address (pc, section);
- pc += DEPRECATED_FUNCTION_START_OFFSET;
+ pc = gdbarch_convert_from_func_ptr_addr
+ (current_gdbarch, pc, ¤t_target);
pc = gdbarch_skip_prologue (current_gdbarch, pc);
/* For overlays, map pc back into its mapped VMA range */
@@ -4101,7 +4102,8 @@
/* Get an initial range for the function. */
find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc);
- start_pc += DEPRECATED_FUNCTION_START_OFFSET;
+ start_pc = gdbarch_convert_from_func_ptr_addr
+ (current_gdbarch, start_pc, ¤t_target);
prologue_sal = find_pc_line (start_pc, 0);
if (prologue_sal.line != 0)