From eb8910888d7a68a958b78f5c6a36f2bd82e2b1a7 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Tue, 13 Dec 1994 01:11:49 +0000 Subject: [PATCH] Sparc flat register window support. * sparc-tdep.c (sparc_insn_layout): New union, defines layout of instructions symbolically (used to be local to skip_prologue). (sparc_init_extra_frame_info): New function. (sparc_frame_chain): Add flat cases throughout. (skip_prologue): Add recognition of flat prologues. (sparc_frame_find_saved_regs): Add flat cases. (sparc_pop_frame): Ditto. * config/sparc/tm-sparc.h (EXTRA_FRAME_INFO): New slots. (INIT_EXTRA_FRAME_INFO): Call sparc_init_extra_frame_info. (PRINT_EXTRA_FRAME_INFO): Define. --- gdb/ChangeLog | 14 +++++++++++++ gdb/config/sparc/tm-sparc.h | 42 +++++++++++++++++++++++++++---------- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index eab3a13d3b0..6436d706457 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +Mon Dec 12 17:08:02 1994 Stan Shebs + + Sparc flat register window support. + * sparc-tdep.c (sparc_insn_layout): New union, defines layout of + instructions symbolically (used to be local to skip_prologue). + (sparc_init_extra_frame_info): New function. + (sparc_frame_chain): Add flat cases throughout. + (skip_prologue): Add recognition of flat prologues. + (sparc_frame_find_saved_regs): Add flat cases. + (sparc_pop_frame): Ditto. + * config/sparc/tm-sparc.h (EXTRA_FRAME_INFO): New slots. + (INIT_EXTRA_FRAME_INFO): Call sparc_init_extra_frame_info. + (PRINT_EXTRA_FRAME_INFO): Define. + Mon Dec 12 16:59:29 1994 Stu Grossman (grossman@cygnus.com) * gdbtk.tcl (reg_config_menu create_registers_window diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index d4a682caf6a..36fb4e6e424 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -326,18 +326,38 @@ sparc_extract_struct_value_address PARAMS ((char [REGISTER_BYTES])); 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). */ - -#define EXTRA_FRAME_INFO CORE_ADDR bottom; -#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \ - (fci)->bottom = \ - ((fci)->next ? \ - ((fci)->frame == (fci)->next->frame ? \ - (fci)->next->bottom : (fci)->next->frame) : \ - read_register (SP_REGNUM)); + 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 flat; \ + CORE_ADDR pc_addr; \ + CORE_ADDR fp_addr; \ + +#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \ + sparc_init_extra_frame_info (fromleaf, fci) +extern void sparc_init_extra_frame_info (); + +#define PRINT_EXTRA_FRAME_INFO(fi) \ + { \ + if ((fi) && (fi)->flat) \ + printf_filtered (" flat, pc saved at 0x%x, fp saved at 0x%x\n", \ + (fi)->pc_addr, (fi)->fp_addr); \ + } #define FRAME_CHAIN(thisframe) (sparc_frame_chain (thisframe)) -CORE_ADDR sparc_frame_chain (); +extern CORE_ADDR sparc_frame_chain (); /* Define other aspects of the stack frame. */ @@ -358,7 +378,7 @@ CORE_ADDR sparc_frame_chain (); /* Where is the PC for a specific frame */ #define FRAME_SAVED_PC(FRAME) sparc_frame_saved_pc (FRAME) -CORE_ADDR sparc_frame_saved_pc (); +extern CORE_ADDR sparc_frame_saved_pc (); /* If the argument is on the stack, it will be here. */ #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) -- 2.30.2