diff options
author | Peter Schauer <Peter.Schauer@mytum.de> | 1994-01-19 20:45:30 +0000 |
---|---|---|
committer | Peter Schauer <Peter.Schauer@mytum.de> | 1994-01-19 20:45:30 +0000 |
commit | f1de67d323b4f897fdb70efd870e6d9ba0cee21b (patch) | |
tree | e7806f3c81c50b454ce0099e4bb056d981453a62 /gdb | |
parent | 59502c19ad5401de4d4571a10032eb5a3dd786c3 (diff) | |
download | gdb-f1de67d323b4f897fdb70efd870e6d9ba0cee21b.zip gdb-f1de67d323b4f897fdb70efd870e6d9ba0cee21b.tar.gz gdb-f1de67d323b4f897fdb70efd870e6d9ba0cee21b.tar.bz2 |
* infrun.c (normal_stop): Set stop_pc after popping the dummy frame
in case execution was stopped in the called function.
* stack.c (print_frame_info, frame_info): If backtracing through
a call dummy, handle the starting source line number on a line
boundary like backtracing through sigtramp.
* sparc-tdep.c (sparc_frame_find_saved_regs): Get frame address
for call dummy frame right. Remove old test for dummy frame,
it has been unused at least since gdb-3.5.
* sparc-tdep.c (sparc_push_dummy_frame): Set return address register
of the dummy frame.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/infrun.c | 4 | ||||
-rw-r--r-- | gdb/sparc-tdep.c | 95 | ||||
-rw-r--r-- | gdb/stack.c | 29 |
4 files changed, 80 insertions, 61 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f02af1b..e05f528 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +Wed Jan 19 12:40:25 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * infrun.c (normal_stop): Set stop_pc after popping the dummy frame + in case execution was stopped in the called function. + * stack.c (print_frame_info, frame_info): If backtracing through + a call dummy, handle the starting source line number on a line + boundary like backtracing through sigtramp. + * sparc-tdep.c (sparc_frame_find_saved_regs): Get frame address + for call dummy frame right. Remove old test for dummy frame, + it has been unused at least since gdb-3.5. + * sparc-tdep.c (sparc_push_dummy_frame): Set return address register + of the dummy frame. + Tue Jan 18 16:16:35 1994 Jim Kingdon (kingdon@lioth.cygnus.com) * infcmd.c (signal_command): Accept 0 as legitimate signal number. diff --git a/gdb/infrun.c b/gdb/infrun.c index f831f5a..9549bce 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1381,6 +1381,10 @@ Further execution is probably impossible.\n"); POP_FRAME ends with a setting of the current frame, so we can use that next. */ POP_FRAME; + /* Set stop_pc to what it was before we called the function. Can't rely + on restore_inferior_status because that only gets called if we don't + stop in the called function. */ + stop_pc = read_pc(); select_frame (get_current_frame (), 0); } } diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 62e8a18..dc7b191 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -89,7 +89,7 @@ single_step (ignore) npc4 = next_pc + 4; /* branch not taken */ target_insert_breakpoint (next_pc, break_mem[0]); - /* printf ("set break at %x\n",next_pc); */ + /* printf_unfiltered ("set break at %x\n",next_pc); */ pc = read_register (PC_REGNUM); pc_instruction = read_memory_integer (pc, sizeof(pc_instruction)); @@ -138,25 +138,24 @@ CORE_ADDR sparc_frame_chain (thisframe) FRAME thisframe; { - REGISTER_TYPE retval; + char buf[MAX_REGISTER_RAW_SIZE]; int err; CORE_ADDR addr; addr = thisframe->frame + FRAME_SAVED_I0 + REGISTER_RAW_SIZE (FP_REGNUM) * (FP_REGNUM - I0_REGNUM); - err = target_read_memory (addr, (char *) &retval, sizeof (REGISTER_TYPE)); + err = target_read_memory (addr, buf, REGISTER_RAW_SIZE (FP_REGNUM)); if (err) return 0; - return extract_address (&retval, sizeof (retval)); + return extract_address (buf, REGISTER_RAW_SIZE (FP_REGNUM)); } CORE_ADDR sparc_extract_struct_value_address (regbuf) char regbuf[REGISTER_BYTES]; { - /* FIXME, handle byte swapping */ return read_memory_integer (((int *)(regbuf))[SP_REGNUM]+(16*4), - sizeof (CORE_ADDR)); + TARGET_PTR_BIT / TARGET_CHAR_BIT); } /* Find the pc saved in frame FRAME. */ @@ -165,13 +164,13 @@ CORE_ADDR frame_saved_pc (frame) FRAME frame; { - REGISTER_TYPE retval; + char buf[MAX_REGISTER_RAW_SIZE]; CORE_ADDR addr; addr = (frame->bottom + FRAME_SAVED_I0 + REGISTER_RAW_SIZE (I7_REGNUM) * (I7_REGNUM - I0_REGNUM)); - read_memory (addr, (char *) &retval, sizeof (REGISTER_TYPE)); - return PC_ADJUST (extract_address (&retval, sizeof (REGISTER_TYPE))); + read_memory (addr, buf, REGISTER_RAW_SIZE (I7_REGNUM)); + return PC_ADJUST (extract_address (buf, REGISTER_RAW_SIZE (I7_REGNUM))); } /* @@ -369,7 +368,7 @@ sparc_frame_find_saved_regs (fi, saved_regs_addr) struct frame_saved_regs *saved_regs_addr; { register int regnum; - FRAME_ADDR frame = read_register (FP_REGNUM); + FRAME_ADDR frame = FRAME_FP(fi); FRAME fid = FRAME_INFO_ID (fi); if (!fid) @@ -377,10 +376,6 @@ sparc_frame_find_saved_regs (fi, saved_regs_addr) memset (saved_regs_addr, 0, sizeof (*saved_regs_addr)); - /* Old test. - if (fi->pc >= frame - CALL_DUMMY_LENGTH - 0x140 - && fi->pc <= frame) */ - if (fi->pc >= (fi->bottom ? fi->bottom : read_register (SP_REGNUM)) && fi->pc <= FRAME_FP(fi)) @@ -427,57 +422,41 @@ sparc_frame_find_saved_regs (fi, saved_regs_addr) We save the non-windowed registers and the ins. The locals and outs are new; they don't need to be saved. The i's and l's of - the last frame were already saved on the stack - - The return pointer register %i7 does not have the pc saved into it - (return from this frame will be accomplished by a POP_FRAME). In - fact, we must leave it unclobbered, since we must preserve it in - the calling routine except across call instructions. I'm not sure - the preceding sentence is true; isn't it based on confusing the %i7 - saved in the dummy frame versus the one saved in the frame of the - calling routine? */ + the last frame were already saved on the stack. */ /* Definitely see tm-sparc.h for more doc of the frame format here. */ void sparc_push_dummy_frame () { - CORE_ADDR sp; - char register_temp[REGISTER_BYTES]; + CORE_ADDR sp, old_sp; + char register_temp[0x140]; - sp = read_register (SP_REGNUM); + old_sp = sp = read_register (SP_REGNUM); - read_register_bytes (REGISTER_BYTE (FP0_REGNUM), register_temp, - REGISTER_RAW_SIZE (FP0_REGNUM) * 32); - write_memory (sp - 0x80, register_temp, REGISTER_RAW_SIZE (FP0_REGNUM) * 32); + /* Y, PS, WIM, TBR, PC, NPC, FPS, CPS regs */ + read_register_bytes (REGISTER_BYTE (Y_REGNUM), ®ister_temp[0], + REGISTER_RAW_SIZE (Y_REGNUM) * 8); - read_register_bytes (REGISTER_BYTE (G0_REGNUM), register_temp, + read_register_bytes (REGISTER_BYTE (O0_REGNUM), ®ister_temp[8 * 4], + REGISTER_RAW_SIZE (O0_REGNUM) * 8); + + read_register_bytes (REGISTER_BYTE (G0_REGNUM), ®ister_temp[16 * 4], REGISTER_RAW_SIZE (G0_REGNUM) * 8); - write_memory (sp - 0xa0, register_temp, REGISTER_RAW_SIZE (G0_REGNUM) * 8); - read_register_bytes (REGISTER_BYTE (O0_REGNUM), register_temp, - REGISTER_RAW_SIZE (O0_REGNUM) * 8); - write_memory (sp - 0xc0, register_temp, REGISTER_RAW_SIZE (O0_REGNUM) * 8); + read_register_bytes (REGISTER_BYTE (FP0_REGNUM), ®ister_temp[24 * 4], + REGISTER_RAW_SIZE (FP0_REGNUM) * 32); - /* Y, PS, WIM, TBR, PC, NPC, FPS, CPS regs */ - read_register_bytes (REGISTER_BYTE (Y_REGNUM), register_temp, - REGISTER_RAW_SIZE (Y_REGNUM) * 8); - write_memory (sp - 0xe0, register_temp, REGISTER_RAW_SIZE (Y_REGNUM) * 8); - - { - CORE_ADDR old_sp = sp; - - /* Now move the stack pointer (equivalent to the add part of a save - instruction). */ - sp -= 0x140; - write_register (SP_REGNUM, sp); - - /* Now make sure that the frame pointer we save in the new frame points - to the old frame (equivalent to the register window shift part of - a save instruction). Need to do this after the write to the sp, or - else this might get written into the wrong set of saved ins&locals. */ - write_register (FP_REGNUM, old_sp); - } + sp -= 0x140; + + write_register (SP_REGNUM, sp); + + write_memory (sp + 0x60, ®ister_temp[0], (8 + 8 + 8 + 32) * 4); + + write_register (FP_REGNUM, old_sp); + + /* Set return address register for the call dummy to the current PC. */ + write_register (I7_REGNUM, read_pc() - 8); } /* Discard from the stack the innermost frame, restoring all saved registers. @@ -510,6 +489,16 @@ sparc_pop_frame () read_memory (fsr.regs[FP0_REGNUM], raw_buffer, 32 * 4); write_register_bytes (REGISTER_BYTE (FP0_REGNUM), raw_buffer, 32 * 4); } + if (fsr.regs[FPS_REGNUM]) + { + read_memory (fsr.regs[FPS_REGNUM], raw_buffer, 4); + write_register_bytes (REGISTER_BYTE (FPS_REGNUM), raw_buffer, 4); + } + if (fsr.regs[CPS_REGNUM]) + { + read_memory (fsr.regs[CPS_REGNUM], raw_buffer, 4); + write_register_bytes (REGISTER_BYTE (CPS_REGNUM), raw_buffer, 4); + } if (fsr.regs[G1_REGNUM]) { read_memory (fsr.regs[G1_REGNUM], raw_buffer, 7 * 4); diff --git a/gdb/stack.c b/gdb/stack.c index 2112053..747afda 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -222,12 +222,14 @@ print_frame_info (fi, level, source, args) /* If fi is not the innermost frame, that normally means that fi->pc points to *after* the call instruction, and we want to get the line containing the call, never the next line. But if the next frame is - a signal_handler_caller frame, then the next frame was not entered - as the result of a call, and we want to get the line containing - fi->pc. */ + a signal_handler_caller or a dummy frame, then the next frame was + not entered as the result of a call, and we want to get the line + containing fi->pc. */ sal = find_pc_line (fi->pc, - fi->next != NULL && fi->next->signal_handler_caller == 0); + fi->next != NULL + && !fi->next->signal_handler_caller + && !frame_in_dummy (fi->next)); func = find_pc_function (fi->pc); if (func) @@ -466,7 +468,9 @@ frame_info (addr_exp, from_tty) fi = get_frame_info (frame); sal = find_pc_line (fi->pc, - fi->next != NULL && fi->next->signal_handler_caller == 0); + fi->next != NULL + && !fi->next->signal_handler_caller + && !frame_in_dummy (fi->next)); func = get_frame_function (frame); s = find_pc_symtab(fi->pc); if (func) @@ -597,6 +601,8 @@ frame_info (addr_exp, from_tty) } if (count) puts_filtered ("\n"); +#else /* Have FRAME_FIND_SAVED_REGS. */ + puts_filtered ("\n"); #endif /* Have FRAME_FIND_SAVED_REGS. */ } @@ -746,15 +752,22 @@ print_block_frame_locals (b, frame, stream) for (i = 0; i < nsyms; i++) { sym = BLOCK_SYM (b, i); - if (SYMBOL_CLASS (sym) == LOC_LOCAL - || SYMBOL_CLASS (sym) == LOC_REGISTER - || SYMBOL_CLASS (sym) == LOC_STATIC) + switch (SYMBOL_CLASS (sym)) { + case LOC_LOCAL: + case LOC_REGISTER: + case LOC_STATIC: + case LOC_BASEREG: values_printed = 1; fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream); fputs_filtered (" = ", stream); print_variable_value (sym, frame, stream); fprintf_filtered (stream, "\n"); + break; + + default: + /* Ignore symbols which are not locals. */ + break; } } return values_printed; |