This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

about arm_scan_prologue


For the prologue, there're two versions.

    mov    ip, sp
    stmfd  sp!, {fp, ip, lr, pc}
    sub    fp, ip, #4
    [sub sp, sp, #4]

    mov    ip, sp
    stmfd  sp!, {a1, a2, a3, a4}
    stmfd  sp!, {fp, ip, lr, pc}
    sub    fp, ip, #20

When no symbol information exists, the function arm_scan_prologue get
the prologue start address through the value of PC stored in this
frame, which equals the address of the instruction 'stmfd sp!,
{fp,ip,lr,pc}', plus 8.
But what about the instruction 'mov ip,sp', and the 'stmfd
sp!,{a1,a2,a3,a4}' before the 'stmfd sp!, {fp,ip,lr,pc}', are they
lost?

Here's the sorce codes fragment of arm_scan_prologue.

if (find_pc_partial_function (prev_pc, NULL, &prologue_start,
&prologue_end))   // when symbol infomation exists
{
  if (prologue_end > prologue_start + 64)
  {
      prologue_end = prologue_start + 64;
  }
}
  else
    {
      /* We have no symbol information.  Our only option is to assume this
     function has a standard stack frame and the normal frame register.
     Then, we can find the value of our frame pointer on entrance to
     the callee (or at the present moment if this is the innermost frame).
     The value stored there should be the address of the stmfd + 8.  */
      CORE_ADDR frame_loc;
      LONGEST return_value;

      frame_loc = frame_unwind_register_unsigned (next_frame, ARM_FP_REGNUM);
      if (!safe_read_memory_integer (frame_loc, 4, &return_value))
         return;
      else
        {
          prologue_start = gdbarch_addr_bits_remove
                 (gdbarch, return_value) - 8;
          prologue_end = prologue_start + 64;   /* See above.  */
        }
    }


Thank you!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]