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]
Other format: [Raw text]

Re: [testsuite/alpha] Add test for step over fbne instruction


On Fri, May 20, 2005 at 01:42:54PM +1000, Joel Brobecker wrote:
> int
> main (void)
> {
>   gt ();
> 
>   return 0;
> }
> 
> /* gt(). Obtained from the following code:
> 
>    void
>    gt (void)
>    {
>      double a = 360.0;
>    
>      if (a > 0)
>        a = 0.0;
>      else
>        a = -a;
>    }
> 
>   The purpose of the test is to stop just before the check against
>   zero, and do a stepi. GDB should step one instruction and stop,
>   rather than letting the program continue until the it terminates.  */
> 
> asm("        .rdata\n"
>     "        .align 3\n"

.rdata is an ecoff thing; it won't work for elf systems.  I suggest
that you pass in this data from main and leave the symbol work to 
the compiler.  That is,

	extern double gt(double);
	int main ()
	{
	  gt (360.0);
	  gt (-360.0);
	  return 0;
	}

	/* double gt(double a)
	   {
	     if (a > 0)
	       a = 0;
	     else
	       a = -a;
	     return a;
	   }
	*/

	asm (
	"	.text\n"
	"	.ent gt\n"
	"gt:\n"
	"	.frame $30,0,$26,0"
	"	.prologue 0\n"
	"	cpys $f31,$f31,$f0\n"
	"	fble $f16,$gt_1\n"	/* stop at this instruction.  */
	"	cpysn $f16,$f16,$f0\n"
	"$gt_1:\n"
	"	ret $31,($26),1\n"
	"        .end gt\n");

I might also suggest that you test both branch directions.


r~


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