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] ia64-tdep.c: Don't let nop.b terminate prologue scan


I've just committed the patch below.

It turns out that the IA-64 prologue scanner was sometimes terminating
too early due to a nop.b instruction.  E.g, in the following code...

0x40000000001575c0 <catch_errors>:      [MII]       alloc r37=ar.pfs,7,6,0
0x40000000001575c1 <catch_errors+1>:                adds r12=-784,r12;;
0x40000000001575c2 <catch_errors+2>:                adds r16=736,r12
0x40000000001575d0 <catch_errors+16>:   [MFI]       adds r17=720,r12
0x40000000001575d1 <catch_errors+17>:               nop.f 0x0
0x40000000001575d2 <catch_errors+18>:               addl r14=4304,r1;;
0x40000000001575e0 <catch_errors+32>:   [MMB]       st4 [r16]=r35
0x40000000001575e1 <catch_errors+33>:               st8 [r17]=r32
0x40000000001575e2 <catch_errors+34>:               nop.b 0x0
0x40000000001575f0 <catch_errors+48>:   [MII]       ld8 r14=[r14]
0x40000000001575f1 <catch_errors+49>:               adds r16=728,r12
0x40000000001575f2 <catch_errors+50>:               adds r17=768,r12
0x4000000000157600 <catch_errors+64>:   [MMI]       addl r15=6320,r1;;
0x4000000000157601 <catch_errors+65>:               st8 [r16]=r33
0x4000000000157602 <catch_errors+66>:               nop.i 0x0
0x4000000000157610 <catch_errors+80>:   [MFI]       ld8 r15=[r15]
0x4000000000157611 <catch_errors+81>:               nop.f 0x0
0x4000000000157612 <catch_errors+82>:               mov r36=b0
0x4000000000157620 <catch_errors+96>:   [MMI]       ld8 r16=[r14];;

...the prologue scanner was stopping at catch_errors+34 due to the
fact that this nop is a branch unit nop.  But, in order to figure out
where the next frame is, the instruction at catch_errors+82 needs to
be included in the prologue.

	* ia64-tdep.c (examine_prologue): Don't let a branch unit nop
	terminate the prologue scan.

Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.22
diff -u -p -r1.22 ia64-tdep.c
--- ia64-tdep.c	2001/08/01 18:39:23	1.22
+++ ia64-tdep.c	2001/08/31 19:54:51
@@ -860,10 +860,11 @@ examine_prologue (CORE_ADDR pc, CORE_ADD
       if (next_pc == 0)
 	break;
 
-      if (it == B || ((instr & 0x3fLL) != 0LL))
+      if ((it == B && ((instr & 0x1e1f800003f) != 0x04000000000))
+          || ((instr & 0x3fLL) != 0LL))
 	{
-	  /* Exit loop upon hitting a branch instruction or a predicated
-	     instruction. */
+	  /* Exit loop upon hitting a non-nop branch instruction 
+	     or a predicated instruction. */
 	  break;
 	}
       else if (it == I && ((instr & 0x1eff8000000LL) == 0x00188000000LL))


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