mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-18 13:23:10 +08:00
2005-03-21 Michael Snyder <msnyder@redhat.com>
* mn10300-prologue.c (fix_frame_pointer): Delete. (set_movm_offsets) Don't return just because movm_args is zero -- still need to save pc and sp in saved_regs. (mn10300_analyze_prologue): Don't return prematurely without calling set_movm_offsets (for pc and sp at minimum).
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2005-03-21 Michael Snyder <msnyder@redhat.com>
|
||||||
|
|
||||||
|
* mn10300-prologue.c (fix_frame_pointer): Delete.
|
||||||
|
(set_movm_offsets) Don't return just because movm_args is
|
||||||
|
zero -- still need to save pc and sp in saved_regs.
|
||||||
|
(mn10300_analyze_prologue): Don't return prematurely without
|
||||||
|
calling set_movm_offsets (for pc and sp at minimum).
|
||||||
|
|
||||||
2005-03-21 Mark Mitchell <mark@codesourcery.com>
|
2005-03-21 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
* configure.ac (stat.st_blksize): Check for it.
|
* configure.ac (stat.st_blksize): Check for it.
|
||||||
|
@ -107,28 +107,6 @@ set_my_stack_size (struct frame_info *fi, CORE_ADDR size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Fix fi->frame if it's bogus at this point. This is a helper
|
|
||||||
function for mn10300_analyze_prologue.
|
|
||||||
|
|
||||||
MVS: This later became frame_base_hack, and probably now
|
|
||||||
could just be trad_frame_set_this_base.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
fix_frame_pointer (struct frame_info *fi, int stack_size)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if (fi && get_next_frame (fi) == NULL)
|
|
||||||
{
|
|
||||||
if (is_my_frame_in_sp (fi))
|
|
||||||
deprecated_update_frame_base_hack (fi, read_sp () - stack_size);
|
|
||||||
else if (is_my_frame_in_fp (fi))
|
|
||||||
deprecated_update_frame_base_hack (fi, read_register (E_A3_REGNUM));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Set offsets of registers saved by movm instruction.
|
/* Set offsets of registers saved by movm instruction.
|
||||||
This is a helper function for mn10300_analyze_prologue. */
|
This is a helper function for mn10300_analyze_prologue. */
|
||||||
|
|
||||||
@ -141,7 +119,7 @@ set_movm_offsets (struct frame_info *fi,
|
|||||||
int offset = 0;
|
int offset = 0;
|
||||||
CORE_ADDR base;
|
CORE_ADDR base;
|
||||||
|
|
||||||
if (cache == NULL || fi == NULL || movm_args == 0)
|
if (cache == NULL || fi == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cache = mn10300_frame_unwind_cache (fi, this_cache);
|
cache = mn10300_frame_unwind_cache (fi, this_cache);
|
||||||
@ -329,13 +307,21 @@ mn10300_analyze_prologue (struct frame_info *fi,
|
|||||||
pc = (fi ? get_frame_pc (fi) : pc);
|
pc = (fi ? get_frame_pc (fi) : pc);
|
||||||
But this is (now) badly broken when called from analyze_dummy_frame().
|
But this is (now) badly broken when called from analyze_dummy_frame().
|
||||||
*/
|
*/
|
||||||
pc = (pc ? pc : get_frame_pc (fi));
|
if (fi)
|
||||||
|
{
|
||||||
|
pc = (pc ? pc : get_frame_pc (fi));
|
||||||
|
/* At the start of a function our frame is in the stack pointer. */
|
||||||
|
my_frame_is_in_sp (fi, this_cache);
|
||||||
|
}
|
||||||
|
|
||||||
/* Find the start of this function. */
|
/* Find the start of this function. */
|
||||||
status = find_pc_partial_function (pc, &name, &func_addr, &func_end);
|
status = find_pc_partial_function (pc, &name, &func_addr, &func_end);
|
||||||
|
|
||||||
/* Do nothing if we couldn't find the start of this function or if we're
|
/* Do nothing if we couldn't find the start of this function
|
||||||
stopped at the first instruction in the prologue. */
|
|
||||||
|
MVS: comment went on to say "or if we're stopped at the first
|
||||||
|
instruction in the prologue" -- but code doesn't reflect that,
|
||||||
|
and I don't want to do that anyway. */
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
{
|
{
|
||||||
return pc;
|
return pc;
|
||||||
@ -349,10 +335,6 @@ mn10300_analyze_prologue (struct frame_info *fi,
|
|||||||
return pc;
|
return pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At the start of a function our frame is in the stack pointer. */
|
|
||||||
if (fi)
|
|
||||||
my_frame_is_in_sp (fi, this_cache);
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Get the next two bytes into buf, we need two because rets is a two
|
/* Get the next two bytes into buf, we need two because rets is a two
|
||||||
byte insn and the first isn't enough to uniquely identify it. */
|
byte insn and the first isn't enough to uniquely identify it. */
|
||||||
@ -384,6 +366,10 @@ mn10300_analyze_prologue (struct frame_info *fi,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* NOTE: from here on, we don't want to return without jumping to
|
||||||
|
finish_prologue. */
|
||||||
|
|
||||||
|
|
||||||
/* Figure out where to stop scanning. */
|
/* Figure out where to stop scanning. */
|
||||||
stop = fi ? pc : func_end;
|
stop = fi ? pc : func_end;
|
||||||
|
|
||||||
@ -396,10 +382,7 @@ mn10300_analyze_prologue (struct frame_info *fi,
|
|||||||
/* Suck in two bytes. */
|
/* Suck in two bytes. */
|
||||||
if (addr + 2 >= stop
|
if (addr + 2 >= stop
|
||||||
|| (status = deprecated_read_memory_nobpt (addr, buf, 2)) != 0)
|
|| (status = deprecated_read_memory_nobpt (addr, buf, 2)) != 0)
|
||||||
{
|
goto finish_prologue;
|
||||||
fix_frame_pointer (fi, 0);
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* First see if this insn sets the stack pointer from a register; if
|
/* First see if this insn sets the stack pointer from a register; if
|
||||||
so, it's probably the initialization of the stack pointer in _start,
|
so, it's probably the initialization of the stack pointer in _start,
|
||||||
@ -408,7 +391,7 @@ mn10300_analyze_prologue (struct frame_info *fi,
|
|||||||
{
|
{
|
||||||
if (fi)
|
if (fi)
|
||||||
my_frame_is_last (fi);
|
my_frame_is_last (fi);
|
||||||
return addr;
|
goto finish_prologue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now look for movm [regs],sp, which saves the callee saved registers.
|
/* Now look for movm [regs],sp, which saves the callee saved registers.
|
||||||
@ -425,28 +408,12 @@ mn10300_analyze_prologue (struct frame_info *fi,
|
|||||||
|
|
||||||
/* Quit now if we're beyond the stop point. */
|
/* Quit now if we're beyond the stop point. */
|
||||||
if (addr >= stop)
|
if (addr >= stop)
|
||||||
{
|
goto finish_prologue;
|
||||||
/* Fix fi->frame since it's bogus at this point. */
|
|
||||||
if (fi && get_next_frame (fi) == NULL)
|
|
||||||
deprecated_update_frame_base_hack (fi, read_sp ());
|
|
||||||
|
|
||||||
/* Note if/where callee saved registers were saved. */
|
|
||||||
set_movm_offsets (fi, this_cache, movm_args);
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the next two bytes so the prologue scan can continue. */
|
/* Get the next two bytes so the prologue scan can continue. */
|
||||||
status = deprecated_read_memory_nobpt (addr, buf, 2);
|
status = deprecated_read_memory_nobpt (addr, buf, 2);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
{
|
goto finish_prologue;
|
||||||
/* Fix fi->frame since it's bogus at this point. */
|
|
||||||
if (fi && get_next_frame (fi) == NULL)
|
|
||||||
deprecated_update_frame_base_hack (fi, read_sp ());
|
|
||||||
|
|
||||||
/* Note if/where callee saved registers were saved. */
|
|
||||||
set_movm_offsets (fi, this_cache, movm_args);
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now see if we set up a frame pointer via "mov sp,a3" */
|
/* Now see if we set up a frame pointer via "mov sp,a3" */
|
||||||
@ -462,26 +429,12 @@ mn10300_analyze_prologue (struct frame_info *fi,
|
|||||||
|
|
||||||
/* Quit now if we're beyond the stop point. */
|
/* Quit now if we're beyond the stop point. */
|
||||||
if (addr >= stop)
|
if (addr >= stop)
|
||||||
{
|
goto finish_prologue;
|
||||||
/* Fix fi->frame if it's bogus at this point. */
|
|
||||||
fix_frame_pointer (fi, 0);
|
|
||||||
|
|
||||||
/* Note if/where callee saved registers were saved. */
|
|
||||||
set_movm_offsets (fi, this_cache, movm_args);
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get two more bytes so scanning can continue. */
|
/* Get two more bytes so scanning can continue. */
|
||||||
status = deprecated_read_memory_nobpt (addr, buf, 2);
|
status = deprecated_read_memory_nobpt (addr, buf, 2);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
{
|
goto finish_prologue;
|
||||||
/* Fix fi->frame if it's bogus at this point. */
|
|
||||||
fix_frame_pointer (fi, 0);
|
|
||||||
|
|
||||||
/* Note if/where callee saved registers were saved. */
|
|
||||||
set_movm_offsets (fi, this_cache, movm_args);
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next we should allocate the local frame. No more prologue insns
|
/* Next we should allocate the local frame. No more prologue insns
|
||||||
@ -508,14 +461,7 @@ mn10300_analyze_prologue (struct frame_info *fi,
|
|||||||
current frame. */
|
current frame. */
|
||||||
status = deprecated_read_memory_nobpt (addr + 2, buf, imm_size);
|
status = deprecated_read_memory_nobpt (addr + 2, buf, imm_size);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
{
|
goto finish_prologue;
|
||||||
/* Fix fi->frame if it's bogus at this point. */
|
|
||||||
fix_frame_pointer (fi, 0);
|
|
||||||
|
|
||||||
/* Note if/where callee saved registers were saved. */
|
|
||||||
set_movm_offsets (fi, this_cache, movm_args);
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Note the size of the stack in the frame info structure. */
|
/* Note the size of the stack in the frame info structure. */
|
||||||
stack_size = extract_signed_integer (buf, imm_size);
|
stack_size = extract_signed_integer (buf, imm_size);
|
||||||
@ -526,21 +472,13 @@ mn10300_analyze_prologue (struct frame_info *fi,
|
|||||||
addr += 2 + imm_size;
|
addr += 2 + imm_size;
|
||||||
|
|
||||||
/* No more prologue insns follow, so begin preparation to return. */
|
/* No more prologue insns follow, so begin preparation to return. */
|
||||||
/* Fix fi->frame if it's bogus at this point. */
|
goto finish_prologue;
|
||||||
fix_frame_pointer (fi, stack_size);
|
|
||||||
|
|
||||||
/* Note if/where callee saved registers were saved. */
|
|
||||||
set_movm_offsets (fi, this_cache, movm_args);
|
|
||||||
return addr;
|
|
||||||
}
|
}
|
||||||
|
/* Do the essentials and get out of here. */
|
||||||
/* We never found an insn which allocates local stack space, regardless
|
finish_prologue:
|
||||||
this is the end of the prologue. */
|
|
||||||
/* Fix fi->frame if it's bogus at this point. */
|
|
||||||
fix_frame_pointer (fi, 0);
|
|
||||||
|
|
||||||
/* Note if/where callee saved registers were saved. */
|
/* Note if/where callee saved registers were saved. */
|
||||||
set_movm_offsets (fi, this_cache, movm_args);
|
if (fi)
|
||||||
|
set_movm_offsets (fi, this_cache, movm_args);
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user