diff options
author | nobody <> | 2003-04-06 14:50:16 +0000 |
---|---|---|
committer | nobody <> | 2003-04-06 14:50:16 +0000 |
commit | bad7deeefd1fa35f148ce755f6ee1e00c3c0d05e (patch) | |
tree | f9bc25c254c715345304fd1bf9568103817a20ae /gdb | |
parent | 56119ffba54ea99aed55aed353725346558b2696 (diff) | |
download | binutils-kettenis_i386newframe-20030406-branch.zip binutils-kettenis_i386newframe-20030406-branch.tar.gz binutils-kettenis_i386newframe-20030406-branch.tar.bz2 |
This commit was manufactured by cvs2svn to create branchkettenis_i386newframe-20030406-branchpointkettenis_i386newframe-20030406-branch
'kettenis_i386newframe-20030406-branch'.
Sprout from cagney_frameaddr-20030403-branch 2003-04-03 16:34:49 UTC nobody 'This commit was manufactured by cvs2svn to create branch'
Cherrypick from master 2003-04-06 14:50:15 UTC Andrew Cagney <cagney@redhat.com> '2003-04-06 Andrew Cagney <cagney@redhat.com>':
bfd/ChangeLog
bfd/archures.c
bfd/bfd-in2.h
bfd/coff-tic4x.c
bfd/cpu-tic4x.c
bfd/elf32-m68hc11.c
bfd/simple.c
bfd/version.h
gdb/ChangeLog
gdb/Makefile.in
gdb/arm-tdep.c
gdb/blockframe.c
gdb/config/i386/tm-ptx.h
gdb/config/pa/tm-hppa.h
gdb/config/pa/tm-hppa64.h
gdb/config/pa/tm-hppah.h
gdb/config/sparc/tm-sparc.h
gdb/cris-tdep.c
gdb/d10v-tdep.c
gdb/dummy-frame.c
gdb/frame-unwind.h
gdb/frame.c
gdb/frame.h
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/hppa-hpux-tdep.c
gdb/hppa-tdep.c
gdb/i386-tdep.c
gdb/ia64-tdep.c
gdb/m68k-tdep.c
gdb/objc-lang.c
gdb/remote-vxsparc.c
gdb/rs6000-tdep.c
gdb/s390-tdep.c
gdb/sentinel-frame.c
gdb/sh-tdep.c
gdb/sparc-tdep.c
gdb/stack.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/break.exp
gdb/valprint.c
gdb/version.in
gdb/x86-64-tdep.c
include/ChangeLog
include/coff/tic4x.h
include/opcode/tic4x.h
opcodes/ChangeLog
opcodes/tic4x-dis.c
sim/v850/ChangeLog
sim/v850/simops.c
sim/v850/simops.h
sim/v850/v850.igen
Diffstat (limited to 'gdb')
35 files changed, 498 insertions, 385 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e5d2ce6..8652060 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,155 @@ +2003-04-06 Andrew Cagney <cagney@redhat.com> + + * valprint.c (val_print_type_code_int): Delete #ifdef + PRINT_TYPELESS_INTEGER code. + + * gdbarch.sh (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) + (CALL_DUMMY_LOCATION, DEPRECATED_PC_IN_CALL_DUMMY): Allow partial + multi-arch definition. + * gdbarch.h: Re-generate. + +2003-04-05 Andrew Cagney <cagney@redhat.com> + + Eliminate FRAME_FIND_SAVED_REGS. + * config/pa/tm-hppah.h (hppa_hpux_frame_find_saved_regs_in_sigtramp): + Change FSR parameter to a pointer. + * config/pa/tm-hppa64.h (FRAME_FIND_SAVED_REGS_IN_SIGTRAMP): + Assume FSR parameter is a pointer. + * hppa-hpux-tdep.c (hppa_hpux_frame_find_saved_regs_in_sigtramp): + Make fsr a pointer. + * hppa-tdep.c (hppa_frame_find_saved_regs): New function. + (hppa_frame_saved_pc): Call hppa_frame_init_saved_regs. Make + saved_regs a pointer. + (hppa_frame_saved_pc): Ditto. + (find_dummy_frame_regs): Make frame_saved_regs a pointer + (hppa_pop_frame): Call hppa_frame_init_saved_regs. Make fsr a + pointer. + (restore_pc_queue): Make fsr a pointer. + (hppa_frame_find_saved_regs): Make frame_saved_regs a pointer. + (hppa_frame_chain): Make saved_regs a pointer, call + hppa_frame_init_saved_regs. + * sparc-tdep.c: Include "gdb_assert.h". + (sparc_frame_find_saved_regs): Replace internal_error with + gdb_assert. + * remote-vxsparc.c (vx_read_register): Delete reference to + FRAME_FIND_SAVED_REGS. + * gdbarch.sh: Delete check for FRAME_FIND_SAVED_REGS. + * gdbarch.h: Regenerate. + * frame.h (DEPRECATED_FRAME_INIT_SAVED_REGS): Delete macro. + (deprecated_get_frame_saved_regs): Delete declaration. + (struct frame_saved_regs): Delete definition. + * frame.c (deprecated_get_frame_saved_regs): Delete function. + * config/pa/tm-hppa.h (hppa_frame_init_saved_regs): Declare. + (hppa_frame_find_saved_regs): Delete declaration. + (FRAME_FIND_SAVED_REGS): Delete macro. + (DEPRECATED_FRAME_INIT_SAVED_REGS): Define. + * config/i386/tm-ptx.h (FRAME_FIND_SAVED_REGS): Delete + FRAME_FIND_SAVED_REGS in comment. + +2003-04-05 Andrew Cagney <cagney@redhat.com> + + * frame.c (frame_func_unwind, get_frame_func): New functions. + * frame.h (get_frame_func, frame_func_unwind): Declare. + (struct frame_info): Add field "prev_func" for caching the + previous frame's function address. + * arm-tdep.c (arm_frameless_function_invocation): Combine + get_pc_function_start and get_frame_pc into get_frame_func. + * sh-tdep.c (sh_nofp_frame_init_saved_regs): Ditto. + (sh64_nofp_frame_init_saved_regs): Ditto. + * s390-tdep.c (s390_function_start): Ditto. + * rs6000-tdep.c (rs6000_pop_frame): Ditto. + (rs6000_frameless_function_invocation): Ditto. + (rs6000_frame_saved_pc): Ditto. + * m68k-tdep.c (m68k_frame_init_saved_regs): Ditto. + * ia64-tdep.c (ia64_frame_init_saved_regs): Ditto. + * i386-tdep.c (i386_frameless_signal_p): Ditto. + (i386_frame_init_saved_regs): Ditto. + * hppa-tdep.c (hppa_frame_find_saved_regs): Ditto. + * d10v-tdep.c (d10v_frame_unwind_cache): Combine + get_pc_function_start and frame_pc_unwind into frame_func_unwind. + * cris-tdep.c (cris_frame_init_saved_regs): Ditto. + * blockframe.c (frameless_look_for_prologue): Ditto. + +2003-04-05 Andrew Cagney <cagney@redhat.com> + + * frame.c (legacy_get_prev_frame): Link prev to next at the + function start. Update comments. + +2003-04-05 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_frame_id): Update comment. + (legacy_get_prev_frame): Update comment. + * gdbarch.sh: Delete check for EXTRA_FRAME_INFO. + * gdbarch.h: Regenerate. + * config/sparc/tm-sparc.h (EXTRA_FRAME_INFO): Delete. + * frame.h: Delete #ifdef EXTRA_FRAME_INFO code. + +2003-04-05 Andrew Cagney <cagney@redhat.com> + + * stack.c (print_frame_info): Use get_frame_pc. + +2003-04-04 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_prev_frame): Do not call frame_type_from_pc. Set + the frame's type from the unwinder. + (get_frame_type): Map UNKNOWN_FRAME onto NORMAL_FRAME. + (create_new_frame, legacy_get_prev_frame): When the unwinder's + type isn't UNKNOWN_FRAME, initalize "type" from the unwinder. + (get_frame_base_address): Use get_frame_type. + (get_frame_locals_address, get_frame_args_address): Ditto. + (legacy_saved_regs_unwinder): Set the type to UNKNOWN_TYPE. + * frame.h (enum frame_type): Add UNKNOWN_FRAME. + (struct frame_info): Add comment explaining why the frame contains + a "type" field. + * dummy-frame.c (dummy_frame_unwind): Set the type to DUMMY_FRAME. + * d10v-tdep.c (d10v_frame_unwind): Set the type to NORMAL_FRAME. + * sentinel-frame.c (sentinel_frame_unwinder): Set the type to + NORMAL_FRAME. + * frame-unwind.h: Include "frame.h". + (struct frame_unwind): Add "type" field. + * Makefile.in (frame_unwind_h): Add $(frame_h). + +2003-04-04 Andrew Cagney <cagney@redhat.com> + + * x86-64-tdep.c (x86_64_unwind_dummy_id): Use frame_id_build. + * dummy-frame.c (dummy_frame_this_id): Use frame_id_build. + * d10v-tdep.c (d10v_frame_this_id): Use get_frame_pc and + get_frame_base. + (d10v_unwind_dummy_id): Use frame_id_build. + * frame.c (find_frame_sal): Use get_frame_pc. + (create_new_frame): Use deprecated_update_frame_pc_hack and + deprecated_update_frame_base_hack. + (create_sentinel_frame): Add comment about ->pc going away. + (get_prev_frame): Add comment about ->pc going away. + (legacy_get_prev_frame): Use get_frame_base, get_frame_pc, + frame_id_build, deprecated_update_frame_pc_hack and + deprecated_update_frame_base_hack. + (select_frame): Use get_frame_pc. + (legacy_saved_regs_this_id): Use frame_id_build. + +2003-04-04 Elena Zannoni <ezannoni@redhat.com> + + * x86-64-tdep.c (x86_64_push_arguments): Handle correctly the + signed integer case. + (classify_argument): Handle enumerations and references. + +2003-04-04 Andrew Cagney <cagney@redhat.com> + + * frame.c (create_sentinel_frame): Initialize the sentinel frame's + ID to NULL. + +2003-04-01 Adam Fedor <fedor@gnu.org> + + * gdb/objc-lang.c (selectors_info): Replace calls to + SYMBOL_DEMANGLED_NAME and DEPRECATED_SYMBOL_NAME with + SYMBOL_NATURAL_NAME. + (classes_info, find_methods): Likewise. + +2003-04-03 Kevin Buettner <kevinb@redhat.com> + + * rs6000-tdep.c (rs6000_gdbarch_init): For xcoff executables, set + ``mach'' to the value determined by bfd_default_set_arch_mach(). + 2003-04-02 Bob Rossi <bob_rossi@cox.net> * Makefile.in (SUBDIR_MI_OBS): Add "mi-cmd-file.o". diff --git a/gdb/Makefile.in b/gdb/Makefile.in index c5ba5d8..21255fe 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -641,7 +641,7 @@ event_top_h = event-top.h expression_h = expression.h $(symtab_h) $(doublest_h) f_lang_h = f-lang.h frame_h = frame.h -frame_unwind_h = frame-unwind.h +frame_unwind_h = frame-unwind.h $(frame_h) frame_base_h = frame-base.h gdb_events_h = gdb-events.h gdb_stabs_h = gdb-stabs.h @@ -2208,9 +2208,9 @@ sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(regcache_h) $(gregset_h) sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(regcache_h) $(gdb_wait_h) sparc-stub.o: sparc-stub.c -sparc-tdep.o: sparc-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \ - $(inferior_h) $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) \ - $(regcache_h) $(osabi_h) $(gregset_h) $(gdbcore_h) $(symfile_h) +sparc-tdep.o: sparc-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \ + $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) $(regcache_h) \ + $(osabi_h) $(gregset_h) $(gdbcore_h) $(gdb_assert_h) $(symfile_h) sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ $(sparcnbsd_tdep_h) sparcl-stub.o: sparcl-stub.c diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 21d8488..5d8c538 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -295,7 +295,7 @@ arm_frameless_function_invocation (struct frame_info *fi) stmdb sp!, {} sub sp, ip, #4. */ - func_start = (get_pc_function_start (get_frame_pc (fi)) + FUNCTION_START_OFFSET); + func_start = (get_frame_func (fi)) + FUNCTION_START_OFFSET); after_prologue = SKIP_PROLOGUE (func_start); /* There are some frameless functions whose first two instructions @@ -1383,7 +1383,7 @@ push_stack_item (struct stack_item *prev, void *contents, int len) { struct stack_item *si; si = xmalloc (sizeof (struct stack_item)); - si->data = malloc (len); + si->data = xmalloc (len); si->len = len; si->prev = prev; memcpy (si->data, contents, len); diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 364be9e..cf691a3 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -146,7 +146,7 @@ frameless_look_for_prologue (struct frame_info *frame) { CORE_ADDR func_start, after_prologue; - func_start = get_pc_function_start (get_frame_pc (frame)); + func_start = get_frame_func (frame); if (func_start) { func_start += FUNCTION_START_OFFSET; diff --git a/gdb/config/i386/tm-ptx.h b/gdb/config/i386/tm-ptx.h index 80026e3..2f2bba3 100644 --- a/gdb/config/i386/tm-ptx.h +++ b/gdb/config/i386/tm-ptx.h @@ -191,10 +191,4 @@ extern const struct floatformat floatformat_i387_ext; /* from floatformat.h */ #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ symmetry_extract_return_value(TYPE, REGBUF, VALBUF) -/* - #undef FRAME_FIND_SAVED_REGS - #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ - { ptx_frame_find_saved_regs((frame_info), &(frame_saved_regs)); } - */ - #endif /* ifndef TM_PTX_H */ diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index 9c26c79..6089b32 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -441,11 +441,9 @@ extern int hppa_frame_num_args (struct frame_info *frame); #define FRAME_ARGS_SKIP 0 #endif -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ - hppa_frame_find_saved_regs (frame_info, &frame_saved_regs) -extern void hppa_frame_find_saved_regs (struct frame_info *, - struct frame_saved_regs *); - +extern void hppa_frame_init_saved_regs (struct frame_info *); +#define DEPRECATED_FRAME_INIT_SAVED_REGS(FI) \ + hppa_frame_init_saved_regs (FI) /* Things needed for making the inferior call functions. */ diff --git a/gdb/config/pa/tm-hppa64.h b/gdb/config/pa/tm-hppa64.h index b2b98e4..503e426 100644 --- a/gdb/config/pa/tm-hppa64.h +++ b/gdb/config/pa/tm-hppa64.h @@ -312,11 +312,11 @@ call_dummy for (i = 0; i < NUM_REGS; i++) \ { \ if (i == SP_REGNUM) \ - (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP1 + SP_REGNUM * 8, 8); \ + (FSR)[SP_REGNUM] = read_memory_integer (TMP1 + SP_REGNUM * 8, 8); \ else if (i >= FP0_REGNUM) \ - (FSR)->regs[i] = TMP2 + (i - FP0_REGNUM) * 8; \ + (FSR)[i] = TMP2 + (i - FP0_REGNUM) * 8; \ else \ - (FSR)->regs[i] = TMP1 + i * 8; \ + (FSR)[i] = TMP1 + i * 8; \ } \ } diff --git a/gdb/config/pa/tm-hppah.h b/gdb/config/pa/tm-hppah.h index 4e68de9..5a457a9 100644 --- a/gdb/config/pa/tm-hppah.h +++ b/gdb/config/pa/tm-hppah.h @@ -46,9 +46,8 @@ extern void hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi, #define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \ hppa_hpux_frame_base_before_sigtramp (FRAME, TMP) -struct frame_saved_regs; extern void hppa_hpux_frame_find_saved_regs_in_sigtramp - (struct frame_info *fi, struct frame_saved_regs *fsr); + (struct frame_info *fi, CORE_ADDR *fsr); #define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \ hppa_hpux_frame_find_saved_regs_in_sigtramp (FRAME, FSR) diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index ef39962..544a562 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -406,53 +406,6 @@ extern CORE_ADDR sparc_pc_adjust (CORE_ADDR); /* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces the frame's chain-pointer. */ -/* In the case of the Sun 4, the frame-chain's nominal address - is held in the frame pointer register. - - On the Sun4, the frame (in %fp) is %sp for the previous frame. - From the previous frame's %sp, we can find the previous frame's - %fp: it is in the save area just above the previous frame's %sp. - - If we are setting up an arbitrary frame, we'll need to know where - it ends. Hence the following. This part of the frame cache - structure should be checked before it is assumed that this frame's - bottom is in the stack pointer. - - If there isn't a frame below this one, the bottom of this frame is - in the stack pointer. - - If there is a frame below this one, and the frame pointers are - identical, it's a leaf frame and the bottoms are the same also. - - Otherwise the bottom of this frame is the top of the next frame. - - The bottom field is misnamed, since it might imply that memory from - bottom to frame contains this frame. That need not be true if - stack frames are allocated in different segments (e.g. some on a - stack, some on a heap in the data segment). - - GCC 2.6 and later can generate ``flat register window'' code that - makes frames by explicitly saving those registers that need to be - saved. %i7 is used as the frame pointer, and the frame is laid out - so that flat and non-flat calls can be intermixed freely within a - program. Unfortunately for GDB, this means it must detect and - record the flatness of frames. - - Since the prologue in a flat frame also tells us where fp and pc - have been stashed (the frame is of variable size, so their location - is not fixed), it's convenient to record them in the frame info. */ - -#define EXTRA_FRAME_INFO \ - CORE_ADDR bottom; \ - int in_prologue; \ - int flat; \ - /* Following fields only relevant for flat frames. */ \ - CORE_ADDR pc_addr; \ - CORE_ADDR fp_addr; \ - /* Add this to ->frame to get the value of the stack pointer at the */ \ - /* time of the register saves. */ \ - int sp_offset; - /* We need to override DEPRECATED_GET_SAVED_REGISTER so that we can deal with the way outs change into ins in different frames. */ diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 4f9ee9b..2258a17 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -1178,7 +1178,7 @@ cris_frame_init_saved_regs (struct frame_info *fi) } else { - ip = get_pc_function_start (get_frame_pc (fi)); + ip = get_frame_func (fi); sal = find_pc_line (ip, 0); /* If there is no symbol information then sal.end == 0, and we end up diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 9d56169..5e94de4 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -720,7 +720,7 @@ d10v_frame_unwind_cache (struct frame_info *next_frame, info->sp_offset = 0; info->uses_frame = 0; - for (pc = get_pc_function_start (frame_pc_unwind (next_frame)); + for (pc = frame_func_unwind (next_frame); pc < frame_pc_unwind (next_frame); pc += 4) { @@ -1474,8 +1474,8 @@ d10v_frame_this_id (struct frame_info *next_frame, compare the frame's PC value. */ if (frame_relative_level (next_frame) >= 0 && get_frame_type (next_frame) != DUMMY_FRAME - && get_frame_id (next_frame).pc == pc - && get_frame_id (next_frame).base == base) + && get_frame_pc (next_frame) == pc + && get_frame_base (next_frame) == base) return; (*this_id) = frame_id_build (base, pc); @@ -1553,6 +1553,7 @@ d10v_frame_prev_register (struct frame_info *next_frame, } static const struct frame_unwind d10v_frame_unwind = { + NORMAL_FRAME, d10v_frame_this_id, d10v_frame_prev_register }; @@ -1587,11 +1588,8 @@ static struct frame_id d10v_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) { ULONGEST base; - struct frame_id id; - id.pc = frame_pc_unwind (next_frame); frame_unwind_unsigned_register (next_frame, SP_REGNUM, &base); - id.base = d10v_make_daddr (base); - return id; + return frame_id_build (d10v_make_daddr (base), frame_pc_unwind (next_frame)); } static gdbarch_init_ftype d10v_gdbarch_init; diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index f088405..991ee28 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -374,8 +374,7 @@ dummy_frame_this_id (struct frame_info *next_frame, same sequence as is found a traditional unwinder. Once all architectures supply the unwind_dummy_id method, this code can go away. */ - (*this_id).base = read_fp (); - (*this_id).pc = read_pc (); + (*this_id) = frame_id_build (read_fp (), read_pc ()); } else if (legacy_frame_p (current_gdbarch) && get_prev_frame (next_frame)) @@ -384,8 +383,8 @@ dummy_frame_this_id (struct frame_info *next_frame, get_prev_frame code has already created THIS frame and linked it in to the frame chain (a pretty bold assumption), extract the ID from THIS base / pc. */ - (*this_id).base = get_frame_base (get_prev_frame (next_frame)); - (*this_id).pc = get_frame_pc (get_prev_frame (next_frame)); + (*this_id) = frame_id_build (get_frame_base (get_prev_frame (next_frame)), + get_frame_pc (get_prev_frame (next_frame))); } else { @@ -403,6 +402,7 @@ dummy_frame_this_id (struct frame_info *next_frame, static struct frame_unwind dummy_frame_unwind = { + DUMMY_FRAME, dummy_frame_this_id, dummy_frame_prev_register }; diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h index 099f9de..ad1efdf 100644 --- a/gdb/frame-unwind.h +++ b/gdb/frame-unwind.h @@ -28,6 +28,8 @@ struct frame_unwind; struct gdbarch; struct regcache; +#include "frame.h" /* For enum frame_type. */ + /* Return the frame unwind methods for the function that contains PC, or NULL if this this unwinder can't handle this frame. */ @@ -128,7 +130,9 @@ typedef void (frame_prev_register_ftype) (struct frame_info *next_frame, struct frame_unwind { - /* Should the frame's type go here? */ + /* The frame's type. Should this instead be a collection of + predicates that test the frame for various attributes? */ + enum frame_type type; /* Should an attribute indicating the frame's address-in-block go here? */ frame_this_id_ftype *this_id; diff --git a/gdb/frame.c b/gdb/frame.c index 09dea5e..5e7f6f1 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -65,12 +65,10 @@ get_frame_id (struct frame_info *fi) fi->unwind->this_id (fi->next, &fi->prologue_cache, &fi->id); fi->id_p = 1; /* FIXME: cagney/2002-12-18: Instead of this hack, should only - store the frame ID in PREV_FRAME. Unfortunatly, some - architectures (HP/UX) still reply on EXTRA_FRAME_INFO and, - hence, still poke at the "struct frame_info" object directly. */ + store the frame ID in PREV_FRAME. */ fi->frame = fi->id.base; } - return frame_id_build (fi->frame, fi->pc); + return frame_id_build (fi->frame, get_frame_pc (fi)); } const struct frame_id null_frame_id; /* All zeros. */ @@ -192,6 +190,23 @@ frame_pc_unwind (struct frame_info *this_frame) return this_frame->pc_unwind_cache; } +CORE_ADDR +frame_func_unwind (struct frame_info *fi) +{ + if (!fi->prev_func.p) + { + fi->prev_func.p = 1; + fi->prev_func.addr = get_pc_function_start (frame_pc_unwind (fi)); + } + return fi->prev_func.addr; +} + +CORE_ADDR +get_frame_func (struct frame_info *fi) +{ + return frame_func_unwind (fi->next); +} + static int do_frame_unwind_register (void *src, int regnum, void *buf) { @@ -511,7 +526,13 @@ create_sentinel_frame (struct regcache *regcache) /* FIXME: cagney/2003-01-10: Problem here. Unwinding a sentinel frame's PC may require information such as the frame's thread's stop reason. Is it possible to get to that? */ + /* FIXME: cagney/2003-04-04: Once ->pc is eliminated, this + assignment can go away. */ frame->pc = frame_pc_unwind (frame); + /* Make the sentinel frame's ID valid, but invalid. That way all + comparisons with it should fail. */ + frame->id_p = 1; + frame->id = null_frame_id; return frame; } @@ -641,7 +662,7 @@ select_frame (struct frame_info *fi) source language of this frame, and switch to it if desired. */ if (fi) { - s = find_pc_symtab (fi->pc); + s = find_pc_symtab (get_frame_pc (fi)); if (s && s->language != current_language->la_language && s->language != language_unknown @@ -756,8 +777,7 @@ legacy_saved_regs_this_id (struct frame_info *next_frame, unwinding a sentinel frame, the PC of which is pointing at a stack dummy. Fake up the dummy frame's ID using the same sequence as is found a traditional unwinder. */ - (*id).base = read_fp (); - (*id).pc = read_pc (); + (*id) = frame_id_build (read_fp (), read_pc ()); return; } @@ -810,11 +830,12 @@ legacy_saved_regs_this_id (struct frame_info *next_frame, /* FIXME: cagney/2002-06-08: This should probably return the frame's function and not the PC (a.k.a. resume address). */ pc = frame_pc_unwind (next_frame); - id->pc = pc; - id->base = base; + (*id) = frame_id_build (base, pc); } const struct frame_unwind legacy_saved_regs_unwinder = { + /* Not really. It gets overridden by legacy_get_prev_frame. */ + UNKNOWN_FRAME, legacy_saved_regs_this_id, legacy_saved_regs_prev_register }; @@ -955,17 +976,22 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc) fi = frame_obstack_zalloc (sizeof (struct frame_info)); - fi->frame = addr; - fi->pc = pc; fi->next = create_sentinel_frame (current_regcache); - fi->type = frame_type_from_pc (pc); + + /* Select/initialize both the unwind function and the frame's type + based on the PC. */ + fi->unwind = frame_unwind_find_by_pc (current_gdbarch, fi->pc); + if (fi->unwind->type != UNKNOWN_FRAME) + fi->type = fi->unwind->type; + else + fi->type = frame_type_from_pc (pc); + + deprecated_update_frame_base_hack (fi, addr); + deprecated_update_frame_pc_hack (fi, pc); if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()) DEPRECATED_INIT_EXTRA_FRAME_INFO (0, fi); - /* Select/initialize an unwind function. */ - fi->unwind = frame_unwind_find_by_pc (current_gdbarch, fi->pc); - return fi; } @@ -1020,10 +1046,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) struct frame_info *prev; int fromleaf; - /* Allocate the new frame but do not wire it in to the frame chain. - Some (bad) code in INIT_FRAME_EXTRA_INFO tries to look along - frame->next to pull some fancy tricks (of course such code is, by - definition, recursive). Try to prevent it. + /* Allocate the new frame. There is no reason to worry about memory leaks, should the remainder of the function fail. The allocated memory will be @@ -1033,6 +1056,17 @@ legacy_get_prev_frame (struct frame_info *this_frame) prev = FRAME_OBSTACK_ZALLOC (struct frame_info); prev->level = this_frame->level + 1; + /* Do not completly wire it in to the frame chain. Some (bad) code + in INIT_FRAME_EXTRA_INFO tries to look along frame->prev to pull + some fancy tricks (of course such code is, by definition, + recursive). + + On the other hand, methods, such as get_frame_pc() and + get_frame_base() rely on being able to walk along the frame + chain. Make certain that at least they work by providing that + link. Of course things manipulating prev can't go back. */ + prev->next = this_frame; + /* NOTE: cagney/2002-11-18: Should have been correctly setting the frame's type here, before anything else, and not last, at the bottom of this function. The various @@ -1043,7 +1077,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) Unfortunatly those same work-arounds rely on the type defaulting to NORMAL_FRAME. Ulgh! The new frame code does not have this problem. */ - prev->type = NORMAL_FRAME; + prev->type = UNKNOWN_FRAME; /* A legacy frame's ID is always computed here. Mark it as valid. */ prev->id_p = 1; @@ -1069,8 +1103,8 @@ legacy_get_prev_frame (struct frame_info *this_frame) because (well ignoring the PPC) a dummy frame can be located using THIS_FRAME's frame ID. */ - prev->pc = frame_pc_unwind (this_frame); - if (prev->pc == 0) + deprecated_update_frame_pc_hack (prev, frame_pc_unwind (this_frame)); + if (get_frame_pc (prev) == 0) { /* The allocated PREV_FRAME will be reclaimed when the frame obstack is next purged. */ @@ -1079,10 +1113,14 @@ legacy_get_prev_frame (struct frame_info *this_frame) "Outermost frame - unwound PC zero\n"); return NULL; } - prev->type = frame_type_from_pc (prev->pc); - /* Set the unwind functions based on that identified PC. */ + /* Set the unwind functions based on that identified PC. Ditto + for the "type" but strongly prefer the unwinder's frame type. */ prev->unwind = frame_unwind_find_by_pc (current_gdbarch, prev->pc); + if (prev->unwind->type == UNKNOWN_FRAME) + prev->type = frame_type_from_pc (prev->pc); + else + prev->type = prev->unwind->type; /* Find the prev's frame's ID. */ if (prev->type == DUMMY_FRAME @@ -1113,8 +1151,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) using the same sequence as is found a traditional unwinder. Once all architectures supply the unwind_dummy_id method, this code can go away. */ - prev->id.base = read_fp (); - prev->id.pc = read_pc (); + prev->id = frame_id_build (read_fp (), read_pc ()); } /* Check that the unwound ID is valid. */ @@ -1136,14 +1173,13 @@ legacy_get_prev_frame (struct frame_info *this_frame) frame base, in the frame object. */ /* FIXME: cagney/2002-12-18: Instead of this hack, should only - store the frame ID in PREV_FRAME. Unfortunatly, some - architectures (HP/UX) still reply on EXTRA_FRAME_INFO and, - hence, still poke at the "struct frame_info" object directly. */ + store the frame ID in PREV_FRAME. */ + /* FIXME: cagney/2003-04-04: Once ->frame is eliminated, this + assignment can go. */ prev->frame = prev->id.base; /* Link it in. */ this_frame->prev = prev; - prev->next = this_frame; /* FIXME: cagney/2002-01-19: This call will go away. Instead of initializing extra info, all frames will use the frame_cache @@ -1218,8 +1254,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) /* Link in the already allocated prev frame. */ this_frame->prev = prev; - prev->next = this_frame; - prev->frame = address; + deprecated_update_frame_base_hack (prev, address); /* This change should not be needed, FIXME! We should determine whether any targets *need* DEPRECATED_INIT_FRAME_PC to happen @@ -1295,7 +1330,9 @@ legacy_get_prev_frame (struct frame_info *this_frame) that PC value. */ if (DEPRECATED_INIT_FRAME_PC_FIRST_P ()) - prev->pc = (DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev)); + deprecated_update_frame_pc_hack (prev, + DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, + prev)); if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()) DEPRECATED_INIT_EXTRA_FRAME_INFO (fromleaf, prev); @@ -1304,15 +1341,17 @@ legacy_get_prev_frame (struct frame_info *this_frame) FRAME_SAVED_PC may use that queue to figure out its value (see tm-sparc.h). We want the pc saved in the inferior frame. */ if (DEPRECATED_INIT_FRAME_PC_P ()) - prev->pc = DEPRECATED_INIT_FRAME_PC (fromleaf, prev); + deprecated_update_frame_pc_hack (prev, + DEPRECATED_INIT_FRAME_PC (fromleaf, + prev)); /* If ->frame and ->pc are unchanged, we are in the process of getting ourselves into an infinite backtrace. Some architectures check this in DEPRECATED_FRAME_CHAIN or thereabouts, but it seems like there is no reason this can't be an architecture-independent check. */ - if (prev->frame == this_frame->frame - && prev->pc == this_frame->pc) + if (get_frame_base (prev) == get_frame_base (this_frame) + && get_frame_pc (prev) == get_frame_pc (this_frame)) { this_frame->prev = NULL; obstack_free (&frame_cache_obstack, prev); @@ -1323,7 +1362,16 @@ legacy_get_prev_frame (struct frame_info *this_frame) (and probably other architectural information). The PC lets you check things like the debug info at that point (dwarf2cfi?) and use that to decide how the frame should be unwound. */ - prev->unwind = frame_unwind_find_by_pc (current_gdbarch, prev->pc); + prev->unwind = frame_unwind_find_by_pc (current_gdbarch, + get_frame_pc (prev)); + + /* If the unwinder provides a frame type, use it. Otherwize + continue on to that heuristic mess. */ + if (prev->unwind->type != UNKNOWN_FRAME) + { + prev->type = prev->unwind->type; + return prev; + } /* NOTE: cagney/2002-11-18: The code segments, found in create_new_frame and get_prev_frame(), that initializes the @@ -1335,8 +1383,8 @@ legacy_get_prev_frame (struct frame_info *this_frame) before the INIT function has been called. */ if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES && (DEPRECATED_PC_IN_CALL_DUMMY_P () - ? DEPRECATED_PC_IN_CALL_DUMMY (prev->pc, 0, 0) - : pc_in_dummy_frame (prev->pc))) + ? DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (prev), 0, 0) + : pc_in_dummy_frame (get_frame_pc (prev)))) prev->type = DUMMY_FRAME; else { @@ -1347,8 +1395,8 @@ legacy_get_prev_frame (struct frame_info *this_frame) Unforunatly, its the INIT code that sets the PC (Hmm, catch 22). */ char *name; - find_pc_partial_function (prev->pc, &name, NULL, NULL); - if (PC_IN_SIGTRAMP (prev->pc, name)) + find_pc_partial_function (get_frame_pc (prev), &name, NULL, NULL); + if (PC_IN_SIGTRAMP (get_frame_pc (prev), name)) prev->type = SIGTRAMP_FRAME; /* FIXME: cagney/2002-11-11: Leave prev->type alone. Some architectures are forcing the frame's type in INIT so we @@ -1551,6 +1599,8 @@ get_prev_frame (struct frame_info *this_frame) because (well ignoring the PPC) a dummy frame can be located using THIS_FRAME's frame ID. */ + /* FIXME: cagney/2003-04-04: Once ->pc is eliminated, this + assignment can go away. */ prev_frame->pc = frame_pc_unwind (this_frame); if (prev_frame->pc == 0) { @@ -1561,12 +1611,22 @@ get_prev_frame (struct frame_info *this_frame) "Outermost frame - unwound PC zero\n"); return NULL; } - prev_frame->type = frame_type_from_pc (prev_frame->pc); /* Set the unwind functions based on that identified PC. */ prev_frame->unwind = frame_unwind_find_by_pc (current_gdbarch, prev_frame->pc); + /* FIXME: cagney/2003-04-02: Rather than storing the frame's type in + the frame, the unwinder's type should be returned directly. + Unfortunatly, legacy code, called by legacy_get_prev_frame, + explicitly set the frames type using the method + deprecated_set_frame_type(). */ + gdb_assert (prev_frame->unwind->type != UNKNOWN_FRAME); + prev_frame->type = prev_frame->unwind->type; + + /* Can the frame's type and unwinder be computed on demand? That + would make a frame's creation really really lite! */ + /* The prev's frame's ID is computed by demand in get_frame_id(). */ /* The unwound frame ID is validate at the start of this function, @@ -1614,7 +1674,7 @@ pc_notcurrent (struct frame_info *frame) void find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal) { - (*sal) = find_pc_line (frame->pc, pc_notcurrent (frame)); + (*sal) = find_pc_line (get_frame_pc (frame), pc_notcurrent (frame)); } /* Per "frame.h", return the ``address'' of the frame. Code should @@ -1636,7 +1696,7 @@ get_frame_base (struct frame_info *fi) CORE_ADDR get_frame_base_address (struct frame_info *fi) { - if (fi->type != NORMAL_FRAME) + if (get_frame_type (fi) != NORMAL_FRAME) return 0; if (fi->base == NULL) fi->base = frame_base_find_by_pc (current_gdbarch, get_frame_pc (fi)); @@ -1651,7 +1711,7 @@ CORE_ADDR get_frame_locals_address (struct frame_info *fi) { void **cache; - if (fi->type != NORMAL_FRAME) + if (get_frame_type (fi) != NORMAL_FRAME) return 0; /* If there isn't a frame address method, find it. */ if (fi->base == NULL) @@ -1669,7 +1729,7 @@ CORE_ADDR get_frame_args_address (struct frame_info *fi) { void **cache; - if (fi->type != NORMAL_FRAME) + if (get_frame_type (fi) != NORMAL_FRAME) return 0; /* If there isn't a frame address method, find it. */ if (fi->base == NULL) @@ -1703,7 +1763,10 @@ get_frame_type (struct frame_info *frame) if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES && deprecated_frame_in_dummy (frame)) return DUMMY_FRAME; - return frame->type; + if (frame->type == UNKNOWN_FRAME) + return NORMAL_FRAME; + else + return frame->type; } void @@ -1713,34 +1776,6 @@ deprecated_set_frame_type (struct frame_info *frame, enum frame_type type) frame->type = type; } -#ifdef FRAME_FIND_SAVED_REGS -/* XXX - deprecated. This is a compatibility function for targets - that do not yet implement DEPRECATED_FRAME_INIT_SAVED_REGS. */ -/* Find the addresses in which registers are saved in FRAME. */ - -void -deprecated_get_frame_saved_regs (struct frame_info *frame, - struct frame_saved_regs *saved_regs_addr) -{ - if (frame->saved_regs == NULL) - { - frame->saved_regs = (CORE_ADDR *) - frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS); - } - if (saved_regs_addr == NULL) - { - struct frame_saved_regs saved_regs; - FRAME_FIND_SAVED_REGS (frame, saved_regs); - memcpy (frame->saved_regs, &saved_regs, SIZEOF_FRAME_SAVED_REGS); - } - else - { - FRAME_FIND_SAVED_REGS (frame, *saved_regs_addr); - memcpy (frame->saved_regs, saved_regs_addr, SIZEOF_FRAME_SAVED_REGS); - } -} -#endif - struct frame_extra_info * get_frame_extra_info (struct frame_info *fi) { diff --git a/gdb/frame.h b/gdb/frame.h index 231aaad..f928b9c 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -149,6 +149,12 @@ extern struct frame_info *frame_find_by_id (struct frame_id id); this frame. */ extern CORE_ADDR get_frame_pc (struct frame_info *); +/* Following on from the `resume' address. Return the entry point + address of the function containing that resume address, or zero if + that function isn't known. */ +extern CORE_ADDR frame_func_unwind (struct frame_info *fi); +extern CORE_ADDR get_frame_func (struct frame_info *fi); + /* Closely related to the resume address, various symbol table attributes that are determined by the PC. Note that for a normal frame, the PC refers to the resume address after the return, and @@ -225,6 +231,11 @@ extern int frame_relative_level (struct frame_info *fi); enum frame_type { + /* The frame's type hasn't yet been defined. This is a catch-all + for legacy code that uses really strange technicques, such as + deprecated_set_frame_type, to set the frame's type. New code + should not use this value. */ + UNKNOWN_FRAME, /* A true stack frame, created by the target program during normal execution. */ NORMAL_FRAME, @@ -313,24 +324,6 @@ extern CORE_ADDR frame_pc_unwind (struct frame_info *frame); of the caller. */ extern void frame_pop (struct frame_info *frame); -/* Describe the saved registers of a frame. */ - -#if defined (EXTRA_FRAME_INFO) || defined (FRAME_FIND_SAVED_REGS) -/* XXXX - deprecated */ -struct frame_saved_regs - { - /* For each register R (except the SP), regs[R] is the address at - which it was saved on entry to the frame, or zero if it was not - saved on entry to this frame. This includes special registers - such as pc and fp saved in special ways in the stack frame. - - regs[SP_REGNUM] is different. It holds the actual SP, not the - address at which it was saved. */ - - CORE_ADDR regs[NUM_REGS]; - }; -#endif - /* We keep a cache of stack frames, each of which is a "struct frame_info". The innermost one gets allocated (in wait_for_inferior) each time the inferior stops; current_frame @@ -367,6 +360,10 @@ struct frame_info int level; /* The frame's type. */ + /* FIXME: cagney/2003-04-02: Should instead be returning + ->unwind->type. Unfortunatly, legacy code is still explicitly + setting the type using the method deprecated_set_frame_type. + Eliminate that method and this field can be eliminated. */ enum frame_type type; /* For each register, address of where it was saved on entry to @@ -379,13 +376,6 @@ struct frame_info initialized by DEPRECATED_FRAME_INIT_SAVED_REGS(). */ CORE_ADDR *saved_regs; /*NUM_REGS + NUM_PSEUDO_REGS*/ -#ifdef EXTRA_FRAME_INFO - /* XXXX - deprecated */ - /* Anything extra for this structure that may have been defined - in the machine dependent files. */ - EXTRA_FRAME_INFO -#endif - /* Anything extra for this structure that may have been defined in the machine dependent files. */ /* Allocated by frame_extra_info_zalloc () which is called / @@ -408,6 +398,13 @@ struct frame_info int pc_unwind_cache_p; CORE_ADDR pc_unwind_cache; + /* Cached copy of the previous frame's function address. */ + struct + { + CORE_ADDR addr; + int p; + } prev_func; + /* This frame's ID. Note that the frame's ID, base and PC contain redundant information. */ int id_p; @@ -465,14 +462,6 @@ extern int frame_chain_valid (CORE_ADDR, struct frame_info *); extern void generic_save_dummy_frame_tos (CORE_ADDR sp); - -#ifdef FRAME_FIND_SAVED_REGS -/* XXX - deprecated */ -#define DEPRECATED_FRAME_INIT_SAVED_REGS(FI) deprecated_get_frame_saved_regs (FI, NULL) -extern void deprecated_get_frame_saved_regs (struct frame_info *, - struct frame_saved_regs *); -#endif - extern struct block *get_frame_block (struct frame_info *, CORE_ADDR *addr_in_block); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 596f131..b2644f7 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -55,18 +55,6 @@ extern struct gdbarch *current_gdbarch; /* If any of the following are defined, the target wasn't correctly converted. */ -#if GDB_MULTI_ARCH -#if defined (EXTRA_FRAME_INFO) -#error "EXTRA_FRAME_INFO: replaced by struct frame_extra_info" -#endif -#endif - -#if GDB_MULTI_ARCH -#if defined (FRAME_FIND_SAVED_REGS) -#error "FRAME_FIND_SAVED_REGS: replaced by DEPRECATED_FRAME_INIT_SAVED_REGS" -#endif -#endif - #if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE) #error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file." #endif @@ -1116,14 +1104,12 @@ extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get extern int gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch); extern void set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch, int deprecated_use_generic_dummy_frames); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) #error "Non multi-arch definition of DEPRECATED_USE_GENERIC_DUMMY_FRAMES" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) +#if !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES (gdbarch_deprecated_use_generic_dummy_frames (current_gdbarch)) #endif -#endif /* Default (value) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_LOCATION) @@ -1132,14 +1118,12 @@ extern void set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdb extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch); extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION) #error "Non multi-arch definition of CALL_DUMMY_LOCATION" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_LOCATION) +#if !defined (CALL_DUMMY_LOCATION) #define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch)) #endif -#endif /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_ADDRESS) @@ -1204,10 +1188,10 @@ extern void set_gdbarch_call_dummy_length (struct gdbarch *gdbarch, int call_dum #endif extern int gdbarch_deprecated_pc_in_call_dummy_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY_P) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY_P) #error "Non multi-arch definition of DEPRECATED_PC_IN_CALL_DUMMY" #endif -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY_P) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY_P) #define DEPRECATED_PC_IN_CALL_DUMMY_P() (gdbarch_deprecated_pc_in_call_dummy_p (current_gdbarch)) #endif @@ -1219,11 +1203,11 @@ extern int gdbarch_deprecated_pc_in_call_dummy_p (struct gdbarch *gdbarch); typedef int (gdbarch_deprecated_pc_in_call_dummy_ftype) (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address); extern int gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address); extern void set_gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, gdbarch_deprecated_pc_in_call_dummy_ftype *deprecated_pc_in_call_dummy); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY) #error "Non multi-arch definition of DEPRECATED_PC_IN_CALL_DUMMY" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY) #define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) (gdbarch_deprecated_pc_in_call_dummy (current_gdbarch, pc, sp, frame_address)) #endif #endif diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index fa91815..e5cb51d 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -518,8 +518,8 @@ F:2:GET_LONGJMP_TARGET:int:get_longjmp_target:CORE_ADDR *pc:pc::0:0 # behaviour here (and hence entrench it further) gdbarch simply # reqires that these methods be set up from the word go. This also # avoids any potential problems with moving beyond multi-arch partial. -v:1:DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0 -v:1:CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0 +v::DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0 +v::CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0 f::CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void::::entry_point_address::0 v::CALL_DUMMY_START_OFFSET:CORE_ADDR:call_dummy_start_offset v::CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset @@ -529,7 +529,7 @@ v::CALL_DUMMY_LENGTH:int:call_dummy_length # is false, the corresponding function works. This simplifies the # migration process - old code, calling DEPRECATED_PC_IN_CALL_DUMMY(), # doesn't need to be modified. -F:1:DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy +F::DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy v::CALL_DUMMY_WORDS:LONGEST *:call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx v::SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0 V:2:DEPRECATED_CALL_DUMMY_STACK_ADJUST:int:deprecated_call_dummy_stack_adjust::::0 @@ -820,18 +820,6 @@ extern struct gdbarch *current_gdbarch; /* If any of the following are defined, the target wasn't correctly converted. */ -#if GDB_MULTI_ARCH -#if defined (EXTRA_FRAME_INFO) -#error "EXTRA_FRAME_INFO: replaced by struct frame_extra_info" -#endif -#endif - -#if GDB_MULTI_ARCH -#if defined (FRAME_FIND_SAVED_REGS) -#error "FRAME_FIND_SAVED_REGS: replaced by DEPRECATED_FRAME_INIT_SAVED_REGS" -#endif -#endif - #if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE) #error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file." #endif diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c index 3d1ca88..1e1cb91 100644 --- a/gdb/hppa-hpux-tdep.c +++ b/gdb/hppa-hpux-tdep.c @@ -35,7 +35,7 @@ void hppa_hpux_frame_saved_pc_in_sigtramp (struct frame_info *fi, void hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi, CORE_ADDR *tmp); void hppa_hpux_frame_find_saved_regs_in_sigtramp - (struct frame_info *fi, struct frame_saved_regs *fsr); + (struct frame_info *fi, CORE_ADDR *fsr); int hppa_hpux_pc_in_sigtramp (CORE_ADDR pc, char *name) @@ -79,7 +79,7 @@ hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi, void hppa_hpux_frame_find_saved_regs_in_sigtramp (struct frame_info *fi, - struct frame_saved_regs *fsr) + CORE_ADDR *fsr) { int i; const CORE_ADDR tmp = (fi)->frame + (10 * 4); @@ -87,9 +87,9 @@ hppa_hpux_frame_find_saved_regs_in_sigtramp (struct frame_info *fi, for (i = 0; i < NUM_REGS; i++) { if (i == SP_REGNUM) - (fsr)->regs[SP_REGNUM] = read_memory_integer (tmp + SP_REGNUM * 4, 4); + fsr[SP_REGNUM] = read_memory_integer (tmp + SP_REGNUM * 4, 4); else - (fsr)->regs[i] = tmp + i * 4; + fsr[i] = tmp + i * 4; } } diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 2e0c192..896d638 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -78,8 +78,7 @@ static unsigned extract_5R_store (unsigned int); static unsigned extract_5r_store (unsigned int); -static void find_dummy_frame_regs (struct frame_info *, - struct frame_saved_regs *); +static void find_dummy_frame_regs (struct frame_info *, CORE_ADDR *); static int find_proc_framesize (CORE_ADDR); @@ -103,7 +102,7 @@ static int low_sign_extend (unsigned int, unsigned int); static int sign_extend (unsigned int, unsigned int); -static int restore_pc_queue (struct frame_saved_regs *); +static int restore_pc_queue (CORE_ADDR *); static int hppa_alignof (struct type *); @@ -943,13 +942,13 @@ hppa_frame_saved_pc (struct frame_info *frame) && ((get_frame_type (frame->next) == SIGTRAMP_FRAME) || pc_in_interrupt_handler (frame->next->pc))) { - struct frame_saved_regs saved_regs; - - deprecated_get_frame_saved_regs (frame->next, &saved_regs); - if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + CORE_ADDR *saved_regs; + hppa_frame_init_saved_regs (frame->next); + saved_regs = get_frame_saved_regs (frame->next); + if (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2) { - pc = read_memory_integer (saved_regs.regs[31], + pc = read_memory_integer (saved_regs[31], TARGET_PTR_BIT / 8) & ~0x3; /* Syscalls are really two frames. The syscall stub itself @@ -957,11 +956,11 @@ hppa_frame_saved_pc (struct frame_info *frame) a return pointer in %r31. We return the %rp variant if %r31 is the same as frame->pc. */ if (pc == frame->pc) - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else @@ -983,13 +982,13 @@ hppa_frame_saved_pc (struct frame_info *frame) && ((get_frame_type (frame->next) == SIGTRAMP_FRAME) || pc_in_interrupt_handler (frame->next->pc))) { - struct frame_saved_regs saved_regs; - - deprecated_get_frame_saved_regs (frame->next, &saved_regs); - if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + CORE_ADDR *saved_regs; + hppa_frame_init_saved_regs (frame->next); + saved_regs = get_frame_saved_regs (frame->next); + if (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2) { - pc = read_memory_integer (saved_regs.regs[31], + pc = read_memory_integer (saved_regs[31], TARGET_PTR_BIT / 8) & ~0x3; /* Syscalls are really two frames. The syscall stub itself @@ -997,11 +996,11 @@ hppa_frame_saved_pc (struct frame_info *frame) a return pointer in %r31. We return the %rp variant if %r31 is the same as frame->pc. */ if (pc == frame->pc) - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else if (rp_offset == 0) @@ -1129,9 +1128,9 @@ hppa_frame_chain (struct frame_info *frame) /* A frame in the current frame list, or zero. */ struct frame_info *saved_regs_frame = 0; - /* Where the registers were saved in saved_regs_frame. - If saved_regs_frame is zero, this is garbage. */ - struct frame_saved_regs saved_regs; + /* Where the registers were saved in saved_regs_frame. If + saved_regs_frame is zero, this is garbage. */ + CORE_ADDR *saved_regs = NULL; CORE_ADDR caller_pc; @@ -1258,11 +1257,12 @@ hppa_frame_chain (struct frame_info *frame) /* The unwind entry claims that r3 is saved here. However, in optimized code, GCC often doesn't actually save r3. We'll discover this if we look at the prologue. */ - deprecated_get_frame_saved_regs (tmp_frame, &saved_regs); + hppa_frame_init_saved_regs (tmp_frame); + saved_regs = get_frame_saved_regs (tmp_frame); saved_regs_frame = tmp_frame; /* If we have an address for r3, that's good. */ - if (saved_regs.regs[FP_REGNUM]) + if (saved_regs[FP_REGNUM]) break; } } @@ -1307,21 +1307,24 @@ hppa_frame_chain (struct frame_info *frame) system call has a variable sized stack frame. */ if (tmp_frame != saved_regs_frame) - deprecated_get_frame_saved_regs (tmp_frame, &saved_regs); + { + hppa_frame_init_saved_regs (tmp_frame); + saved_regs = get_frame_saved_regs (tmp_frame); + } /* Abominable hack. */ if (current_target.to_has_execution == 0 - && ((saved_regs.regs[FLAGS_REGNUM] - && (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + && ((saved_regs[FLAGS_REGNUM] + && (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2)) - || (saved_regs.regs[FLAGS_REGNUM] == 0 + || (saved_regs[FLAGS_REGNUM] == 0 && read_register (FLAGS_REGNUM) & 0x2))) { u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame)); if (!u) { - return read_memory_integer (saved_regs.regs[FP_REGNUM], + return read_memory_integer (saved_regs[FP_REGNUM], TARGET_PTR_BIT / 8); } else @@ -1330,7 +1333,7 @@ hppa_frame_chain (struct frame_info *frame) } } - return read_memory_integer (saved_regs.regs[FP_REGNUM], + return read_memory_integer (saved_regs[FP_REGNUM], TARGET_PTR_BIT / 8); } } @@ -1342,21 +1345,24 @@ hppa_frame_chain (struct frame_info *frame) tmp_frame = tmp_frame->next; if (tmp_frame != saved_regs_frame) - deprecated_get_frame_saved_regs (tmp_frame, &saved_regs); + { + hppa_frame_init_saved_regs (tmp_frame); + saved_regs = get_frame_saved_regs (tmp_frame); + } /* Abominable hack. See above. */ if (current_target.to_has_execution == 0 - && ((saved_regs.regs[FLAGS_REGNUM] - && (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + && ((saved_regs[FLAGS_REGNUM] + && (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2)) - || (saved_regs.regs[FLAGS_REGNUM] == 0 + || (saved_regs[FLAGS_REGNUM] == 0 && read_register (FLAGS_REGNUM) & 0x2))) { u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame)); if (!u) { - return read_memory_integer (saved_regs.regs[FP_REGNUM], + return read_memory_integer (saved_regs[FP_REGNUM], TARGET_PTR_BIT / 8); } else @@ -1496,26 +1502,26 @@ hppa_push_dummy_frame (void) static void find_dummy_frame_regs (struct frame_info *frame, - struct frame_saved_regs *frame_saved_regs) + CORE_ADDR frame_saved_regs[]) { CORE_ADDR fp = frame->frame; int i; /* The 32bit and 64bit ABIs save RP into different locations. */ if (REGISTER_SIZE == 8) - frame_saved_regs->regs[RP_REGNUM] = (fp - 16) & ~0x3; + frame_saved_regs[RP_REGNUM] = (fp - 16) & ~0x3; else - frame_saved_regs->regs[RP_REGNUM] = (fp - 20) & ~0x3; + frame_saved_regs[RP_REGNUM] = (fp - 20) & ~0x3; - frame_saved_regs->regs[FP_REGNUM] = fp; + frame_saved_regs[FP_REGNUM] = fp; - frame_saved_regs->regs[1] = fp + (2 * REGISTER_SIZE); + frame_saved_regs[1] = fp + (2 * REGISTER_SIZE); for (fp += 3 * REGISTER_SIZE, i = 3; i < 32; i++) { if (i != FP_REGNUM) { - frame_saved_regs->regs[i] = fp; + frame_saved_regs[i] = fp; fp += REGISTER_SIZE; } } @@ -1525,14 +1531,14 @@ find_dummy_frame_regs (struct frame_info *frame, fp += 4; for (i = FP0_REGNUM; i < NUM_REGS; i++, fp += 8) - frame_saved_regs->regs[i] = fp; - - frame_saved_regs->regs[IPSW_REGNUM] = fp; - frame_saved_regs->regs[SAR_REGNUM] = fp + REGISTER_SIZE; - frame_saved_regs->regs[PCOQ_HEAD_REGNUM] = fp + 2 * REGISTER_SIZE; - frame_saved_regs->regs[PCSQ_HEAD_REGNUM] = fp + 3 * REGISTER_SIZE; - frame_saved_regs->regs[PCOQ_TAIL_REGNUM] = fp + 4 * REGISTER_SIZE; - frame_saved_regs->regs[PCSQ_TAIL_REGNUM] = fp + 5 * REGISTER_SIZE; + frame_saved_regs[i] = fp; + + frame_saved_regs[IPSW_REGNUM] = fp; + frame_saved_regs[SAR_REGNUM] = fp + REGISTER_SIZE; + frame_saved_regs[PCOQ_HEAD_REGNUM] = fp + 2 * REGISTER_SIZE; + frame_saved_regs[PCSQ_HEAD_REGNUM] = fp + 3 * REGISTER_SIZE; + frame_saved_regs[PCOQ_TAIL_REGNUM] = fp + 4 * REGISTER_SIZE; + frame_saved_regs[PCSQ_TAIL_REGNUM] = fp + 5 * REGISTER_SIZE; } void @@ -1541,44 +1547,45 @@ hppa_pop_frame (void) register struct frame_info *frame = get_current_frame (); register CORE_ADDR fp, npc, target_pc; register int regnum; - struct frame_saved_regs fsr; + CORE_ADDR *fsr; double freg_buffer; fp = get_frame_base (frame); - deprecated_get_frame_saved_regs (frame, &fsr); + hppa_frame_init_saved_regs (frame); + fsr = get_frame_saved_regs (frame); #ifndef NO_PC_SPACE_QUEUE_RESTORE - if (fsr.regs[IPSW_REGNUM]) /* Restoring a call dummy frame */ - restore_pc_queue (&fsr); + if (fsr[IPSW_REGNUM]) /* Restoring a call dummy frame */ + restore_pc_queue (fsr); #endif for (regnum = 31; regnum > 0; regnum--) - if (fsr.regs[regnum]) - write_register (regnum, read_memory_integer (fsr.regs[regnum], + if (fsr[regnum]) + write_register (regnum, read_memory_integer (fsr[regnum], REGISTER_SIZE)); for (regnum = NUM_REGS - 1; regnum >= FP0_REGNUM; regnum--) - if (fsr.regs[regnum]) + if (fsr[regnum]) { - read_memory (fsr.regs[regnum], (char *) &freg_buffer, 8); + read_memory (fsr[regnum], (char *) &freg_buffer, 8); deprecated_write_register_bytes (REGISTER_BYTE (regnum), (char *) &freg_buffer, 8); } - if (fsr.regs[IPSW_REGNUM]) + if (fsr[IPSW_REGNUM]) write_register (IPSW_REGNUM, - read_memory_integer (fsr.regs[IPSW_REGNUM], + read_memory_integer (fsr[IPSW_REGNUM], REGISTER_SIZE)); - if (fsr.regs[SAR_REGNUM]) + if (fsr[SAR_REGNUM]) write_register (SAR_REGNUM, - read_memory_integer (fsr.regs[SAR_REGNUM], + read_memory_integer (fsr[SAR_REGNUM], REGISTER_SIZE)); /* If the PC was explicitly saved, then just restore it. */ - if (fsr.regs[PCOQ_TAIL_REGNUM]) + if (fsr[PCOQ_TAIL_REGNUM]) { - npc = read_memory_integer (fsr.regs[PCOQ_TAIL_REGNUM], + npc = read_memory_integer (fsr[PCOQ_TAIL_REGNUM], REGISTER_SIZE); write_register (PCOQ_TAIL_REGNUM, npc); } @@ -1591,7 +1598,7 @@ hppa_pop_frame (void) write_register (FP_REGNUM, read_memory_integer (fp, REGISTER_SIZE)); - if (fsr.regs[IPSW_REGNUM]) /* call dummy */ + if (fsr[IPSW_REGNUM]) /* call dummy */ write_register (SP_REGNUM, fp - 48); else write_register (SP_REGNUM, fp); @@ -1604,7 +1611,7 @@ hppa_pop_frame (void) Don't skip through the trampoline if we're popping a dummy frame. */ target_pc = SKIP_TRAMPOLINE_CODE (npc & ~0x3) & ~0x3; - if (target_pc && !fsr.regs[IPSW_REGNUM]) + if (target_pc && !fsr[IPSW_REGNUM]) { struct symtab_and_line sal; struct breakpoint *breakpoint; @@ -1635,10 +1642,10 @@ hppa_pop_frame (void) queue space registers. */ static int -restore_pc_queue (struct frame_saved_regs *fsr) +restore_pc_queue (CORE_ADDR *fsr) { CORE_ADDR pc = read_pc (); - CORE_ADDR new_pc = read_memory_integer (fsr->regs[PCOQ_HEAD_REGNUM], + CORE_ADDR new_pc = read_memory_integer (fsr[PCOQ_HEAD_REGNUM], TARGET_PTR_BIT / 8); struct target_waitstatus w; int insn_count; @@ -1657,7 +1664,7 @@ restore_pc_queue (struct frame_saved_regs *fsr) So, load up the registers and single step until we are in the right place. */ - write_register (21, read_memory_integer (fsr->regs[PCSQ_HEAD_REGNUM], + write_register (21, read_memory_integer (fsr[PCSQ_HEAD_REGNUM], REGISTER_SIZE)); write_register (22, new_pc); @@ -3842,15 +3849,15 @@ hppa_skip_prologue (CORE_ADDR pc) return (skip_prologue_hard_way (pc)); } -/* Put here the code to store, into a struct frame_saved_regs, - the addresses of the saved registers of frame described by FRAME_INFO. - This includes special registers such as pc and fp saved in special - ways in the stack frame. sp is even more special: - the address we return for it IS the sp for the next frame. */ +/* Put here the code to store, into the SAVED_REGS, the addresses of + the saved registers of frame described by FRAME_INFO. This + includes special registers such as pc and fp saved in special ways + in the stack frame. sp is even more special: the address we return + for it IS the sp for the next frame. */ void hppa_frame_find_saved_regs (struct frame_info *frame_info, - struct frame_saved_regs *frame_saved_regs) + CORE_ADDR frame_saved_regs[]) { CORE_ADDR pc; struct unwind_table_entry *u; @@ -3861,7 +3868,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, int final_iteration; /* Zero out everything. */ - memset (frame_saved_regs, '\0', sizeof (struct frame_saved_regs)); + memset (frame_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS); /* Call dummy frames always look the same, so there's no need to examine the dummy code to determine locations of saved registers; @@ -3892,11 +3899,11 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, { /* SP is a little special. */ if (i == SP_REGNUM) - frame_saved_regs->regs[SP_REGNUM] + frame_saved_regs[SP_REGNUM] = read_memory_integer (frame_info->frame + SP_REGNUM * 4, TARGET_PTR_BIT / 8); else - frame_saved_regs->regs[i] = frame_info->frame + i * 4; + frame_saved_regs[i] = frame_info->frame + i * 4; } return; } @@ -3912,7 +3919,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* Get the starting address of the function referred to by the PC saved in frame. */ - pc = get_pc_function_start (frame_info->pc); + pc = get_frame_func (frame_info); /* Yow! */ u = find_unwind_entry (pc); @@ -3945,7 +3952,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* The frame always represents the value of %sp at entry to the current function (and is thus equivalent to the "saved" stack pointer. */ - frame_saved_regs->regs[SP_REGNUM] = frame_info->frame; + frame_saved_regs[SP_REGNUM] = frame_info->frame; /* Loop until we find everything of interest or hit a branch. @@ -3980,12 +3987,12 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, if (inst == 0x6bc23fd9) /* stw rp,-0x14(sr0,sp) */ { save_rp = 0; - frame_saved_regs->regs[RP_REGNUM] = frame_info->frame - 20; + frame_saved_regs[RP_REGNUM] = frame_info->frame - 20; } else if (inst == 0x0fc212c1) /* std rp,-0x10(sr0,sp) */ { save_rp = 0; - frame_saved_regs->regs[RP_REGNUM] = frame_info->frame - 16; + frame_saved_regs[RP_REGNUM] = frame_info->frame - 16; } /* Note if we saved SP into the stack. This also happens to indicate @@ -3993,7 +4000,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, if ( (inst & 0xffffc000) == 0x6fc10000 /* stw,ma r1,N(sr0,sp) */ || (inst & 0xffffc00c) == 0x73c10008) /* std,ma r1,N(sr0,sp) */ { - frame_saved_regs->regs[FP_REGNUM] = frame_info->frame; + frame_saved_regs[FP_REGNUM] = frame_info->frame; save_sp = 0; } @@ -4007,10 +4014,10 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* stwm with a positive displacement is a *post modify*. */ if ((inst >> 26) == 0x1b && extract_14 (inst) >= 0) - frame_saved_regs->regs[reg] = frame_info->frame; + frame_saved_regs[reg] = frame_info->frame; /* A std has explicit post_modify forms. */ else if ((inst & 0xfc00000c0) == 0x70000008) - frame_saved_regs->regs[reg] = frame_info->frame; + frame_saved_regs[reg] = frame_info->frame; else { CORE_ADDR offset; @@ -4024,10 +4031,10 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* Handle code with and without frame pointers. */ if (u->Save_SP) - frame_saved_regs->regs[reg] + frame_saved_regs[reg] = frame_info->frame + offset; else - frame_saved_regs->regs[reg] + frame_saved_regs[reg] = (frame_info->frame + (u->Total_frame_size << 3) + offset); } @@ -4060,12 +4067,12 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* 1st HP CC FP register store. After this instruction we've set enough state that the GCC and HPCC code are both handled in the same manner. */ - frame_saved_regs->regs[reg + FP4_REGNUM + 4] = frame_info->frame; + frame_saved_regs[reg + FP4_REGNUM + 4] = frame_info->frame; fp_loc = 8; } else { - frame_saved_regs->regs[reg + FP0_REGNUM + 4] + frame_saved_regs[reg + FP0_REGNUM + 4] = frame_info->frame + fp_loc; fp_loc += 8; } @@ -4085,6 +4092,17 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, } } +/* XXX - deprecated. This is a compatibility function for targets + that do not yet implement DEPRECATED_FRAME_INIT_SAVED_REGS. */ +/* Find the addresses in which registers are saved in FRAME. */ + +void +hppa_frame_init_saved_regs (struct frame_info *frame) +{ + if (get_frame_saved_regs (frame) == NULL) + frame_saved_regs_zalloc (frame); + hppa_frame_find_saved_regs (frame, get_frame_saved_regs (frame)); +} /* Exception handling support for the HP-UX ANSI C++ compiler. The compiler (aCC) provides a callback for exception events; diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 7ef1f6e..317d726 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -502,7 +502,7 @@ i386_frameless_signal_p (struct frame_info *frame) return (get_next_frame (frame) && get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME && (frameless_look_for_prologue (frame) - || get_frame_pc (frame) == get_pc_function_start (get_frame_pc (frame)))); + || get_frame_pc (frame) == get_frame_func (frame))); } /* Return the chain-pointer for FRAME. In the case of the i386, the @@ -714,7 +714,7 @@ i386_frame_init_saved_regs (struct frame_info *fip) frame_saved_regs_zalloc (fip); - pc = get_pc_function_start (get_frame_pc (fip)); + pc = get_frame_func (fip); if (pc != 0) locals = i386_get_frame_setup (pc); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index ecb4919..5e46d6b 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -1205,7 +1205,7 @@ ia64_frame_init_saved_regs (struct frame_info *frame) { CORE_ADDR func_start; - func_start = get_pc_function_start (get_frame_pc (frame)); + func_start = get_frame_func (frame); examine_prologue (func_start, get_frame_pc (frame), frame); } } diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 7a9886b..a93a156 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -614,7 +614,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) } else { - pc = get_pc_function_start (get_frame_pc (frame_info)); + pc = get_frame_func (frame_info); nextinsn = read_memory_unsigned_integer (pc, 2); if (P_PEA_FP == nextinsn diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 6fbbaa7..fe65bd8 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -897,9 +897,7 @@ selectors_info (char *regexp, int from_tty) ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -930,9 +928,7 @@ selectors_info (char *regexp, int from_tty) ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -956,9 +952,7 @@ selectors_info (char *regexp, int from_tty) char *p = asel; QUIT; - name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (sym_arr[ix]); + name = SYMBOL_NATURAL_NAME (sym_arr[ix]); name = strchr (name, ' ') + 1; if (p[0] && specialcmp(name, p) == 0) continue; /* Seen this one already (not unique). */ @@ -1040,9 +1034,7 @@ classes_info (char *regexp, int from_tty) ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -1066,9 +1058,7 @@ classes_info (char *regexp, int from_tty) ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -1085,9 +1075,7 @@ classes_info (char *regexp, int from_tty) char *p = aclass; QUIT; - name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (sym_arr[ix]); + name = SYMBOL_NATURAL_NAME (sym_arr[ix]); name += 2; if (p[0] && specialcmp(name, p) == 0) continue; /* Seen this one already (not unique). */ @@ -1348,9 +1336,7 @@ find_methods (struct symtab *symtab, char type, /* Not in the specified symtab. */ continue; - symname = SYMBOL_DEMANGLED_NAME (msymbol); - if (symname == NULL) - symname = DEPRECATED_SYMBOL_NAME (msymbol); + symname = SYMBOL_NATURAL_NAME (msymbol); if (symname == NULL) continue; @@ -1386,10 +1372,8 @@ find_methods (struct symtab *symtab, char type, sym = find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol)); if (sym != NULL) { - const char *newsymname = SYMBOL_DEMANGLED_NAME (sym); + const char *newsymname = SYMBOL_NATURAL_NAME (sym); - if (newsymname == NULL) - newsymname = DEPRECATED_SYMBOL_NAME (sym); if (strcmp (symname, newsymname) == 0) { /* Found a high-level method sym: swap it into the diff --git a/gdb/remote-vxsparc.c b/gdb/remote-vxsparc.c index eb59b9f..a97c18e 100644 --- a/gdb/remote-vxsparc.c +++ b/gdb/remote-vxsparc.c @@ -97,10 +97,9 @@ vx_read_register (int regno) bcopy (&sparc_greg_packet[SPARC_R_Y], &deprecated_registers[REGISTER_BYTE (Y_REGNUM)], 6 * SPARC_GREG_SIZE); - /* Now write the local and in registers to the register window - spill area in the frame. VxWorks does not do this for the - active frame automatically; it greatly simplifies debugging - (FRAME_FIND_SAVED_REGS, in particular, depends on this). */ + /* Now write the local and in registers to the register window spill + area in the frame. VxWorks does not do this for the active frame + automatically; it greatly simplifies debugging. */ sp = extract_address (&deprecated_registers[REGISTER_BYTE (SP_REGNUM)], REGISTER_RAW_SIZE (SP_REGNUM)); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index ef33028..08394de 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -990,7 +990,7 @@ rs6000_pop_frame (void) still in the link register, otherwise walk the frames and retrieve the saved %pc value in the previous frame. */ - addr = get_pc_function_start (get_frame_pc (frame)); + addr = get_frame_func (frame); (void) skip_prologue (addr, get_frame_pc (frame), &fdata); wordsize = gdbarch_tdep (current_gdbarch)->wordsize; @@ -1499,7 +1499,7 @@ rs6000_frameless_function_invocation (struct frame_info *fi) && !(get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME)) return 0; - func_start = get_pc_function_start (get_frame_pc (fi)); + func_start = get_frame_func (fi); /* If we failed to find the start of the function, it is a mistake to inspect the instructions. */ @@ -1540,7 +1540,7 @@ rs6000_frame_saved_pc (struct frame_info *fi) return deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), PC_REGNUM); - func_start = get_pc_function_start (get_frame_pc (fi)); + func_start = get_frame_func (fi); /* If we failed to find the start of the function, it is a mistake to inspect the instructions. */ @@ -1596,8 +1596,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap) if (fdatap == NULL) { fdatap = &work_fdata; - (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)), - get_frame_pc (fi), fdatap); + (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), fdatap); } frame_saved_regs_zalloc (fi); @@ -1720,8 +1719,7 @@ frame_initial_stack_address (struct frame_info *fi) /* Find out if this function is using an alloca register. */ - (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)), - get_frame_pc (fi), &fdata); + (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), &fdata); /* If saved registers of this frame are not known yet, read and cache them. */ @@ -2741,9 +2739,9 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else { arch = bfd_arch_powerpc; - mach = 0; - bfd_default_set_arch_mach (&abfd, arch, mach); + bfd_default_set_arch_mach (&abfd, arch, 0); info.bfd_arch_info = bfd_get_arch_info (&abfd); + mach = info.bfd_arch_info->mach; } tdep = xmalloc (sizeof (struct gdbarch_tdep)); tdep->wordsize = wordsize; diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index deff25d..2f8f4ff 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -775,7 +775,7 @@ s390_function_start (struct frame_info *fi) if (get_frame_extra_info (fi) && get_frame_extra_info (fi)->initialised) function_start = get_frame_extra_info (fi)->function_start; else if (get_frame_pc (fi)) - function_start = get_pc_function_start (get_frame_pc (fi)); + function_start = get_frame_func (fi); return function_start; } diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c index e4060d2..dab1647 100644 --- a/gdb/sentinel-frame.c +++ b/gdb/sentinel-frame.c @@ -83,6 +83,8 @@ sentinel_frame_this_id (struct frame_info *next_frame, const struct frame_unwind sentinel_frame_unwinder = { + /* Should the sentinel frame be given a special type? */ + NORMAL_FRAME, sentinel_frame_this_id, sentinel_frame_prev_register }; diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 804b34a..d30586c 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1116,7 +1116,7 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); @@ -1456,7 +1456,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); @@ -1657,7 +1657,7 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 0e57aef..da50574 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -41,6 +41,7 @@ #endif #include "gdbcore.h" +#include "gdb_assert.h" #include "symfile.h" /* for 'entry_point_address' */ @@ -1133,9 +1134,7 @@ sparc_frame_find_saved_regs (struct frame_info *fi, CORE_ADDR *saved_regs_addr) register int regnum; CORE_ADDR frame_addr = get_frame_base (fi); - if (!fi) - internal_error (__FILE__, __LINE__, - "Bad frame info struct in FRAME_FIND_SAVED_REGS"); + gdb_assert (fi != NULL); memset (saved_regs_addr, 0, NUM_REGS * sizeof (CORE_ADDR)); diff --git a/gdb/stack.c b/gdb/stack.c index 27fcaf6..2cb9a95 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -216,7 +216,7 @@ print_frame_info (struct frame_info *fi, int level, int source, int args) if (ui_out_is_mi_like_p (uiout)) { annotate_frame_address (); - ui_out_field_core_addr (uiout, "addr", fi->pc); + ui_out_field_core_addr (uiout, "addr", get_frame_pc (fi)); annotate_frame_address_end (); } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 0cadc56..981ba36 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2003-04-05 Stephane Carrez <stcarrez@nerim.fr> + + * gdb.base/break.exp: marker4() is defined at line 46 when compiled + with -DPROTOTYPES. + +2003-04-05 Stephane Carrez <stcarrez@nerim.fr> + + * gdb.base/break.exp: Revert last patch. + +2003-04-04 Stephane Carrez <stcarrez@nerim.fr> + + * gdb.base/break.exp: marker4() is defined at line 46 when compiled + with -DPROTOTYPES. + 2003-04-02 Andrew Cagney <cagney@redhat.com> * gdb.base/callfuncs.exp: Make "print add" messages unique. diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index fbc0e11..38820ec 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -914,6 +914,10 @@ gdb_expect { -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile:51\[\r\n\]+51\[\t \]+void marker4.*" { pass "run until breakpoint set at small function, optimized file" } + -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:46\[\r\n\]+46\[\t \]+void marker4.*" { + # marker4() is defined at line 46 when compiled with -DPROTOTYPES + pass "run until breakpoint set at small function, optimized file (line 46)" + } -re ".*$gdb_prompt " { fail "run until breakpoint set at small function, optimized file" } diff --git a/gdb/valprint.c b/gdb/valprint.c index b1c47a1..d4b8bf5 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -205,12 +205,8 @@ val_print_type_code_int (struct type *type, char *valaddr, } else { -#ifdef PRINT_TYPELESS_INTEGER - PRINT_TYPELESS_INTEGER (stream, type, unpack_long (type, valaddr)); -#else print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0, unpack_long (type, valaddr)); -#endif } } diff --git a/gdb/version.in b/gdb/version.in index 8ba75cc..6ec3c5d 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2003-04-03-cvs +2003-04-06-cvs diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 5d43e01..24b77af 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -471,6 +471,8 @@ classify_argument (struct type *type, return 2; } break; + case TYPE_CODE_ENUM: + case TYPE_CODE_REF: case TYPE_CODE_INT: case TYPE_CODE_PTR: switch (bytes) @@ -700,11 +702,17 @@ x86_64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, intreg += 2; break; case X86_64_INTEGERSI_CLASS: - deprecated_write_register_gen (int_parameter_registers[intreg / 2], - VALUE_CONTENTS_ALL (args[i]) + offset); - offset += 8; - intreg++; - break; + { + LONGEST num + = extract_signed_integer (VALUE_CONTENTS_ALL (args[i]) + + offset, 4); + regcache_raw_write_signed (current_regcache, + int_parameter_registers[intreg / 2], num); + + offset += 8; + intreg++; + break; + } case X86_64_SSEDF_CLASS: case X86_64_SSESF_CLASS: case X86_64_SSE_CLASS: @@ -936,12 +944,9 @@ x86_64_save_dummy_frame_tos (CORE_ADDR sp) static struct frame_id x86_64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *frame) { - struct frame_id id; - - id.pc = frame_pc_unwind (frame); - frame_unwind_unsigned_register (frame, SP_REGNUM, &id.base); - - return id; + CORE_ADDR base; + frame_unwind_unsigned_register (frame, SP_REGNUM, &base); + return frame_id_build (base, frame_pc_unwind (frame)); } void |