diff options
-rw-r--r-- | gdb/ChangeLog | 14 | ||||
-rw-r--r-- | gdb/ada-lang.c | 2 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 2 | ||||
-rw-r--r-- | gdb/blockframe.c | 2 | ||||
-rw-r--r-- | gdb/cli/cli-cmds.c | 4 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdbint.texinfo | 18 | ||||
-rw-r--r-- | gdb/gdbarch.c | 36 | ||||
-rw-r--r-- | gdb/gdbarch.h | 22 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 13 | ||||
-rw-r--r-- | gdb/infcall.c | 2 | ||||
-rw-r--r-- | gdb/infrun.c | 2 | ||||
-rw-r--r-- | gdb/linespec.c | 2 | ||||
-rw-r--r-- | gdb/symtab.c | 4 | ||||
-rw-r--r-- | gdb/vax-tdep.c | 2 |
15 files changed, 83 insertions, 47 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 173bcd4541f..5ab245002e0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2004-06-18 Andrew Cagney <cagney@gnu.org> + + * gdbarch.sh (DEPRECATED_FUNCTION_START_OFFSET): Deprecated. + * gdbarch.h, gdbarch.c: Re-generate. + * ada-lang.c (ada_finish_decode_line_1): Update. + * infrun.c (handle_inferior_event): Update. + * infcall.c (find_function_addr): Update. + * linespec.c (minsym_found): Update. + * symtab.c (find_function_start_sal, skip_prologue_using_sal): + Update. + * blockframe.c (legacy_frameless_look_for_prologue): Update. + * cli/cli-cmds.c (disassemble_command): Update. + * vax-tdep.c (vax_gdbarch_init): Update. + 2004-06-18 Mark Kettenis <kettenis@gnu.org> * i386-tdep.c (i386_collect_fpregset): Fix comment. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 643eb939bec..c043a88f6ce 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -5596,7 +5596,7 @@ ada_finish_decode_line_1 (char **spec, struct symtab *file_table, val.section = SYMBOL_BFD_SECTION (msymbol); if (funfirstline) { - val.pc += FUNCTION_START_OFFSET; + val.pc += DEPRECATED_FUNCTION_START_OFFSET; SKIP_PROLOGUE (val.pc); } selected.sals = (struct symtab_and_line *) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 8122138e373..60101dd93ec 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -291,7 +291,7 @@ arm_frameless_function_invocation (struct frame_info *fi) stmdb sp!, {} sub sp, ip, #4. */ - func_start = (get_frame_func (fi) + FUNCTION_START_OFFSET); + func_start = (get_frame_func (fi) + DEPRECATED_FUNCTION_START_OFFSET); after_prologue = SKIP_PROLOGUE (func_start); /* There are some frameless functions whose first two instructions diff --git a/gdb/blockframe.c b/gdb/blockframe.c index b03395c678b..a9f0b60f447 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -147,7 +147,7 @@ legacy_frameless_look_for_prologue (struct frame_info *frame) func_start = get_frame_func (frame); if (func_start) { - func_start += FUNCTION_START_OFFSET; + func_start += DEPRECATED_FUNCTION_START_OFFSET; /* NOTE: cagney/2004-02-09: Eliminated per-architecture PROLOGUE_FRAMELESS_P call as architectures with custom implementations had all been deleted. Eventually even this diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 9378ac87064..3dfb303913b 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -858,7 +858,7 @@ disassemble_command (char *arg, int from_tty) /* FIXME: cagney/2004-02-07: This should be an observer. */ low = tui_get_low_disassembly_address (low, pc); #endif - low += FUNCTION_START_OFFSET; + low += DEPRECATED_FUNCTION_START_OFFSET; } else if (!(space_index = (char *) strchr (arg, ' '))) { @@ -873,7 +873,7 @@ disassemble_command (char *arg, int from_tty) /* FIXME: cagney/2004-02-07: This should be an observer. */ low = tui_get_low_disassembly_address (low, pc); #endif - low += FUNCTION_START_OFFSET; + low += DEPRECATED_FUNCTION_START_OFFSET; } else { diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 4427bd8b262..4f8218e8fff 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2004-06-18 Andrew Cagney <cagney@gnu.org> + + * gdbint.texinfo (Target Architecture Definition): Deprecate + FUNCTION_START_OFFSET. + 2004-06-14 Andrew Cagney <cagney@gnu.org> Based on changes from Karl Berry. diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index d1e054f9b0e..dbcb0b76a77 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -3260,20 +3260,20 @@ function end symbol is 0. For such targets, you must define @code{FUNCTION_EPILOGUE_SIZE} to expand into the standard size of a function's epilogue. -@item FUNCTION_START_OFFSET -@findex FUNCTION_START_OFFSET +@item DEPRECATED_FUNCTION_START_OFFSET +@findex DEPRECATED_FUNCTION_START_OFFSET An integer, giving the offset in bytes from a function's address (as used in the values of symbols, function pointers, etc.), and the function's first genuine instruction. This is zero on almost all machines: the function's address is usually -the address of its first instruction. However, on the VAX, for example, -each function starts with two bytes containing a bitmask indicating -which registers to save upon entry to the function. The VAX @code{call} -instructions check this value, and save the appropriate registers -automatically. Thus, since the offset from the function's address to -its first instruction is two bytes, @code{FUNCTION_START_OFFSET} would -be 2 on the VAX. +the address of its first instruction. However, on the VAX, for +example, each function starts with two bytes containing a bitmask +indicating which registers to save upon entry to the function. The +VAX @code{call} instructions check this value, and save the +appropriate registers automatically. Thus, since the offset from the +function's address to its first instruction is two bytes, +@code{DEPRECATED_FUNCTION_START_OFFSET} would be 2 on the VAX. @item GCC_COMPILED_FLAG_SYMBOL @itemx GCC2_COMPILED_FLAG_SYMBOL diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 26c7006246e..84d5b6d56d0 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -197,7 +197,7 @@ struct gdbarch gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint; gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint; CORE_ADDR decr_pc_after_break; - CORE_ADDR function_start_offset; + CORE_ADDR deprecated_function_start_offset; gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address; CORE_ADDR frame_args_skip; gdbarch_deprecated_frameless_function_invocation_ftype *deprecated_frameless_function_invocation; @@ -343,7 +343,7 @@ struct gdbarch startup_gdbarch = 0, /* memory_insert_breakpoint */ 0, /* memory_remove_breakpoint */ 0, /* decr_pc_after_break */ - 0, /* function_start_offset */ + 0, /* deprecated_function_start_offset */ generic_remote_translate_xfer_address, /* remote_translate_xfer_address */ 0, /* frame_args_skip */ 0, /* deprecated_frameless_function_invocation */ @@ -621,7 +621,7 @@ verify_gdbarch (struct gdbarch *current_gdbarch) /* 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 function_start_offset, invalid_p == 0 */ + /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */ /* Skip verify of remote_translate_xfer_address, invalid_p == 0 */ /* Skip verify of frame_args_skip, invalid_p == 0 */ /* Skip verify of deprecated_frameless_function_invocation, has predicate */ @@ -1084,6 +1084,14 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_frame_saved_pc /*DEPRECATED_FRAME_SAVED_PC ()*/); #endif +#ifdef DEPRECATED_FUNCTION_START_OFFSET + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FUNCTION_START_OFFSET # %s\n", + XSTRING (DEPRECATED_FUNCTION_START_OFFSET)); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FUNCTION_START_OFFSET = %ld\n", + (long) DEPRECATED_FUNCTION_START_OFFSET); +#endif #ifdef DEPRECATED_GET_SAVED_REGISTER_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1526,14 +1534,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) "gdbarch_dump: FRAME_RED_ZONE_SIZE = %d\n", FRAME_RED_ZONE_SIZE); #endif -#ifdef FUNCTION_START_OFFSET - fprintf_unfiltered (file, - "gdbarch_dump: FUNCTION_START_OFFSET # %s\n", - XSTRING (FUNCTION_START_OFFSET)); - fprintf_unfiltered (file, - "gdbarch_dump: FUNCTION_START_OFFSET = %ld\n", - (long) FUNCTION_START_OFFSET); -#endif #ifdef GET_LONGJMP_TARGET_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -3760,20 +3760,20 @@ set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, } CORE_ADDR -gdbarch_function_start_offset (struct gdbarch *gdbarch) +gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - /* Skip verify of function_start_offset, invalid_p == 0 */ + /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */ if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_function_start_offset called\n"); - return gdbarch->function_start_offset; + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_function_start_offset called\n"); + return gdbarch->deprecated_function_start_offset; } void -set_gdbarch_function_start_offset (struct gdbarch *gdbarch, - CORE_ADDR function_start_offset) +set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch, + CORE_ADDR deprecated_function_start_offset) { - gdbarch->function_start_offset = function_start_offset; + gdbarch->deprecated_function_start_offset = deprecated_function_start_offset; } void diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index b0f9f1403ff..01c5e1e2aae 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1312,13 +1312,21 @@ extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, CORE_ADDR #define DECR_PC_AFTER_BREAK (gdbarch_decr_pc_after_break (current_gdbarch)) #endif -extern CORE_ADDR gdbarch_function_start_offset (struct gdbarch *gdbarch); -extern void set_gdbarch_function_start_offset (struct gdbarch *gdbarch, CORE_ADDR function_start_offset); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FUNCTION_START_OFFSET) -#error "Non multi-arch definition of FUNCTION_START_OFFSET" -#endif -#if !defined (FUNCTION_START_OFFSET) -#define FUNCTION_START_OFFSET (gdbarch_function_start_offset (current_gdbarch)) +/* 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 (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && 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 typedef void (gdbarch_remote_translate_xfer_address_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 97f37992ab9..f3c438b26e7 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -583,8 +583,17 @@ M:ADJUST_BREAKPOINT_ADDRESS:CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr f:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0 f:MEMORY_REMOVE_BREAKPOINT:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0 v:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:::0 -v:FUNCTION_START_OFFSET:CORE_ADDR:function_start_offset::::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:DEPRECATED_FUNCTION_START_OFFSET:CORE_ADDR:deprecated_function_start_offset::::0:::0 + m:REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:regcache, gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0 # v:FRAME_ARGS_SKIP:CORE_ADDR:frame_args_skip::::0:::0 diff --git a/gdb/infcall.c b/gdb/infcall.c index 8123806e9f6..77c71eb262e 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -207,7 +207,7 @@ find_function_addr (struct value *function, struct type **retval_type) if (retval_type != NULL) *retval_type = value_type; - return funaddr + FUNCTION_START_OFFSET; + return funaddr + DEPRECATED_FUNCTION_START_OFFSET; } /* Call breakpoint_auto_delete on the current contents of the bpstat diff --git a/gdb/infrun.c b/gdb/infrun.c index 8aba9c134c4..4581646680c 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1817,7 +1817,7 @@ handle_inferior_event (struct execution_control_state *ecs) 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 += FUNCTION_START_OFFSET; + ecs->stop_func_start += DEPRECATED_FUNCTION_START_OFFSET; ecs->another_trap = 0; bpstat_clear (&stop_bpstat); stop_step = 0; diff --git a/gdb/linespec.c b/gdb/linespec.c index eedc671fd00..1371f028333 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1842,7 +1842,7 @@ minsym_found (int funfirstline, struct minimal_symbol *msymbol) values.sals[0].section = SYMBOL_BFD_SECTION (msymbol); if (funfirstline) { - values.sals[0].pc += FUNCTION_START_OFFSET; + values.sals[0].pc += DEPRECATED_FUNCTION_START_OFFSET; values.sals[0].pc = SKIP_PROLOGUE (values.sals[0].pc); } values.nelts = 1; diff --git a/gdb/symtab.c b/gdb/symtab.c index bbcad17e3e3..8fa7cecb7a5 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2413,7 +2413,7 @@ find_function_start_sal (struct symbol *sym, int funfirstline) !section_is_mapped (section)) pc = overlay_unmapped_address (pc, section); - pc += FUNCTION_START_OFFSET; + pc += DEPRECATED_FUNCTION_START_OFFSET; pc = SKIP_PROLOGUE (pc); /* For overlays, map pc back into its mapped VMA range */ @@ -3985,7 +3985,7 @@ skip_prologue_using_sal (CORE_ADDR func_addr) /* Get an initial range for the function. */ find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc); - start_pc += FUNCTION_START_OFFSET; + start_pc += DEPRECATED_FUNCTION_START_OFFSET; prologue_sal = find_pc_line (start_pc, 0); if (prologue_sal.line != 0) diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index e07f91f4474..f09d3e58abc 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -506,7 +506,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc); /* Misc info */ - set_gdbarch_function_start_offset (gdbarch, 2); + set_gdbarch_deprecated_function_start_offset (gdbarch, 2); set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_print_insn (gdbarch, print_insn_vax); |