This is the mail archive of the gdb-patches@sources.redhat.com 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]

[PATCH]: Fix frame unwinding for 68hc11


Hi!

I've commited the following patch to fix the frame for 68hc11.

 - the function prologue can contain a 'des' instruction to allocate 1 byte
   this must be taken into account to correctly compute the frame offset.
 - the frame was not correct when traversing a function called by gdb.

	Stephane

2000-09-06  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* m68hc11-tdep.c (m68hc11_frame_chain): Check for pc in call dummy.
	(m68hc11_guess_from_prologue): 'des' instruction to allocate 1 byte
	on the stack can appear in the prologue.
Index: m68hc11-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
retrieving revision 1.4
diff -p -r1.4 m68hc11-tdep.c
*** m68hc11-tdep.c	2000/08/29 19:12:27	1.4
--- m68hc11-tdep.c	2000/09/05 20:52:43
*************** m68hc11_guess_from_prologue (CORE_ADDR p
*** 378,383 ****
--- 378,384 ----
  #define OP_ADDD (0xc3)
  #define OP_TXS  (0x35)
  #define OP_TYS  (0x35)
+ #define OP_DES  (0x34)
  
    /* The 68hc11 stack is as follows:
  
*************** m68hc11_guess_from_prologue (CORE_ADDR p
*** 469,474 ****
--- 470,481 ----
            add_sp_mode  = 1;
            pc += 2;
          }
+       /* des to allocate 1 byte on the stack */
+       else if (op0 == OP_DES)
+         {
+           pc += 1;
+           size += 1;
+         }
        else if (op0 == OP_PAGE2 && op1 == OP_TSY && op2 == OP_PAGE2)
          {
            op0 = read_memory_unsigned_integer (pc + 3, 1);
*************** static CORE_ADDR
*** 614,619 ****
--- 621,629 ----
  m68hc11_frame_chain (struct frame_info *frame)
  {
    CORE_ADDR addr;
+ 
+   if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+     return frame->frame;	/* dummy frame same as caller's frame */
  
    if (frame->extra_info->return_pc == 0
        || inside_entry_file (frame->extra_info->return_pc))

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