aboutsummaryrefslogtreecommitdiff
path: root/gdb/rs6000-tdep.c
diff options
context:
space:
mode:
authorMichael Tiemann <tiemann@cygnus>1995-09-10 17:37:22 +0000
committerMichael Tiemann <tiemann@cygnus>1995-09-10 17:37:22 +0000
commit3a4f97862f047c2b299e3f04ca652142c7032ded (patch)
treefd3c8c65a03ab3061471db50f9dfe417c46a4018 /gdb/rs6000-tdep.c
parent0384d2e3df704ef422af71964c596d5ece533f32 (diff)
downloadgdb-3a4f97862f047c2b299e3f04ca652142c7032ded.zip
gdb-3a4f97862f047c2b299e3f04ca652142c7032ded.tar.gz
gdb-3a4f97862f047c2b299e3f04ca652142c7032ded.tar.bz2
Sun Sep 10 10:24:48 1995 Michael Tiemann <tiemann@axon.cygnus.com>
* tm-ppc-eabi.h (PC_IN_CALL_DUMMY): Redefine this to work with the simulator. FIXME. * rs6000-tdep.c (push_dummy_frame): Calculate the correct link register offset from the current frame (don't assume it is always 8). (push_dummy_frame): Add comment about having only 4096 bytes of stack space in the simulator (by default). * remote-sim.c (gdbsim_create_inferior): Call `add_text_to_loadinfo' so that gdb can find TOC entries when calling functions in the inferior. With this changes, it is now possible to correctly call inferior functions in the PPC simulator.
Diffstat (limited to 'gdb/rs6000-tdep.c')
-rw-r--r--gdb/rs6000-tdep.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index faade77..ca4bb72 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -445,6 +445,10 @@ push_dummy_frame ()
/* Same thing, target byte order. */
char pc_targ[4];
+ /* Needed to figure out where to save the dummy link area.
+ FIXME: There should be an easier way to do this, no? tiemann 9/9/95. */
+ struct rs6000_framedata fdata;
+
int ii;
target_fetch_registers (-1);
@@ -463,6 +467,8 @@ push_dummy_frame ()
pc = read_register(PC_REGNUM);
store_address (pc_targ, 4, pc);
+ (void) skip_prologue (get_pc_function_start (pc) + FUNCTION_START_OFFSET, &fdata);
+
dummy_frame_addr [dummy_frame_count++] = sp;
/* Be careful! If the stack pointer is not decremented first, then kernel
@@ -471,6 +477,10 @@ push_dummy_frame ()
before writing register values into the new frame, decrement and update
%sp first in order to secure your frame. */
+ /* FIXME: We don't check if the stack really has this much space.
+ This is a problem on the ppc simulator (which only grants one page
+ (4096 bytes) by default. */
+
write_register (SP_REGNUM, sp-DUMMY_FRAME_SIZE);
/* gdb relies on the state of current_frame. We'd better update it,
@@ -479,7 +489,7 @@ push_dummy_frame ()
flush_cached_frames ();
/* save program counter in link register's space. */
- write_memory (sp+8, pc_targ, 4);
+ write_memory (sp+fdata.lr_offset, pc_targ, 4);
/* save all floating point and general purpose registers here. */
@@ -550,7 +560,7 @@ pop_dummy_frame ()
&registers[REGISTER_BYTE (FPLAST_REGNUM + ii)], 4);
read_memory (sp-(DUMMY_FRAME_SIZE-8),
- &registers [REGISTER_BYTE(PC_REGNUM)], 4);
+ &registers [REGISTER_BYTE(PC_REGNUM)], 4);
/* when a dummy frame was being pushed, we had to decrement %sp first, in
order to secure astack space. Thus, saved %sp (or %r1) value, is not the