OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/tags/gdb/gdb-6.8/gdb-6.8.openrisc-2.1/gdb/testsuite/gdb.arch
    from Rev 24 to Rev 33
    Reverse comparison

Rev 24 → Rev 33

/alpha-step.c
0,0 → 1,116
/* Copyright 2005, 2007, 2008 Free Software Foundation, Inc.
 
This file is part of GDB.
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
void gt (double a);
 
int
main (void)
{
gt (360.0);
gt (-360.0);
 
ge (360.0);
ge (-360.0);
 
lt (-360.0);
lt (360.0);
 
le (-360.0);
le (360.0);
 
eq (0.0);
eq (360.0);
 
ne (360.0);
ne (0.0);
 
return 0;
}
 
asm (" .text\n"
" .ent gt\n"
"gt:\n"
" .frame $30,0,$26,0\n"
" .prologue 0\n"
" cpys $f31,$f31,$f0\n"
" fbgt $f16,$gt_1\n" /* stop at this instruction. */
" cpysn $f16,$f16,$f0\n"
"$gt_1:\n"
" ret $31,($26),1\n"
" .end gt\n");
 
asm (" .text\n"
" .ent ge\n"
"ge:\n"
" .frame $30,0,$26,0\n"
" .prologue 0\n"
" cpys $f31,$f31,$f0\n"
" fbge $f16,$ge_1\n" /* stop at this instruction. */
" cpysn $f16,$f16,$f0\n"
"$ge_1:\n"
" ret $31,($26),1\n"
" .end ge\n");
 
asm (" .text\n"
" .ent lt\n"
"lt:\n"
" .frame $30,0,$26,0\n"
" .prologue 0\n"
" cpys $f31,$f31,$f0\n"
" fblt $f16,$lt_1\n" /* stop at this instruction. */
" cpysn $f16,$f16,$f0\n"
"$lt_1:\n"
" ret $31,($26),1\n"
" .end lt\n");
 
asm (" .text\n"
" .ent le\n"
"le:\n"
" .frame $30,0,$26,0\n"
" .prologue 0\n"
" cpys $f31,$f31,$f0\n"
" fble $f16,$le_1\n" /* stop at this instruction. */
" cpysn $f16,$f16,$f0\n"
"$le_1:\n"
" ret $31,($26),1\n"
" .end le\n");
 
asm (" .text\n"
" .ent eq\n"
"eq:\n"
" .frame $30,0,$26,0\n"
" .prologue 0\n"
" cpys $f31,$f31,$f0\n"
" fbeq $f16,$eq_1\n" /* stop at this instruction. */
" cpysn $f16,$f16,$f0\n"
"$eq_1:\n"
" ret $31,($26),1\n"
" .end eq\n");
 
asm (" .text\n"
" .ent ne\n"
"ne:\n"
" .frame $30,0,$26,0\n"
" .prologue 0\n"
" cpys $f31,$f31,$f0\n"
" fbne $f16,$ne_1\n" /* stop at this instruction. */
" cpysn $f16,$f16,$f0\n"
"$ne_1:\n"
" ret $31,($26),1\n"
" .end ne\n");
 
 
alpha-step.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i386-cpuid.h =================================================================== --- i386-cpuid.h (nonexistent) +++ i386-cpuid.h (revision 33) @@ -0,0 +1,75 @@ +/* Helper file for i386 platform. Runtime check for MMX/SSE/SSE2 support. + + Copyright 2004, 2007, 2008 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Used by 20020523-2.c and i386-sse-6.c, and possibly others. */ +/* Plagarized from 20020523-2.c. */ +/* Plagarized from gcc. */ + +#define bit_CMOV (1 << 15) +#define bit_MMX (1 << 23) +#define bit_SSE (1 << 25) +#define bit_SSE2 (1 << 26) + +#ifndef NOINLINE +#define NOINLINE __attribute__ ((noinline)) +#endif + +unsigned int i386_cpuid (void) NOINLINE; + +unsigned int NOINLINE +i386_cpuid (void) +{ + int fl1, fl2; + +#ifndef __x86_64__ + /* See if we can use cpuid. On AMD64 we always can. */ + __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;" + "pushl %0; popfl; pushfl; popl %0; popfl" + : "=&r" (fl1), "=&r" (fl2) + : "i" (0x00200000)); + if (((fl1 ^ fl2) & 0x00200000) == 0) + return (0); +#endif + + /* Host supports cpuid. See if cpuid gives capabilities, try + CPUID(0). Preserve %ebx and %ecx; cpuid insn clobbers these, we + don't need their CPUID values here, and %ebx may be the PIC + register. */ +#ifdef __x86_64__ + __asm__ ("pushq %%rcx; pushq %%rbx; cpuid; popq %%rbx; popq %%rcx" + : "=a" (fl1) : "0" (0) : "rdx", "cc"); +#else + __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx" + : "=a" (fl1) : "0" (0) : "edx", "cc"); +#endif + if (fl1 == 0) + return (0); + + /* Invoke CPUID(1), return %edx; caller can examine bits to + determine what's supported. */ +#ifdef __x86_64__ + __asm__ ("pushq %%rcx; pushq %%rbx; cpuid; popq %%rbx; popq %%rcx" + : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc"); +#else + __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx" + : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc"); +#endif + + return fl2; +}
i386-cpuid.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i386-size.c =================================================================== --- i386-size.c (nonexistent) +++ i386-size.c (revision 33) @@ -0,0 +1,48 @@ +/* Symbol size test program. + + Copyright 2006, 2007, 2008 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifdef SYMBOL_PREFIX +#define SYMBOL(str) SYMBOL_PREFIX #str +#else +#define SYMBOL(str) #str +#endif + +void +trap (void) +{ + asm ("int $0x03"); +} + +/* Jump from a function with its symbol size set, to a function + named by a local label. If GDB does not look at the sizes of + symbols, we will still appear to be in the first function. */ + +asm(".text\n" + " .align 8\n" + " .globl " SYMBOL (main) "\n" + SYMBOL (main) ":\n" + " pushl %ebp\n" + " mov %esp, %ebp\n" + " call .Lfunc\n" + " ret\n" + " .size " SYMBOL (main) ", .-" SYMBOL (main) "\n" + ".Lfunc:\n" + " pushl %ebp\n" + " mov %esp, %ebp\n" + " call " SYMBOL (trap) "\n");
i386-size.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: powerpc-aix-prologue.exp =================================================================== --- powerpc-aix-prologue.exp (nonexistent) +++ powerpc-aix-prologue.exp (revision 33) @@ -0,0 +1,81 @@ +# Copyright 2004, 2007, 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + +# Test rs6000 prologue analyzer. + +set prms_id 0 +set bug_id 0 + +if ![istarget "powerpc-*-aix*"] then { + verbose "Skipping powerpc-aix prologue tests." + return +} + +set testfile "powerpc-aix-prologue" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } { + unsupported "Testcase compile failed." + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# Insert a breakpoint in FUNCTION and verifies that the breakpoint was +# inserted at the expected location. EXPECTED_LOCATION should be an +# offset relative to the function start address. +proc insert_breakpoint {function expected_location} { + global gdb_prompt + global expect_out + global hex + + set address "" + + # Insert a breakpoint using the given function name, and extract + # the breakpoint address for the output. + gdb_test_multiple "break $function" "set breakpoint in $function" { + -re "Breakpoint 1 at ($hex).*$gdb_prompt $" { + set address $expect_out(1,string) + } + default { + fail "set breakpoint in $function" + } + } + + # If we managed to get the breakpoing address, then check that + # we inserted it at the expected location by examining the + # instruction at that address (we're not interested in the insn + # itself, but rather at the address printed at the begining of + # the instruction). + if { $address != "" } then { + gdb_test "x /i $address" \ + ".*<$function\\+$expected_location>.*" \ + "check $function breakpoint address" + } else { + fail "unable to compute breakpoint address" + } + +} + +insert_breakpoint "li_stw" 12 Index: i386-signal.c =================================================================== --- i386-signal.c (nonexistent) +++ i386-signal.c (revision 33) @@ -0,0 +1,53 @@ +/* Unwinder test program for signal frames. + + Copyright 2007, 2008 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +void sigframe (void); +void setup (void); + +void +func (void) +{ +} + +int +main (void) +{ + setup (); +} + +/* Create an imitation signal frame. This will work on any x86 or + x86-64 target which uses a version of GAS recent enough for + .cfi_signal_frame (added 2006-02-27 and included in binutils 2.17). + The default CIE created by gas suffices to unwind from an empty + function. */ + +asm(".text\n" + " .align 8\n" + " .globl setup\n" + "setup:\n" + " push $sigframe\n" + " jmp func\n" + "\n" + " .cfi_startproc\n" + " .cfi_signal_frame\n" + " nop\n" + " .globl sigframe\n" + "sigframe:\n" + " ret\n" + " .cfi_endproc");
i386-signal.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: powerpc-prologue.c =================================================================== --- powerpc-prologue.c (nonexistent) +++ powerpc-prologue.c (revision 33) @@ -0,0 +1,82 @@ +/* Unwinder test program. + + Copyright 2006, 2007, 2008 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifdef SYMBOL_PREFIX +#define SYMBOL(str) SYMBOL_PREFIX #str +#else +#define SYMBOL(str) #str +#endif + +void gdb2029 (void); + +int +main (void) +{ + gdb2029 (); + optimized_1 (); + return 0; +} + +void +optimized_1_marker (void) +{ +} + +void +gdb2029_marker (void) +{ +} + +/* A typical PIC prologue from GCC. */ + +asm(".text\n" + " .p2align 3\n" + SYMBOL (gdb2029) ":\n" + " stwu %r1, -32(%r1)\n" + " mflr %r0\n" + " bcl- 20,31,.+4\n" + " stw %r30, 24(%r1)\n" + " mflr %r30\n" + " stw %r0, 36(%r1)\n" + " bl gdb2029_marker\n" + " lwz %r0, 36(%r1)\n" + " lwz %r30, 24(%r1)\n" + " mtlr %r0\n" + " addi %r1, %r1, 32\n" + " blr"); + +/* A heavily scheduled prologue. */ +asm(".text\n" + " .p2align 3\n" + SYMBOL (optimized_1) ":\n" + " stwu %r1,-32(%r1)\n" + " lis %r9,-16342\n" + " lis %r11,-16342\n" + " mflr %r0\n" + " addi %r11,%r11,3776\n" + " stmw %r27,12(%r1)\n" + " addi %r31,%r9,3152\n" + " cmplw %cr7,%r31,%r11\n" + " stw %r0,36(%r1)\n" + " mr %r30,%r3\n" + " bl optimized_1_marker\n" + " lwz %r0,36(%r1)\n" + " lmw %r27,12(%r1)\n" + " addi %r1,%r1,32\n" + " blr");
powerpc-prologue.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: thumb-prologue.c =================================================================== --- thumb-prologue.c (nonexistent) +++ thumb-prologue.c (revision 33) @@ -0,0 +1,106 @@ +/* Unwinder test program. + + Copyright 2006, 2007, 2008 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +void tpcs_frame (void); + +int +main (void) +{ + tpcs_frame (); + return 0; +} + +/* Normally Thumb functions use r7 as the frame pointer. However, + with the GCC option -mtpcs-frame, they may use fp instead. Make + sure that the prologue analyzer can handle this. */ + +asm(".text\n" + " .align 2\n" + " .thumb_func\n" + " .code 16\n" + "tpcs_frame_1:\n" + " sub sp, #16\n" + " push {r7}\n" + " add r7, sp, #20\n" + " str r7, [sp, #8]\n" + " mov r7, pc\n" + " str r7, [sp, #16]\n" + " mov r7, fp\n" + " str r7, [sp, #4]\n" + " mov r7, lr\n" + " str r7, [sp, #12]\n" + " add r7, sp, #16\n" + " mov fp, r7\n" + " mov r7, sl\n" + " push {r7}\n" + + /* We'll set a breakpoint at this call. We can't hardcode a trap + instruction; the right instruction to use varies too much. And + we can't use a global label, because GDB will think that's the + start of a new function. So, this slightly convoluted + technique. */ + ".Ltpcs:\n" + " nop\n" + + " pop {r2}\n" + " mov sl, r2\n" + " pop {r7}\n" + " pop {r1, r2}\n" + " mov fp, r1\n" + " mov sp, r2\n" + " bx lr\n" + + " .align 2\n" + " .type tpcs_offset, %object\n" + "tpcs_offset:\n" + " .word .Ltpcs - tpcs_frame_1\n" + + " .align 2\n" + " .thumb_func\n" + " .code 16\n" + "tpcs_frame:\n" + " sub sp, #16\n" + " push {r7}\n" + " add r7, sp, #20\n" + " str r7, [sp, #8]\n" + " mov r7, pc\n" + " str r7, [sp, #16]\n" + " mov r7, fp\n" + " str r7, [sp, #4]\n" + " mov r7, lr\n" + " str r7, [sp, #12]\n" + " add r7, sp, #16\n" + " mov fp, r7\n" + " mov r7, sl\n" + " push {r7}\n" + + /* Clobber saved regs around the call. */ + " mov r7, #0\n" + " mov lr, r7\n" + " bl tpcs_frame_1\n" + + " pop {r2}\n" + " mov sl, r2\n" + " pop {r7}\n" + " pop {r1, r2, r3}\n" + " mov fp, r1\n" + " mov sp, r2\n" + " mov lr, r3\n" + " bx lr\n" +);
thumb-prologue.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pa64-nullify.s =================================================================== --- pa64-nullify.s (nonexistent) +++ pa64-nullify.s (revision 33) @@ -0,0 +1,70 @@ + .LEVEL 2.0w + .text + .align 8 + .globl foo + .type foo, @function +foo: + .PROC + .CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + copy %r3,%r1 + copy %r30,%r3 + std,ma %r1,64(%r30) + std %r3,-8(%r30) + ldo -64(%r29),%r28 + stw %r26,0(%r28) + ldw 0(%r28),%r28 + extrd,s %r28,63,32,%r28 + ldo 64(%r3),%r30 + ldd,mb -64(%r30),%r3 + nop + bve,n (%r2) + .EXIT + .PROCEND + + .align 8 + .globl bar + .type bar, @function +bar: + .PROC + .CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + copy %r3,%r1 + copy %r30,%r3 + std,ma %r1,64(%r30) + std %r3,-8(%r30) + ldo 64(%r3),%r30 + ldd,mb -64(%r30),%r3 + bve,n (%r2) + .EXIT + .PROCEND + + .align 8 + .globl main + .type main, @function +main: + .PROC + .CALLINFO FRAME=128,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4 + .ENTRY + std %r2,-16(%r30) + copy %r3,%r1 + copy %r30,%r3 + std,ma %r1,128(%r30) + std %r3,-8(%r30) + std %r4,8(%r3) + ldo -64(%r29),%r28 + stw %r26,0(%r28) + std %r25,8(%r28) + ldw 0(%r28),%r26 + ldo -48(%r30),%r29 + copy %r27,%r4 + b,l foo,%r2 + nop + copy %r4,%r27 + ldd -16(%r3),%r2 + ldd 8(%r3),%r4 + ldo 64(%r3),%r30 + ldd,mb -64(%r30),%r3 + bve,n (%r2) + .EXIT + .PROCEND
pa64-nullify.s Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: spu-info.exp =================================================================== --- spu-info.exp (nonexistent) +++ spu-info.exp (revision 33) @@ -0,0 +1,241 @@ +# Copyright 2007, 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# This file is part of the gdb testsuite. +# +# Contributed by Markus Deuling . +# Tests for 'info spu' commands. + +set prms_id 0 +set bug_id 0 + +if { ![istarget "spu-*-elf"] } then { + verbose "Skipping SPU-only testcase" + return +} + +set testfile "spu-info" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +set sources ${srcdir}/${subdir}/${srcfile} + +if { [gdb_compile $sources ${binfile} executable { debug }] != "" } { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# Continue to MARKER +proc c_to { marker } { + global srcfile + set line [gdb_get_line_number $marker] + gdb_test "break $line" \ + "Breakpoint.*at.*file.*$srcfile.*line $line.*" \ + "break $line" + gdb_test "continue" \ + "Continuing.*Breakpoint.*at.*$srcfile.*$line.*" \ + "continue to $line" +} + + + +if ![runto_main] then { + fail "Can't run to main" + return 0 +} + +# Check the help. +gdb_test "info spu" \ + ".*info spu.* must be followed by the name of an SPU facility.*" \ + "info spu" +gdb_test "help info spu" \ + "Various SPU specific commands.*List of info spu subcommands.*" \ + "help info spu" + +gdb_test "help info spu dma" \ + "Display MFC DMA status." \ + "help info spu dma" +gdb_test "help info spu event" \ + "Display SPU event facility status." \ + "help info spu event" +gdb_test "help info spu mailbox" \ + "Display SPU mailbox facility status." \ + "help info spu mailbox" +gdb_test "help info spu proxydma" \ + "Display MFC Proxy-DMA status." \ + "help info spu proxydma" +gdb_test "help info spu signal" \ + "Display SPU signal notification facility status." \ + "help info spu signal" + + +# architecture should be spu:256K. +gdb_test "show architecture" \ + "The target architecture is set automatically.*currently spu:256K.*" \ + "architecture = spu256K" + +# 'info spu event'. +gdb_test "info spu event" \ + "Event Status.*Event Mask.*" \ + "info spu event" + +# 'info spu signal'. +gdb_test "info spu signal" \ + "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \ + "info spu signal" + +# 'info spu mailbox'. +gdb_test "info spu mailbox" \ + "SPU Outbound Mailbox.*SPU Outbound Interrupt Mailbox.*" \ + "info spu mailbox" + +# 'info spu dma'. +gdb_test "info spu dma" \ + "Tag-Group Status.*Tag-Group Mask.*Stall-and-Notify .*Atomic Cmd Status.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*" \ + "info spu dma" + +# 'info spu proxydma'. +gdb_test "info spu proxydma" \ + "Tag-Group Status.*Tag-Group Mask.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*" \ + "info spu proxydma" + +# Event tests. +c_to "Marker Event" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000000.*" \ + "empty event status" + +# MFC_MULTI_SRC_SYNC_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00001000.*" \ + "event mask 0x1000" +# MFC_PRIV_ATTN_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000800.*" \ + "event mask 0x0800" +# MFC_LLR_LOST_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000400.*" \ + "event mask 0x0400" +# MFC_SIGNAL_NOTIFY_1_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000200.*" \ + "event mask 0x0200" +# MFC_SIGNAL_NOTIFY_2_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000100.*" \ + "event mask 0x0100" +# MFC_OUT_MBOX_AVAILABLE_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000080.*" \ + "event mask 0x0080" +# MFC_OUT_INTR_MBOX_AVAILABLE_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000040.*" \ + "event mask 0x0040" +# MFC_DECREMENTER_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000020.*" \ + "event mask 0x0020" +# MFC_IN_MBOX_AVAILABLE_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000010.*" \ + "event mask 0x0010" +# MFC_COMMAND_QUEUE_AVAILABLE_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000008.*" \ + "event mask 0x0008" +# MFC_LIST_STALL_NOTIFY_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000002.*" \ + "event mask 0x0002" +# MFC_TAG_STATUS_UPDATE_EVENT. +gdb_test "next" "" "next" +gdb_test "info spu event" \ + "Event Status 0x00000000.*Event Mask 0x00000001.*" \ + "event mask 0x0001" + + +# DMA tests. +# 'info spu dma' should be empty. +c_to "Marker DMA" +gdb_test "info spu dma" \ + "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000000.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*0.*0.*0.*0.*0x00000 0x00000.*" \ + "info spu dma (empty)" + +# 'info spu dma' should be filled with some data. +c_to "Marker DMAWait" +gdb_test "next" "" "next" +gdb_test "info spu dma" \ + "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000020.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*getl.*putllc.*get.*mfcsync.*get.*0.*0.*0.*0.*0x00000 0x00000.*" \ + "info spu dma (non-empty)" +gdb_test "finish" "" "finish" + +# Mailbox Test +# 'info spu mailbox' should be empty. +c_to "Marker Mbox" +gdb_test "info spu mailbox" \ + "SPU Outbound Mailbox.*0xc0000000.*SPU Outbound Interrupt Mailbox.*0xc0000000.*" \ + "info spu mailbox" + +# 'info spu mailbox' should now contain data. +c_to "Marker MboxEnd" +gdb_test "info spu mailbox" \ + "SPU Outbound Mailbox.*0x12345678.*SPU Outbound Interrupt Mailbox.*0x12345678.*" \ + "info spu mailbox" + +# Signal Test +# 'info spu signal'. +c_to "Marker Signal" +gdb_test "info spu signal" \ + "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \ + "info spu signal" + +# 'info spu signal' with signal1 pending. +c_to "Marker Signal1" +gdb_test "info spu signal" \ + "Signal 1 control word 0x801c0800.*Signal 2 not pending.*\(Type.*\).*" \ + "info spu signal" + +# 'info spu signal' with signal1 and signal2 pending. +c_to "Marker Signal2" +gdb_test "info spu signal" \ + "Signal 1 control word 0x801c0800.*Signal 2 control word 0x801c0800.*" \ + "info spu signal" + +# Read signal1. Only signal2 is pending. +c_to "Marker SignalRead" +gdb_test "info spu signal" \ + "Signal 1 not pending.*Signal 2 control word 0x801c0800.*" \ + "info spu signal" + + +gdb_exit + +return 0 Index: e500-abi.exp =================================================================== --- e500-abi.exp (nonexistent) +++ e500-abi.exp (revision 33) @@ -0,0 +1,90 @@ +# Copyright 2003, 2007, 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu +# + +# Tests for Powerpc e500 ABI + + +if $tracelevel then { + strace $tracelevel +} + +# +# This file uses e500-abi.c for input. +# + +set prms_id 0 +set bug_id 0 + +if ![istarget "powerpc-*eabispe"] then { + verbose "Skipping e500 abi tests." + return +} + +set testfile "e500-abi" +set binfile ${objdir}/${subdir}/${testfile} + +set src1 ${srcdir}/${subdir}/${testfile}.c + +if { [gdb_compile ${src1} ${binfile} executable {debug nowarnings}] != "" } { + untested e500-abi.exp + return -1 +} + +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# +# Run to `main' where we begin our tests. +# + +if ![runto_main] then { + gdb_suppress_tests +} + +gdb_test "b marker" "Breakpoint 2 at.*file.*e500-abi.c, line \[0-9\]+." "break marker" +gdb_test "continue" "Breakpoint 2.*marker.*e500-abi.c.*" "continue to marker" +gdb_test "finish" "Run till exit from .0.*marker.*at.*e500-abi.c.*main \\(\\) at.*e500-abi.c.*res_vec = vec_func \\(a_vec,.*goes in r3.*" "back to main (1)" + +# now all the arguments of vec_func are initialized + +set pattern "vec_func .a_vec_f=.0, 55., b_vec_f=.0, 66., c_vec_f=.3.14.*2.18.*, d_vec_f=.5, 4., e_vec_f=.5, 6., f_vec_f=.6, 6, 7, 1., g_vec_f=.6, 6, 7, 9., h_vec_f=.3, 2., i_vec_f=.3, 2., l_vec_f=.3, 5., m_vec_f=.6, 9.." + +set pattern1 $pattern +append pattern1 " at.*e500-abi.c.*x = 2;" + +# Now let's call the function. This function has > 8 args, +# the last ones will go on the stack. +gdb_test "p vec_func(a_vec,b_vec,c_vec,d_vec,e_vec,f_vec,g_vec,h_vec,i_vec,l_vec,m_vec)" \ +".\[0-9\]+ = .6, 63." "call inferior function with vectors (1) " + +# Let's call the function again with dummy arguments. This is to clean +# up the contents of the ev registers before the next call. +gdb_test "p vec_func(a_vec_d,b_vec_d,c_vec_d,d_vec_d,e_vec_d,f_vec_d,g_vec_d,h_vec_d,i_vec_d,l_vec_d,m_vec_d)" \ +".\[0-9\]+ = .1, 1." "call inferior function with vectors (2) " + +# Let's step into the function, to see if the args are printed correctly. +gdb_test "step" \ + $pattern1 \ + "step into vec_func" + +# Let's see if the result is returned correctly. +gdb_test "finish" \ + "Run till exit from .0.* at.*e500-abi.c.*main.*res_vec = vec_func .a_vec,.*goes in r3.*Value returned is.*= .6, 63." \ + "vector value returned correctly" Index: e500-prologue.exp =================================================================== --- e500-prologue.exp (nonexistent) +++ e500-prologue.exp (revision 33) @@ -0,0 +1,81 @@ +# Copyright 2004, 2007, 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + +# Test PowerPC E500 prologue analyzer. + +set prms_id 0 +set bug_id 0 + +if ![istarget "powerpc-*"] then { + verbose "Skipping powerpc E500 prologue tests." + return +} + +set testfile "e500-prologue" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } { + unsupported "Testcase compile failed." + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# Insert a breakpoint in FUNCTION and verifies that the breakpoint was +# inserted at the expected location. EXPECTED_LOCATION should be an +# offset relative to the function start address. +proc insert_breakpoint {function expected_location} { + global gdb_prompt + global expect_out + global hex + + set address "" + + # Insert a breakpoint using the given function name, and extract + # the breakpoint address for the output. + gdb_test_multiple "break $function" "set breakpoint in $function" { + -re "Breakpoint 1 at ($hex).*$gdb_prompt $" { + set address $expect_out(1,string) + } + default { + fail "set breakpoint in $function" + } + } + + # If we managed to get the breakpoing address, then check that + # we inserted it at the expected location by examining the + # instruction at that address (we're not interested in the insn + # itself, but rather at the address printed at the begining of + # the instruction). + if { $address != "" } then { + gdb_test "x /i $address" \ + ".*<$function\\+$expected_location>.*" \ + "check $function breakpoint address" + } else { + fail "unable to compute breakpoint address" + } + +} + +insert_breakpoint "arg_passing_test2" 40 Index: i386-gnu-cfi.c =================================================================== --- i386-gnu-cfi.c (nonexistent) +++ i386-gnu-cfi.c (revision 33) @@ -0,0 +1,29 @@ +/* Unwinding of DW_CFA_GNU_negative_offset_extended test program. + + Copyright 2007, Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +/* i386-gnu-cfi-asm.S: */ +extern void *gate (void *(*gate) (void *data), void *data); + +int main (void) +{ + gate ((void *(*) (void *data)) abort, NULL); + return 0; +}
i386-gnu-cfi.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gdb1558.c =================================================================== --- gdb1558.c (nonexistent) +++ gdb1558.c (revision 33) @@ -0,0 +1,37 @@ +/* Copyright 2004, 2005, 2007, 2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@gnu.org + + This file is part of the gdb testsuite. */ + +#include + +sub1 () +{ + printf ("In sub1\n"); +} + +sub2 () +{ + printf ("In sub2\n"); +} + +main () +{ + sub1 (); + sub2 (); +}
gdb1558.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i386-size-overlap.exp =================================================================== --- i386-size-overlap.exp (nonexistent) +++ i386-size-overlap.exp (revision 33) @@ -0,0 +1,75 @@ +# Copyright 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + +# Test that GDB can handle overlapping sizes of symbols. + +if ![istarget "i?86-*-*"] then { + verbose "Skipping i386 unwinder tests." + return +} + +set testfile "i386-size-overlap" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +# some targets have leading underscores on assembly symbols. +# TODO: detect this automatically +set additional_flags "" +if [istarget "i?86-*-cygwin*"] then { + set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\"" +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ + executable [list debug $additional_flags]] != "" } { + untested "i386-size" + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# We use gdb_run_cmd so this stands a chance to work for remote +# targets too. +gdb_run_cmd + +gdb_expect { + -re "Program received signal SIGTRAP.*$gdb_prompt $" { + pass "run past main" + } + -re ".*$gdb_prompt $" { + fail "run past main" + } + timeout { + fail "run past main (timeout)" + } +} + +set message "backtrace shows the outer function" +gdb_test_multiple "backtrace 10" $message { + -re "#1\[ \t]*$hex in inner.*$gdb_prompt $" { + fail $message + } + -re "#1\[ \t]*$hex in main.*$gdb_prompt $" { + pass $message + } +} Index: e500-regs.exp =================================================================== --- e500-regs.exp (nonexistent) +++ e500-regs.exp (revision 33) @@ -0,0 +1,229 @@ +# Copyright 2003, 2004, 2007, 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu +# + +# Tests for Powerpc E500 register setting and fetching + +if $tracelevel then { + strace $tracelevel +} + +# +# Test the use of registers, especially E500 registers, for Powerpc. +# This file uses e500-regs.c for input. +# + +set prms_id 0 +set bug_id 0 + +if ![istarget "powerpc-*eabispe"] then { + verbose "Skipping e500 register tests." + return +} + +set testfile "e500-regs" +set binfile ${objdir}/${subdir}/${testfile} +set src1 ${srcdir}/${subdir}/${testfile}.c + +if { [gdb_compile ${src1} ${binfile} executable {debug nowarnings}] != "" } { + untested e500-regs.exp + return -1 +} + +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# +# Run to `main' where we begin our tests. +# + +if ![runto_main] then { + gdb_suppress_tests +} + +# set all the registers integer portions to 1 +for {set i 0} {$i < 32} {incr i 1} { + for {set j 0} {$j < 2} {incr j 1} { + gdb_test "set \$ev$i.v2_int32\[$j\] = 1" "" "set reg ev$i.v4si.f\[$j\]" + } +} + +# Now execute some target code, so that GDB's register cache is flushed. + +#gdb_test "next" "" "" + +send_gdb "show endian\n" +gdb_expect { + -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" { + pass "endianness" + set endianness $expect_out(2,string) + } + -re ".*$gdb_prompt $" { + fail "couldn't get endianness" + } + timeout { fail "(timeout) endianness" } +} + +# And then read the E500 registers back, to see that +# a) the register write above worked, and +# b) the register read (below) also works. + +if {$endianness == "big"} { +set vector_register ".uint64 = 0x100000001, v2_float = .0x0, 0x0., v2_int32 = .0x1, 0x1., v4_int16 = .0x0, 0x1, 0x0, 0x1., v8_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." +} else { +set vector_register ".uint64 = 0x100000001, v2_float = .0x0, 0x0., v2_int32 = .0x1, 0x1., v4_int16 = .0x1, 0x0, 0x1, 0x0., v8_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.." +} + +for {set i 0} {$i < 32} {incr i 1} { + gdb_test "info reg ev$i" "ev$i.*$vector_register" "info reg ev$i" +} + +# Test wether the GPRs are updated accordingly. (GPRs are just the lower +# 32 bits of the EV registers.) + +set general_register "0x1\[ \t\]+1" + +for {set i 0} {$i < 32} {incr i 1} { + gdb_test "info reg r$i" "r$i.*$general_register" "info reg r$i" +} + +# Now redo the same tests, but using the print command. +# Note: in LE case, the char array is printed WITHOUT the last character. +# Gdb treats the terminating null char in the array like the terminating +# null char in a string and doesn't print it. This is not a failure, but +# the way gdb works. + +if {$endianness == "big"} { + set decimal_vector ".uint64 = 4294967297, v2_float = .1.*e-45, 1.*e-45., v2_int32 = .1, 1., v4_int16 = .0, 1, 0, 1., v8_int8 = ..000.000.000.001.000.000.000.001.." +} else { + set decimal_vector ".uint64 = 4294967297, v2_float = .1.*e-45, 1.*e-45., v2_int32 = .1, 1., v4_int16 = .1, 0, 1, 0., v8_int8 = ..001.000.000.000.001.000.000.." +} + +for {set i 0} {$i < 32} {incr i 1} { + gdb_test "print \$ev$i" ".* = $decimal_vector" "print ev$i" +} + +for {set i 0} {$i < 32} {incr i 1} { + set pattern$i ".*ev$i.*" + append pattern$i $vector_register +} + +send_gdb "info vector\n" +gdb_expect_list "info vector" ".*$gdb_prompt $" { +[$pattern0] +[$pattern1] +[$pattern2] +[$pattern3] +[$pattern4] +[$pattern5] +[$pattern6] +[$pattern7] +[$pattern8] +[$pattern9] +[$pattern10] +[$pattern11] +[$pattern12] +[$pattern13] +[$pattern14] +[$pattern15] +[$pattern16] +[$pattern17] +[$pattern18] +[$pattern19] +[$pattern20] +[$pattern21] +[$pattern22] +[$pattern23] +[$pattern24] +[$pattern25] +[$pattern26] +[$pattern27] +[$pattern28] +[$pattern29] +[$pattern30] +[$pattern31] +} + +# We must restart everything, because we have set important registers to +# some unusual values. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} +if ![runto_main] then { + gdb_suppress_tests +} + +gdb_test "break vector_fun" \ + "Breakpoint 2 at.*e500-regs.c, line \[0-9\]+\\." \ + "Set breakpoint at vector_fun" + +# Actually it is nuch easier to see these results printed in hex. +# gdb_test "set output-radix 16" \ +# "Output radix now set to decimal 16, hex 10, octal 20." \ +# "Set output radix to hex" + +gdb_test "continue" \ + "Breakpoint 2, vector_fun .a=.-2, -2., b=.1, 1.*e500-regs.c.*ev_create_s32 .2, 2.;" \ + "continue to vector_fun" + +# Do a next over the assignment to vector 'a'. +gdb_test "next" ".*b = \\(vector int\\) __ev_create_s32 \\(3, 3\\);" \ + "next (1)" + +# Do a next over the assignment to vector 'b'. +gdb_test "next" "c = __ev_and \\(a, b\\);" \ + "next (2)" + +# Now 'a' should be '0x02020202...' and 'b' should be '0x03030303...' +gdb_test "print/x a" \ + ".*= .0x2, 0x2." \ + "print vector parameter a" + +gdb_test "print/x b" \ + ".*= .0x3, 0x3." \ + "print vector parameter b" + +# If we do an 'up' now, and print 'x' and 'y' we should see the values they +# have in main, not the values they have in vector_fun. +gdb_test "up" ".1.*main \\(\\) at.*e500-regs.c.*z = vector_fun \\(x, y\\);" \ + "up to main" + +gdb_test "print x" \ + ".*= .-2, -2." \ + "print vector x" + +gdb_test "print y" \ + ".*= .1, 1." \ + "print vector y" + +# now go back to vector_func and do a finish, to see if we can print the return +# value correctly. + +gdb_test "down" \ + ".0 vector_fun \\(a=.2, 2., b=.3, 3.\\) at.*e500-regs.c.*c = __ev_and \\(a, b\\);" \ + "down to vector_fun" + +gdb_test "finish" \ + "Run till exit from .0 vector_fun \\(a=.2, 2., b=.3, 3.\\) at.*e500-regs.c.*main \\(\\) at.*e500-regs.c.*z = vector_fun \\(x, y\\);.*Value returned is.*= .2, 2." \ + "finish returned correct value" + + + Index: gdb1431.s =================================================================== --- gdb1431.s (nonexistent) +++ gdb1431.s (revision 33) @@ -0,0 +1,128 @@ +! Copyright 2004 Free Software Foundation, Inc. +! +! This program is free software; you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 3 of the License, or +! (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program. If not, see . +! +! Please email any bugs, comments, and/or additions to this file to: +! bug-gdb@gnu.org +! +! This file is part of the gdb testsuite. +! +! It was generated using "sh-elf-gcc -S gdb1431.c", using the following +! source file: +! +! #include +! +! main() +! { +! printf("hello world\n"); +! sub1(); +! sub2(); +! } +! sub1() +! { +! int buf[64]; +! +! } +! +! sub2() +! { +! int buf[65]; +! +! } +! +! We use a pregenerated assembly file as the test input to avoid possible +! problems with future versions of gcc generating different code. + + .file "gdb1431.c" + .text + .section .rodata + .align 2 +.LC0: + .string "hello world\n" + .text + .align 1 + .global _main + .type _main, @function +_main: + mov.l r14,@-r15 + sts.l pr,@-r15 + mov r15,r14 + mov.l .L2,r1 + mov r1,r4 + mov.l .L3,r1 + jsr @r1 + nop + mov.l .L4,r1 + jsr @r1 + nop + mov.l .L5,r1 + jsr @r1 + nop + mov r14,r15 + lds.l @r15+,pr + mov.l @r15+,r14 + rts + nop +.L6: + .align 2 +.L2: + .long .LC0 +.L3: + .long _printf +.L4: + .long _sub1 +.L5: + .long _sub2 + .size _main, .-_main + .align 1 + .global _sub1 + .type _sub1, @function +_sub1: + mov.l r14,@-r15 + sts.l pr,@-r15 + add #-128,r15 + add #-128,r15 + mov r15,r14 + mov.w .L8,r7 + add r7,r14 + mov r14,r15 + lds.l @r15+,pr + mov.l @r15+,r14 + rts + nop + .align 1 +.L8: + .short 256 + .size _sub1, .-_sub1 + .align 1 + .global _sub2 + .type _sub2, @function +_sub2: + mov.l r14,@-r15 + sts.l pr,@-r15 + mov.w .L11,r1 + sub r1,r15 + mov r15,r14 + mov.w .L11,r7 + add r7,r14 + mov r14,r15 + lds.l @r15+,pr + mov.l @r15+,r14 + rts + nop + .align 1 +.L11: + .short 260 + .size _sub2, .-_sub2 + .ident "GCC: (GNU) 3.5.0 20040204 (experimental)"
gdb1431.s Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: powerpc-aix-prologue.c =================================================================== --- powerpc-aix-prologue.c (nonexistent) +++ powerpc-aix-prologue.c (revision 33) @@ -0,0 +1,53 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2004, 2007, 2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +void li_stw (void); + +int +main (void) +{ + li_stw (); + return 0; +} + +/* Asm for procedure li_stw(). + + The purpose of this function is to verify that GDB does not + include the li insn as part of the function prologue (only part + of the prologue if part of a pair of insns saving vector registers). + Similarly, GDB should not include the stw insn following the li insn, + because the source register is not used for parameter passing. */ + + +asm (" .csect .text[PR]\n" + " .align 2\n" + " .lglobl .li_stw\n" + " .csect li_stw[DS]\n" + "li_stw:\n" + " .long .li_stw, TOC[tc0], 0\n" + " .csect .text[PR]\n" + ".li_stw:\n" + " stw 31,-4(1)\n" + " stwu 1,-48(1)\n" + " mr 31,1\n" + " stw 11,24(31)\n" + " li 0,8765\n" + " stw 0,28(31)\n" + " lwz 1,0(1)\n" + " lwz 31,-4(1)\n" + " blr\n"); +
powerpc-aix-prologue.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gdb1291.s =================================================================== --- gdb1291.s (nonexistent) +++ gdb1291.s (revision 33) @@ -0,0 +1,128 @@ +! Copyright 2004 Free Software Foundation, Inc. +! +! This program is free software; you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 3 of the License, or +! (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program. If not, see . +! +! Please email any bugs, comments, and/or additions to this file to: +! bug-gdb@gnu.org +! +! This file is part of the gdb testsuite. +! +! It was generated using "sh-elf-gcc -S gdb1291.c", using the following +! source file: +! +! #include +! +! main() +! { +! printf("hello world\n"); +! sub1(); +! sub2(); +! } +! sub1() +! { +! int buf[64]; +! +! } +! +! sub2() +! { +! int buf[65]; +! +! } +! +! We use a pregenerated assembly file as the test input to avoid possible +! problems with future versions of gcc generating different code. + + .file "gdb1291.c" + .text + .section .rodata + .align 2 +.LC0: + .string "hello world\n" + .text + .align 1 + .global _main + .type _main, @function +_main: + mov.l r14,@-r15 + sts.l pr,@-r15 + mov r15,r14 + mov.l .L2,r1 + mov r1,r4 + mov.l .L3,r1 + jsr @r1 + nop + mov.l .L4,r1 + jsr @r1 + nop + mov.l .L5,r1 + jsr @r1 + nop + mov r14,r15 + lds.l @r15+,pr + mov.l @r15+,r14 + rts + nop +.L6: + .align 2 +.L2: + .long .LC0 +.L3: + .long _printf +.L4: + .long _sub1 +.L5: + .long _sub2 + .size _main, .-_main + .align 1 + .global _sub1 + .type _sub1, @function +_sub1: + mov.l r14,@-r15 + sts.l pr,@-r15 + add #-128,r15 + add #-128,r15 + mov r15,r14 + mov.w .L8,r7 + add r7,r14 + mov r14,r15 + lds.l @r15+,pr + mov.l @r15+,r14 + rts + nop + .align 1 +.L8: + .short 256 + .size _sub1, .-_sub1 + .align 1 + .global _sub2 + .type _sub2, @function +_sub2: + mov.l r14,@-r15 + sts.l pr,@-r15 + mov.w .L11,r1 + sub r1,r15 + mov r15,r14 + mov.w .L11,r7 + add r7,r14 + mov r14,r15 + lds.l @r15+,pr + mov.l @r15+,r14 + rts + nop + .align 1 +.L11: + .short 260 + .size _sub2, .-_sub2 + .ident "GCC: (GNU) 3.5.0 20040204 (experimental)"
gdb1291.s Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: altivec-abi.exp =================================================================== --- altivec-abi.exp (nonexistent) +++ altivec-abi.exp (revision 33) @@ -0,0 +1,158 @@ +# Copyright (C) 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# Tests for Powerpc AltiVec ABI + + +if $tracelevel then { + strace $tracelevel +} + +# +# This file uses altivec-abi.c for input. +# + +if {![istarget "powerpc*"] || [skip_altivec_tests]} then { + verbose "Skipping altivec abi tests." + verbose -log "Skipping altivec abi tests." + return +} + +set testfile "altivec-abi" +set binfile ${objdir}/${subdir}/${testfile} +set srcfile ${testfile}.c + +if [get_compiler_info $binfile] { + warning "get_compiler failed" + return -1 +} + +proc altivec_abi_tests { extra_flags force_abi } { + global testfile binfile srcfile srcdir subdir + global gdb_prompt + + set compile_flags "debug nowarnings $extra_flags" + + if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $compile_flags] != "" } { + untested altivec-abi.exp + return -1 + } + + if { "$force_abi" == "auto" } { + # If the toolchain does not record attributes, skip auto-ABI tests. + set readelf_program [transform readelf] + set result [catch "exec $readelf_program -A $binfile" output] + + if {$result == 0 && ![regexp Tag_GNU_Power_ABI_Vector $output]} { + untested "ABI not marked" + return + } + } + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load ${binfile} + + # Run to `main' where we begin our tests. + if ![runto_main] then { + untested altivec-abi.exp + return -1 + } + + gdb_test "set powerpc vector-abi $force_abi" + + gdb_test "b marker" "Breakpoint 2 at.*file.*altivec-abi.c, line \[0-9\]+." "break marker" + gdb_test "continue" "Breakpoint 2.*marker.*altivec-abi.c.*" "continue to marker" + gdb_test "finish" "Run till exit from .0.*marker.*at.*altivec-abi.c.*main \\(\\) at.*altivec-abi.c.*result = vec_func \\(vshort,.*goes in v2.*" "back to main (1)" + + # now all the arguments of vec_fun are initialized + + set pattern "vec_func .vshort_f=.111, 222, 333, 444, 555, 666, 777, 888., vushort_f=.100, 200, 300, 400, 500, 600, 700, 800., vint_f=.-10, -20, -30, -40., vuint_f=.1111, 2222, 3333, 4444., vchar_f=.abcdefghilmnopqr., vuchar_f=.ABCDEFGHILMNOPQR., vfloat_f=.1.25, 3.75, 5.5, 1.25., x_f=.1, 2, 3, 4, 5, 6, 7, 8., y_f=.12, 22, 32, 42., a_f=.vector of chars.., b_f=.5.5, 4.5, 3.75, 2.25., c_f=.1.25, 3.5, 5.5, 7.75., intv_on_stack_f=.12, 34, 56, 78.." + + set pattern1 $pattern + append pattern1 " at.*altivec-abi.c.*vint_res = vec_add.*vint_f, intv_on_stack_f.;" + + # Now let's call the function. This function has > 12 args, + # the last one will go on the stack. + set msg "call inferior function with vectors (1)" + gdb_test "p vec_func(vshort,vushort,vint,vuint,vchar,vuchar,vfloat,x,y,a,b,c,intv_on_stack)" \ + ".\[0-9\]+ = .2, 2, 2, 2." "call inferior function with vectors (1)" + + # Let's call the function again with dummy arguments. This is to clean + # up the contents of the vector registers before the next call. + gdb_test "p vec_func(vshort_d,vushort_d,vint_d,vuint_d,vchar_d,vuchar_d,vfloat_d,x_d,y_d,a_d,b_d,c_d,intv_on_stack_d)" \ + ".\[0-9\]+ = .0, 0, 0, 0." "call inferior function with vectors (2)" + + # Let's step into the function, to see if the args are printed correctly. + gdb_test "step" \ + $pattern1 \ + "step into vec_fun" + + set pattern2 $pattern + append pattern2 " at.*altivec-abi.c.*main.*result = vec_func .vshort,.*goes in v2.*Value returned is.*= .2, 2, 2, 2." + + # Let's see if the result is returned correctly. + gdb_test "finish" "Run till exit from .0.*$pattern2" \ + "vector value returned correctly" + + # can we print the args correctly for this function? + gdb_test "break struct_of_vector_func" "" "" + + set pattern "struct_of_vector_func .vector_struct=.vshort1 = .1, 2, 3, 4, 5, 6, 7, 8., vshort2 = .11, 12, 13, 14, 15, 16, 17, 18., vshort3 = .21, 22, 23, 24, 25, 26, 27, 28., vshort4 = .31, 32, 33, 34, 35, 36, 37, 38... at.*altivec-abi.c.*" + + gdb_test "continue" \ + "Breakpoint 3, $pattern.*vector_struct.vshort1 = vec_add .vector_struct.vshort1, vector_struct.vshort2.;" \ + "continue to struct_of_vector_func" + + gdb_test "finish" \ + "Run till exit from .0 $pattern\[ \r\n\]+main.*altivec-abi.c.*array_of_vector_func.*" \ + "back to main (2)" + + gdb_test "step" "" "step into array_of_vector_func" + gdb_test "p matrix\[0\]" ".*= .1, 2, 3, 4, 5, 6, 7, 8." "print first vector" + gdb_test "p matrix\[1\]" ".*= .11, 12, 13, 14, 15, 16, 17, 18." "print second vector" + gdb_test "p matrix\[2\]" ".*= .21, 22, 23, 24, 25, 26, 27, 28." "print third vector" + gdb_test "p matrix\[3\]" ".*= .31, 32, 33, 34, 35, 36, 37, 38." "print fourth vector" +} + +if [test_compiler_info gcc*] { + set saved_prefix $pf_prefix + + set pf_prefix "${saved_prefix} default ABI, auto:" + altivec_abi_tests "additional_flags=-maltivec" "auto" + + # On GNU/Linux, we can mix -mabi=no-altivec and -mabi=altivec. + # So test some combinations. + if { [istarget "powerpc*-linux*"] } { + set binfile ${objdir}/${subdir}/${testfile}-ge-ge + set pf_prefix "${saved_prefix} generic ABI, forced:" + altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "generic" + + set binfile ${objdir}/${subdir}/${testfile}-av-av + set pf_prefix "${saved_prefix} AltiVec ABI, forced:" + altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "altivec" + + set binfile ${objdir}/${subdir}/${testfile}-av-auto + set pf_prefix "${saved_prefix} AltiVec ABI, auto:" + altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto" + } +} elseif [test_compiler_info xlc*] { + altivec_abi_tests "additional_flags=-qaltivec" "auto" +} else { + warning "unknown compiler" + return -1 +} Index: ppc64-atomic-inst.exp =================================================================== --- ppc64-atomic-inst.exp (nonexistent) +++ ppc64-atomic-inst.exp (revision 33) @@ -0,0 +1,66 @@ +# Copyright 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + +# Test single stepping through atomic sequences beginning with +# a lwarx/ldarx instruction and ending with a stwcx/stdcx +# instruction. + +set prms_id 0 +set bug_id 0 + +if ![istarget "powerpc64-*"] then { + verbose "Skipping testing of powerpc64 single stepping over atomic sequences." + return +} + +set testfile "ppc64-atomic-inst" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +set compile_flags "debug" + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat debug additional_flags=-m64]] != "" } { + unsupported "Testcase compile failed." + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + perror "Couldn't run to breakpoint" + continue +} + +set bp1 [gdb_get_line_number "lwarx"] +gdb_breakpoint "$bp1" "Breakpoint $decimal at $hex" \ + "Set the breakpoint at the start of the sequence" + +gdb_test continue "Continuing.*Breakpoint $decimal.*" \ + "Continue until breakpoint" + +gdb_test next ".*__asm __volatile.*" \ + "Step through the lwarx/stwcx sequence" + +gdb_test next ".*return 0.*" \ + "Step through the ldarx/stdcx sequence" Index: i386-sse.exp =================================================================== --- i386-sse.exp (nonexistent) +++ i386-sse.exp (revision 33) @@ -0,0 +1,104 @@ +# Copyright 2004, 2005, 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@gnu.org + +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +if ![istarget "i?86-*-*"] then { + verbose "Skipping i386 SSE tests." + return +} + +set testfile "i386-sse" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile}] { + return -1 +} + +set additional_flags "" +if [test_compiler_info gcc*] { + set additional_flags "additional_flags=-msse" +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { + unsupported "compiler does not support SSE" + return +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + gdb_suppress_tests +} + +send_gdb "print have_sse ()\r" +gdb_expect { + -re ".. = 1\r\n$gdb_prompt " { + pass "check whether processor supports SSE" + } + -re ".. = 0\r\n$gdb_prompt " { + verbose "processor does not support SSE; skipping SSE tests" + return + } + -re ".*$gdb_prompt $" { + fail "check whether processor supports SSE" + } + timeout { + fail "check whether processor supports SSE (timeout)" + } +} + +gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ + "Breakpoint .* at .*i386-sse.c.*" \ + "set breakpoint in main" +gdb_continue_to_breakpoint "continue to first breakpoint in main" + +foreach r {0 1 2 3 4 5 6 7} { + gdb_test "print \$xmm$r.v4_float" \ + ".. = \\{$r, $r.25, $r.5, $r.75\\}.*" \ + "check float contents of %xmm$r" + gdb_test "print \$xmm$r.v16_int8" \ + ".. = \\{(-?\[0-9\]+, ){15}-?\[0-9\]+\\}.*" \ + "check int8 contents of %xmm$r" +} + +foreach r {0 1 2 3 4 5 6 7} { + gdb_test "set var \$xmm$r.v4_float\[0\] = $r + 10" "" "set %xmm$r" +} + +gdb_test "break [gdb_get_line_number "second breakpoint here"]" \ + "Breakpoint .* at .*i386-sse.c.*" \ + "set breakpoint in main" +gdb_continue_to_breakpoint "continue to second breakpoint in main" + +foreach r {0 1 2 3 4 5 6 7} { + gdb_test "print data\[$r\]" \ + ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \ + "check contents of data\[$r\]" +} Index: iwmmxt-regs.exp =================================================================== --- iwmmxt-regs.exp (nonexistent) +++ iwmmxt-regs.exp (revision 33) @@ -0,0 +1,77 @@ +# Copyright 2007, 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# Tests for ARM iWMMXt register setting and fetching. + +if ![istarget "arm*-*-*"] then { + verbose "Skipping iWMMXt register tests." + return +} + +set testfile "iwmmxt-regs" +set binfile ${objdir}/${subdir}/${testfile} +set src1 ${srcdir}/${subdir}/${testfile}.c + +# Try to compile the test case. If we can't, assume this is not an +# iWMMXt toolchain and bail out. +if { [gdb_compile ${src1} ${binfile} executable {quiet debug}] != "" } { + verbose "Skipping iWMMXt register tests." + return +} + +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# +# Run to `main' where we begin our tests. +# + +if ![runto_main] then { + gdb_suppress_tests +} + +# Set all the registers to arbitrary values. +for {set i 0} {$i < 16} {incr i 1} { + gdb_test "set \$wR$i.u64 = ((${i}LL << 32) | ${i})" "" "set reg wR$i" +} +gdb_test "set \$wCSSF = 300" "" "set reg wCSSF" +gdb_test "set \$wCASF = 200" "" "set reg wCASF" +for {set i 0} {$i < 4} {incr i 1} { + gdb_test "set \$wCGR$i = 100 + $i" "" "set reg wCGR$i" +} + +# See if the sets stuck. +gdb_test "next" ".*write_regs.*" "next over read_regs" + +for {set i 0} {$i < 16} {incr i 1} { + gdb_test "p \$wR$i.u64 == ((${i}LL << 32) | ${i})" "\\\$$decimal = 1" "test reg wR$i" +} +# Don't test wCSSF. +gdb_test "p \$wCASF" "\\\$$decimal = 200" "test reg wCASF" +for {set i 0} {$i < 4} {incr i 1} { + gdb_test "p \$wCGR$i == 100 + $i" "\\\$$decimal = 1" "test reg wCGR$i" +} + +# Also verify the copies read by the target. +for {set i 0} {$i < 16} {incr i 1} { + gdb_test "p regs\[$i\] == ((${i}LL << 32) | ${i})" "\\\$$decimal = 1" "test stored wR$i" +} +# Don't test wcssf. +gdb_test "p control_regs\[1\]" "\\\$$decimal = 200" "test stored wCASF" +for {set i 0} {$i < 4} {incr i 1} { + gdb_test "p control_regs\[$i + 2\] == 100 + $i" "\\\$$decimal = 1" "test stored wCGR$i" +} Index: i386-prologue.exp =================================================================== --- i386-prologue.exp (nonexistent) +++ i386-prologue.exp (revision 33) @@ -0,0 +1,237 @@ +# Copyright (C) 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@gnu.org + +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + +# Test i386 prologue analyzer. + +set prms_id 0 +set bug_id 0 + +if ![istarget "i?86-*-*"] then { + verbose "Skipping i386 prologue tests." + return +} + +set testfile "i386-prologue" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +# some targets have leading underscores on assembly symbols. +# TODO: detect this automatically +set additional_flags "" +if [istarget "i?86-*-cygwin*"] then { + set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\"" +} + +# Don't use "debug", so that we don't have line information for the assembly +# fragments. +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list $additional_flags]] != "" } { + untested i386-prologue.exp + return -1 +} + + +# The code used by the tests here encodes some breakpoints by using +# inline assembler. This will generate a SIGTRAP which will be caught +# by GDB. At that point the instruction pointer will point at the +# next instruction, and execution can continue without any problems. +# Some systems however (QNX Neutrino, Solaris) will adjust the +# instruction pointer to point at the breakpoint instruction instead. +# On these systems we cannot continue unless we skip it. This +# procedure takes care of that. + +proc skip_breakpoint { msg } { + gdb_test "if (*(unsigned char *)\$pc == 0xcc)\nset \$pc = \$pc + 1\nend" \ + "" "skip breakpoint in ${msg}" +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# +# Run to `main' where we begin our tests. +# + +if ![runto_main] then { + gdb_suppress_tests +} + +# Testcase for standard prologue. + +gdb_test "continue" "Program received signal SIGTRAP.*" "continue to standard" + +skip_breakpoint standard + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in standard.*\r\n#1\[ \t\]*$hex in main.*" \ + "backtrace in standard" + +gdb_test "info frame" \ + ".*Saved registers:.*ebp at.*edi at.*eip at.*" \ + "saved registers in standard" + + +# Testcase from breakpoints/2080 (when %ecx is used) + +gdb_test "break *(stack_align_ecx + 7)" \ + "Breakpoint \[0-9\]* at $hex" + +gdb_test "continue" \ + "Breakpoint \[0-9\]*.*stack_align_ecx.*" \ + "continue to stack_align_ecx + 7" + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in stack_align_ecx.*\r\n#1\[ \t\]*$hex in main.*" \ + "first backtrace in stack_align_ecx" + +gdb_test "continue" \ + "Program received signal SIGTRAP.*" \ + "continue in stack_align_ecx" + +skip_breakpoint stack_align_ecx + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in stack_align_ecx.*\r\n#1\[ \t\]*$hex in main.*" \ + "second backtrace in stack_align_ecx" + +gdb_test "info frame" \ + ".*Saved registers:.*ecx at.*ebp at.*edi at.*eip at.*" \ + "saved registers in stack_align_ecx" + + +# Testcase from breakpoints/2080 (when %edx is used) + +gdb_test "break *(stack_align_edx + 7)" \ + "Breakpoint \[0-9\]* at $hex" + +gdb_test "continue" \ + "Breakpoint \[0-9\]*.*stack_align_edx.*" \ + "continue to stack_align_edx + 7" + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in stack_align_edx.*\r\n#1\[ \t\]*$hex in main.*" \ + "first backtrace in stack_align_edx" + +gdb_test "continue" \ + "Program received signal SIGTRAP.*" \ + "continue in stack_align_edx" + +skip_breakpoint stack_align_edx + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in stack_align_edx.*\r\n#1\[ \t\]*$hex in main.*" \ + "second backtrace in stack_align_edx" + +gdb_test "info frame" \ + ".*Saved registers:.*ecx at.*ebp at.*edi at.*eip at.*" \ + "saved registers in stack_align_edx" + + +# Testcase from breakpoints/2080 (when %eax is used) + +gdb_test "break *(stack_align_eax + 7)" \ + "Breakpoint \[0-9\]* at $hex" + +gdb_test "continue" \ + "Breakpoint \[0-9\]*.*stack_align_eax.*" \ + "continue to stack_align_eax + 7" + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in stack_align_eax.*\r\n#1\[ \t\]*$hex in main.*" \ + "first backtrace in stack_align_eax" + +gdb_test "continue" \ + "Program received signal SIGTRAP.*" \ + "continue in stack_align_eax" + +skip_breakpoint stack_align_eax + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in stack_align_eax.*\r\n#1\[ \t\]*$hex in main.*" \ + "second backtrace in stack_align_eax" + +gdb_test "info frame" \ + ".*Saved registers:.*ecx at.*ebp at.*edi at.*eip at.*" \ + "saved registers in stack_align_eax" + + +# Testcase from symtab/1253. + +gdb_test "continue" "Program received signal SIGTRAP.*" "continue to gdb1253" + +skip_breakpoint gdb1253 + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in gdb1253.*\r\n#1\[ \t\]*$hex in main.*" \ + "backtrace in gdb1253" + +gdb_test "info frame" \ + ".*Saved registers:.*ebp at.*edi at.*eip at.*" \ + "saved registers in gdb1253" + + +# Testcase from backtrace/1718. + +gdb_test "continue" "Program received signal SIGTRAP.*" "continue to gdb1718" + +skip_breakpoint gdb1718 + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in gdb1718.*\r\n#1\[ \t\]*$hex in main.*" \ + "backtrace in gdb1718" + +setup_kfail *-*-* gdb/1718 +gdb_test "info frame" \ + ".*Saved registers:.*esi at.*ebx at.*eip at.*" \ + "saved registers in gdb1718" + + +# Testcase from backtrace/1338. + +gdb_test "continue" "Program received signal SIGTRAP.*" "continue to gdb1338" + +skip_breakpoint gdb1338 + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in gdb1338.*\r\n#1\[ \t\]*$hex in main.*" \ + "backtrace in gdb1338" + +gdb_test "info frame" \ + ".*Saved registers:.*ebx at.*esi at.*edi at.*eip at.*" \ + "saved registers in gdb1338" + +# Testcase jump_at_beginning. +gdb_test_multiple "break jump_at_beginning" \ + "set breakpoint in jump_at_beginning" { + -re "Breakpoint \[0-9\]* at ($hex).*$gdb_prompt $" { + gdb_test "x/i $expect_out(1,string)" \ + ".*:.*jmp.*" \ + "check jump_at_beginning prologue end" + } + default { + fail "set breakpoint in jump_at_beginning" + } +} Index: altivec-regs.exp =================================================================== --- altivec-regs.exp (nonexistent) +++ altivec-regs.exp (revision 33) @@ -0,0 +1,237 @@ +# Copyright (C) 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu +# + +# Tests for Powerpc AltiVec register setting and fetching + +if $tracelevel then { + strace $tracelevel +} + +# +# Test the use of registers, especially AltiVec registers, for Powerpc. +# This file uses altivec-regs.c for input. +# + +set prms_id 0 +set bug_id 0 + +if {![istarget "powerpc*"] || [skip_altivec_tests]} then { + verbose "Skipping altivec register tests." + verbose -log "Skipping altivec register tests." + return +} + +set testfile "altivec-regs" +set binfile ${objdir}/${subdir}/${testfile} +set srcfile ${testfile}.c + +set compile_flags {debug nowarnings} +if [get_compiler_info $binfile] { + warning "get_compiler failed" + return -1 +} + +if [test_compiler_info gcc*] { + set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec" +} elseif [test_compiler_info xlc*] { + set compile_flags "$compile_flags additional_flags=-qaltivec" +} else { + warning "unknown compiler" + return -1 +} + +if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $compile_flags] != "" } { + untested altivec-regs.exp + return -1 +} + +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# +# Run to `main' where we begin our tests. +# + +if ![runto_main] then { + gdb_suppress_tests +} + +# set all the registers integer portions to 1 +for {set i 0} {$i < 32} {incr i 1} { + for {set j 0} {$j < 4} {incr j 1} { + gdb_test "set \$vr$i.v4_int32\[$j\] = 1" "" "set reg vr$i.v4si.f\[$j\]" + } +} + +gdb_test "set \$vscr = 1" "" "" +gdb_test "set \$vrsave = 1" "" "" + +# Now execute some target code, so that GDB's register cache is flushed. + +gdb_test "next" "" "" + +send_gdb "show endian\n" +set endianness "" +gdb_expect { + -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" { + pass "endianness" + set endianness $expect_out(2,string) + } + -re ".*$gdb_prompt $" { + fail "couldn't get endianness" + } + timeout { fail "(timeout) endianness" } +} + +# And then read the AltiVec registers back, to see that +# a) the register write above worked, and +# b) the register read (below) also works. + +if {$endianness == "big"} { +set vector_register ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." +} else { +set vector_register ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.." +} + +for {set i 0} {$i < 32} {incr i 1} { + gdb_test "info reg vr$i" "vr$i.*$vector_register" "info reg vr$i" +} + +gdb_test "info reg vrsave" "vrsave.*0x1\t1" "info reg vrsave" +gdb_test "info reg vscr" "vscr.*0x1\t1" "info reg vscr" + +# Now redo the same tests, but using the print command. +# Note: in LE case, the char array is printed WITHOUT the last character. +# Gdb treats the terminating null char in the array like the terminating +# null char in a string and doesn't print it. This is not a failure, but +# the way gdb works. + +if {$endianness == "big"} { + set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .0, 1, 0, 1, 0, 1, 0, 1., v16_int8 = .0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1.." +} else { + set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .1, 0, 1, 0, 1, 0, 1, 0., v16_int8 = .1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.." +} + +for {set i 0} {$i < 32} {incr i 1} { + gdb_test "print \$vr$i" ".* = $decimal_vector" "print vr$i" +} + +gdb_test "print \$vrsave" ".* = 1" "print vrsave" +gdb_test "print \$vscr" ".* = 1" "print vscr" + +for {set i 0} {$i < 32} {incr i 1} { + set pattern$i ".*vr$i.*" + append pattern$i $vector_register +} + +send_gdb "info vector\n" +gdb_expect_list "info vector" ".*$gdb_prompt $" { +[$pattern0] +[$pattern1] +[$pattern2] +[$pattern3] +[$pattern4] +[$pattern5] +[$pattern6] +[$pattern7] +[$pattern8] +[$pattern9] +[$pattern10] +[$pattern11] +[$pattern12] +[$pattern13] +[$pattern14] +[$pattern15] +[$pattern16] +[$pattern17] +[$pattern18] +[$pattern19] +[$pattern20] +[$pattern21] +[$pattern22] +[$pattern23] +[$pattern24] +[$pattern25] +[$pattern26] +[$pattern27] +[$pattern28] +[$pattern29] +[$pattern30] +[$pattern31] +"\[ \t\n\r\]+vscr\[ \t\]+0x1" +"\[ \t\n\r\]+vrsave\[ \t\]+0x1" +} + +gdb_test "break vector_fun" \ + "Breakpoint 2 at.*altivec-regs.c, line \[0-9\]+\\." \ + "Set breakpoint at vector_fun" + +# Actually it is nuch easier to see these results printed in hex. +gdb_test "set output-radix 16" \ + "Output radix now set to decimal 16, hex 10, octal 20." \ + "Set output radix to hex" + +gdb_test "continue" \ + "Breakpoint 2, vector_fun .a=.0xfefefefe, 0xfefefefe, 0xfefefefe, 0xfefefefe., b=.0x1010101, 0x1010101, 0x1010101, 0x1010101.*altivec-regs.c.*vec_splat_u8.2..;" \ + "continue to vector_fun" + +# Do a next over the assignment to vector 'a'. +gdb_test "next" ".*b = \\(\\(vector unsigned int\\) vec_splat_u8\\(3\\)\\);" \ + "next (1)" + +# Do a next over the assignment to vector 'b'. +gdb_test "next" "c = vec_add \\(a, b\\);" \ + "next (2)" + +# Now 'a' should be '0x02020202...' and 'b' should be '0x03030303...' +gdb_test "print/x a" \ + ".*= .0x2020202, 0x2020202, 0x2020202, 0x2020202." \ + "print vector parameter a" + +gdb_test "print/x b" \ + ".*= .0x3030303, 0x3030303, 0x3030303, 0x3030303." \ + "print vector parameter b" + +# If we do an 'up' now, and print 'x' and 'y' we should see the values they +# have in main, not the values they have in vector_fun. +gdb_test "up" ".1.*main \\(\\) at.*altivec-regs.c.*z = vector_fun \\(x, y\\);" \ + "up to main" + +gdb_test "print/x x" \ + ".*= .0xfefefefe, 0xfefefefe, 0xfefefefe, 0xfefefefe." \ + "print vector x" + +gdb_test "print/x y" \ + ".*= .0x1010101, 0x1010101, 0x1010101, 0x1010101." \ + "print vector y" + +# now go back to vector_func and do a finish, to see if we can print the return +# value correctly. + +gdb_test "down" \ + ".0 vector_fun \\(a=.0x2020202, 0x2020202, 0x2020202, 0x2020202., b=.0x3030303, 0x3030303, 0x3030303, 0x3030303.\\) at.*altivec-regs.c.*c = vec_add \\(a, b\\);" \ + "down to vector_fun" + +gdb_test "finish" \ + "Run till exit from .0 vector_fun \\(a=.0x2020202, 0x2020202, 0x2020202, 0x2020202., b=.0x3030303, 0x3030303, 0x3030303, 0x3030303.\\) at.*altivec-regs.c.*in main \\(\\) at.*altivec-regs.c.*z = vector_fun \\(x, y\\);.*Value returned is.*= .0x5050505, 0x5050505, 0x5050505, 0x5050505." \ + "finish returned correct value" + + + Index: spu-info.c =================================================================== --- spu-info.c (nonexistent) +++ spu-info.c (revision 33) @@ -0,0 +1,234 @@ +/* Copyright 2007, 2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + This file is part of the gdb testsuite. + + Contributed by Markus Deuling . + Tests for 'info spu' commands. */ + +#include +#include +#include +#include +#include +#include + + +/* PPE-assisted call interface. */ +void +send_to_ppe (unsigned int signalcode, unsigned int opcode, void *data) +{ + __vector unsigned int stopfunc = + { + signalcode, /* stop */ + (opcode << 24) | (unsigned int) data, + 0x4020007f, /* nop */ + 0x35000000 /* bi $0 */ + }; + + void (*f) (void) = (void *) &stopfunc; + asm ("sync"); + f (); +} + +/* PPE-assisted call to mmap from SPU. */ +unsigned long long +mmap_ea (unsigned long long start, size_t length, + int prot, int flags, int fd, off_t offset) +{ + struct mmap_args + { + unsigned long long start __attribute__ ((aligned (16))); + size_t length __attribute__ ((aligned (16))); + int prot __attribute__ ((aligned (16))); + int flags __attribute__ ((aligned (16))); + int fd __attribute__ ((aligned (16))); + off_t offset __attribute__ ((aligned (16))); + } args; + + args.start = start; + args.length = length; + args.prot = prot; + args.flags = flags; + args.fd = fd; + args.offset = offset; + + send_to_ppe (0x2101, 11, &args); + return args.start; +} + +/* This works only in a Linux environment with <= 1024 open + file descriptors for one process. Result is the file + descriptor for the current context if available. */ +int +find_context_fd (void) +{ + int dir_fd = -1; + int i; + + for (i = 0; i < 1024; i++) + { + struct stat stat; + + if (fstat (i, &stat) < 0) + break; + if (S_ISDIR (stat.st_mode)) + dir_fd = dir_fd == -1 ? i : -2; + } + return dir_fd < 0 ? -1 : dir_fd; +} + +/* Open the context file and return the file handler. */ +int +open_context_file (int context_fd, char *name, int flags) +{ + char buf[128]; + + if (context_fd < 0) + return -1; + + sprintf (buf, "/proc/self/fd/%d/%s", context_fd, name); + return open (buf, flags); +} + + +int +do_event_test () +{ + spu_write_event_mask (MFC_MULTI_SRC_SYNC_EVENT); /* 0x1000 */ /* Marker Event */ + spu_write_event_mask (MFC_PRIV_ATTN_EVENT); /* 0x0800 */ + spu_write_event_mask (MFC_LLR_LOST_EVENT); /* 0x0400 */ + spu_write_event_mask (MFC_SIGNAL_NOTIFY_1_EVENT); /* 0x0200 */ + spu_write_event_mask (MFC_SIGNAL_NOTIFY_2_EVENT); /* 0x0100 */ + spu_write_event_mask (MFC_OUT_MBOX_AVAILABLE_EVENT); /* 0x0080 */ + spu_write_event_mask (MFC_OUT_INTR_MBOX_AVAILABLE_EVENT); /* 0x0040 */ + spu_write_event_mask (MFC_DECREMENTER_EVENT); /* 0x0020 */ + spu_write_event_mask (MFC_IN_MBOX_AVAILABLE_EVENT); /* 0x0010 */ + spu_write_event_mask (MFC_COMMAND_QUEUE_AVAILABLE_EVENT); /* 0x0008 */ + spu_write_event_mask (MFC_LIST_STALL_NOTIFY_EVENT); /* 0x0002 */ + spu_write_event_mask (MFC_TAG_STATUS_UPDATE_EVENT); /* 0x0001 */ + + return 0; +} + +int +do_dma_test () +{ + #define MAP_FAILED (-1ULL) + #define PROT_READ 0x1 + #define MAP_PRIVATE 0x002 + #define BSIZE 128 + static char buf[BSIZE] __attribute__ ((aligned (128))); + char *file = "/var/tmp/tmp_buf"; + struct stat fdstat; + int fd, cnt; + unsigned long long src; + + /* Create a file and fill it with some bytes. */ + fd = open (file, O_CREAT | O_RDWR | O_TRUNC, 0777); + if (fd == -1) + return -1; + memset ((void *)buf, '1', BSIZE); + write (fd, buf, BSIZE); + write (fd, buf, BSIZE); + memset ((void *)buf, 0, BSIZE); + + if (fstat (fd, &fdstat) != 0 + || !fdstat.st_size) + return -2; + + src = mmap_ea(0ULL, fdstat.st_size, PROT_READ, MAP_PRIVATE, fd, 0); + if (src == MAP_FAILED) + return -3; + + /* Copy some data via DMA. */ + mfc_get (&buf, src, BSIZE, 5, 0, 0); /* Marker DMA */ + mfc_write_tag_mask (1<<5); /* Marker DMAWait */ + spu_mfcstat (MFC_TAG_UPDATE_ALL); + + /* Close the file. */ + close (fd); + + return cnt; +} + +int +do_mailbox_test () +{ + /* Write to SPU Outbound Mailbox. */ + if (spu_stat_out_mbox ()) /* Marker Mbox */ + spu_write_out_mbox (0x12345678); + + /* Write to SPU Outbound Interrupt Mailbox. */ + if (spu_stat_out_intr_mbox ()) + spu_write_out_intr_mbox (0x12345678); + + return 0; /* Marker MboxEnd */ +} + +int +do_signal_test () +{ + struct stat fdstat; + int context_fd = find_context_fd (); + int ret, buf, fd; + + buf = 23; /* Marker Signal */ + /* Write to signal1. */ + fd = open_context_file (context_fd, "signal1", O_RDWR); + if (fstat (fd, &fdstat) != 0) + return -1; + ret = write (fd, buf, sizeof (int)); + close (fd); /* Marker Signal1 */ + + /* Write to signal2. */ + fd = open_context_file (context_fd, "signal2", O_RDWR); + if (fstat (fd, &fdstat) != 0) + return -1; + ret = write (fd, buf, sizeof (int)); + close (fd); /* Marker Signal2 */ + + /* Read signal1. */ + if (spu_stat_signal1 ()) + ret = spu_read_signal1 (); + + /* Read signal2. */ + if (spu_stat_signal2 ()) + ret = spu_read_signal2 (); /* Marker SignalRead */ + + return 0; +} + +int +main (unsigned long long speid, unsigned long long argp, + unsigned long long envp) +{ + int res; + + /* info spu event */ + res = do_event_test (); + + /* info spu dma */ + res = do_dma_test (); + + /* info spu mailbox */ + res = do_mailbox_test (); + + /* info spu signal */ + res = do_signal_test (); + + return 0; +} +
spu-info.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pa-nullify.s =================================================================== --- pa-nullify.s (nonexistent) +++ pa-nullify.s (revision 33) @@ -0,0 +1,58 @@ + .text + .align 8 + .globl foo + .type foo, @function +foo: + .PROC + .CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + copy %r3,%r1 + copy %r30,%r3 + stwm %r1,64(%r30) + stw %r26,-36(%r3) + ldw -36(%r3),%r19 + copy %r19,%r28 + ldo 64(%r3),%r30 + ldwm -64(%r30),%r3 + bv,n %r0(%r2) + .EXIT + .PROCEND + + .globl bar + .type bar, @function +bar: + .PROC + .CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + copy %r3,%r1 + copy %r30,%r3 + stwm %r1,64(%r30) + ldo 64(%r3),%r30 + ldwm -64(%r30),%r3 + bv,n %r0(%r2) + .EXIT + .PROCEND + + .globl main + .type main, @function +main: + .PROC + .CALLINFO FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3 + .ENTRY + stw %r2,-20(%r30) + copy %r3,%r1 + copy %r30,%r3 + stwm %r1,64(%r30) + stw %r26,-36(%r3) + stw %r25,-40(%r3) + ldw -36(%r3),%r26 + bl foo,%r2 + nop + copy %r28,%r19 + copy %r19,%r28 + ldw -20(%r3),%r2 + ldo 64(%r3),%r30 + ldwm -64(%r30),%r3 + bv,n %r0(%r2) + .EXIT + .PROCEND
pa-nullify.s Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: e500-abi.c =================================================================== --- e500-abi.c (nonexistent) +++ e500-abi.c (revision 33) @@ -0,0 +1,106 @@ +#include + +/* Test PowerPC SPU extensions. */ + +#define vector __attribute__((vector_size(8))) + +vector unsigned short f_vec; +vector short g_vec; +vector float h_vec; +vector float i_vec; +vector unsigned int l_vec; +vector int m_vec; +vector int n_vec; + +/* dummy variables used in the testfile */ +vector unsigned int a_vec_d = {1, 1}; +vector int b_vec_d = {0, 0}; +vector float c_vec_d = {1.0, 1.0}; +vector unsigned int d_vec_d = {0, 0}; +vector int e_vec_d = {1, 1}; +vector unsigned short f_vec_d = {1, 1, 1, 1}; +vector short g_vec_d = {1, 1, 1, 1}; +vector float h_vec_d = {1.0, 1.0}; +vector float i_vec_d = {2.0, 2.0}; +vector unsigned int l_vec_d = {0, 0}; +vector int m_vec_d = {0, 0}; + + +vector int +vec_func (vector unsigned int a_vec_f, + vector int b_vec_f, + vector float c_vec_f, + vector unsigned int d_vec_f, + vector int e_vec_f, + vector unsigned short f_vec_f, + vector short g_vec_f, + vector float h_vec_f, + vector float i_vec_f, + vector unsigned int l_vec_f, + vector int m_vec_f) +{ + vector int n_vec; + + + int x,y,z; + x = 2; + y = 3; + + z = x + y; + z++; + n_vec = __ev_and(a_vec_f, b_vec_f); + n_vec = __ev_or(c_vec_f, d_vec_f); + n_vec = __ev_or(e_vec_f, f_vec_f); + n_vec = __ev_and(g_vec_f, h_vec_f); + n_vec = __ev_and(i_vec_f, l_vec_f); + n_vec = __ev_or(m_vec_f, a_vec_f); + + return n_vec; +} + +void marker(void) {}; + +int +main (void) +{ + vector unsigned int a_vec; + vector int b_vec; + vector float c_vec; + vector unsigned int d_vec; + vector int e_vec; + + vector int res_vec; + + a_vec = (vector unsigned int)__ev_create_u64 ((uint64_t) 55); + b_vec = __ev_create_s64 ((int64_t) 66); + c_vec = (vector float) __ev_create_fs (3.14F, 2.18F); + d_vec = (vector unsigned int) __ev_create_u32 ((uint32_t) 5, (uint32_t) 4); + e_vec = (vector int) __ev_create_s32 ((int32_t) 5, (int32_t) 6); + f_vec = (vector unsigned short) __ev_create_u16 ((uint16_t) 6, (uint16_t) 6, (uint16_t) 7, (uint16_t) 1); + g_vec = (vector short) __ev_create_s16 ((int16_t) 6, (int16_t) 6, (int16_t) 7, (int16_t) 9); + h_vec = (vector float) __ev_create_sfix32_fs (3.0F, 2.0F); + i_vec = (vector float) __ev_create_ufix32_fs (3.0F, 2.0F); + l_vec = (vector unsigned int) __ev_create_ufix32_u32 (3U, 5U); + m_vec = (vector int) __ev_create_sfix32_s32 (6, 9); + + marker (); + +#if 0 +/* This line is useful for cut-n-paste from a gdb session. */ +vec_func(a_vec,b_vec,c_vec,d_vec,e_vec,f_vec,g_vec,h_vec,i_vec,l_vec,m_vec) +#endif + + res_vec = vec_func (a_vec, /* goes in r3 */ + b_vec, /* goes in r4 */ + c_vec, /* goes in r5 */ + d_vec, /* goes in r6 */ + e_vec, /* goes in r7 */ + f_vec, /* goes in r8 */ + g_vec, /* goes in r9 */ + h_vec, /* goes in r10 */ + i_vec, /* goes in stack */ + l_vec, /* goes in stack */ + m_vec); /* goes in stack */ + + return 0; +}
e500-abi.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: powerpc-d128-regs.exp =================================================================== --- powerpc-d128-regs.exp (nonexistent) +++ powerpc-d128-regs.exp (revision 33) @@ -0,0 +1,77 @@ +# This testcase is part of GDB, the GNU debugger. + +# Copyright 2008 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@gnu.org + +# Testcase for ppc decimal128 pseudo-registers. + +if $tracelevel then { + strace $tracelevel +} + +if ![istarget "powerpc64-*"] then { + verbose "Skipping powerpc Decimal128 pseudo-registers testcase." + return +} + +set testfile "powerpc-d128-regs" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {quiet debug}] != "" } { + untested powerpc-d128-regs.exp + return -1 +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if { ![runto main] } then { + fail "run to main" + return +} + +if [gdb_test "show arch" ".*currently powerpc:common.*" "Checking for PPC arch"] { + return -1; +} + +gdb_test "next" "" + +for {set i 0} {$i < 16} {incr i 1} { +gdb_test "set \$dl$i=d128" "" "Set dl$i register" + +gdb_test "print \$dl$i" "\\\$$decimal = 1\.2345678910" "Print dl$i register as DFP" + +gdb_test "info reg dl$i" \ + "dl$i\[ \]*1\.2345678910\[\t\]*\\(raw 0x2205800000000000000000049c5de09c\\)" \ + "Print dl$i register with the info reg command" + +gdb_test "info reg f[expr 2*$i]" \ + "f[expr 2*$i]\[ \]*8\.608957309287334e\-145\[\t\]*\\(raw 0x2205800000000000\\)" \ + "Testing lower half of dl$i register" + +gdb_test "info reg f[expr 2*$i+1]" \ + "f[expr 2*$i+1]\[ \]*9\.7841140127686122e\-314\[\t\]*\\(raw 0x000000049c5de09c\\)" \ + "Testing upper half of dl$i register" + +} Index: e500-prologue.c =================================================================== --- e500-prologue.c (nonexistent) +++ e500-prologue.c (revision 33) @@ -0,0 +1,52 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2004, 2007, 2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +void arg_passing_test2 (void); + +int +main (void) +{ + arg_passing_test2 (); + return 0; +} + + +/* Asm for procedure arg_passing_test2. + + The challenge here is getting past the 'mr 0,3' and 'stb' + instructions. */ + +asm (" .section \".text\"\n" + " .align 2\n" + " .globl arg_passing_test2\n" + " .type arg_passing_test2, @function\n" + "arg_passing_test2:\n" + " stwu 1,-64(1)\n" + " stw 31,60(1)\n" + " mr 31,1\n" + " mr 0,3\n" + " evstdd 4,16(31)\n" + " stw 5,24(31)\n" + " stw 7,32(31)\n" + " stw 8,36(31)\n" + " stw 9,40(31)\n" + " stb 0,8(31)\n" + " lwz 11,0(1)\n" + " lwz 31,-4(11)\n" + " mr 1,11\n" + " blr\n" + " .size arg_passing_test2, .-arg_passing_test2\n");
e500-prologue.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i386-unwind.exp =================================================================== --- i386-unwind.exp (nonexistent) +++ i386-unwind.exp (revision 33) @@ -0,0 +1,76 @@ +# Copyright 2003, 2004, 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@gnu.org + +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + +# Test i386 unwinder. + +set prms_id 0 +set bug_id 0 + +if ![istarget "i?86-*-*"] then { + verbose "Skipping i386 unwinder tests." + return +} + +set testfile "i386-unwind" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +# some targets have leading underscores on assembly symbols. +# TODO: detect this automatically +set additional_flags "" +if [istarget "i?86-*-cygwin*"] then { + set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\"" +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { + untested i386-unwind.exp + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# Testcase for backtrace/1435. + +# We use gdb_run_cmd so this stands a chance to work for remote +# targets too. +gdb_run_cmd + +gdb_expect { + -re "Program received signal SIGTRAP.*$gdb_prompt $" { + pass "run past gdb1435" + } + -re ".*$gdb_prompt $" { + fail "run past gdb1435" + } + timeout { + fail "run past gdb1435 (timeout)" + } +} + +gdb_test "backtrace 10" \ + "#1\[ \t]*$hex in gdb1435.*\r\n#2\[ \t\]*$hex in main.*" \ + "backtrace past gdb1435" Index: e500-regs.c =================================================================== --- e500-regs.c (nonexistent) +++ e500-regs.c (revision 33) @@ -0,0 +1,38 @@ +#include +#include + +#define vector __attribute__((vector_size(8))) + + +vector int +vector_fun (vector int a, vector int b) +{ + vector int c; + a = (vector int) __ev_create_s32 (2, 2); + b = (vector int) __ev_create_s32 (3, 3); + + c = __ev_and (a, b); + return c; +} + +int +main () +{ + vector int y; + vector int x; + vector int z; + int a; + + /* This line may look unnecessary but we do need it, because we want to + have a line to do a next over (so that gdb refetches the registers) + and we don't want the code to change any vector registers. + The splat operations below modify the VRs, + so we don't want to execute them yet. */ + a = 9; + x = (vector int) __ev_create_s32 (-2, -2); + y = (vector int) __ev_create_s32 (1, 1); + + z = vector_fun (x, y); + + return 0; +}
e500-regs.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i386-size-overlap.c =================================================================== --- i386-size-overlap.c (nonexistent) +++ i386-size-overlap.c (revision 33) @@ -0,0 +1,51 @@ +/* Overlapping symbol sizes test program. + + Copyright 2007, 2008 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifdef SYMBOL_PREFIX +#define SYMBOL(str) SYMBOL_PREFIX #str +#else +#define SYMBOL(str) #str +#endif + +void +trap (void) +{ + asm ("int $0x03"); +} + +/* Jump from a function with its symbol size set, to a function + named by a local label. GDB should report the `main' function + even for the rest, after the global `inner' ends. */ + +asm(".text\n" + " .align 8\n" + " .globl " SYMBOL (main) "\n" + SYMBOL (main) ":\n" + " pushl %ebp\n" + " mov %esp, %ebp\n" + " call .Lfunc\n" + " ret\n" + SYMBOL (inner) ":\n" + " ret\n" + " .size " SYMBOL (inner) ", .-" SYMBOL (inner) "\n" + ".Lfunc:\n" + " pushl %ebp\n" + " mov %esp, %ebp\n" + " call " SYMBOL (trap) "\n" + " .size " SYMBOL (main) ", .-" SYMBOL (main) "\n");
i386-size-overlap.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alpha-step.exp =================================================================== --- alpha-step.exp (nonexistent) +++ alpha-step.exp (revision 33) @@ -0,0 +1,113 @@ +# Copyright 2005, 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +if $tracelevel { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +if ![istarget "alpha*-*-*"] then { + verbose "Skipping alpha step tests." + return +} + +set testfile "alpha-step" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } { + unsupported "Testcase compile failed." + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +proc test_stepi {function } { + # Restart the program from scratch. If GDB got confused during one + # of the previous tests, this makes sure that it doesn't affect + # this series of tests. + if ![runto_main] then { + fail "Can't run to main" + return 0 + } + + # Insert a breakpoint on the FP branch instruction inside FUNCTION. + # Since the function has been hand written, we know this instruction + # is a "fb$function" located at FUNCTION+4. + gdb_test "break *$function+4" \ + "Breakpoint .* at .*" \ + "breakpoint on fb$function instruction" + + gdb_test "continue" \ + "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \ + "continue to fb$function instruction (first call)" + + # Extra check to make sure we stopped on the FP branch instruction. + + gdb_test "x /i \$pc" \ + "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \ + "Check breakpoint on fb$function instruction (first call)" + + # Step test, followed by the check that we landed on the expected + # instruction (the testcase should be written in such a way that + # the branch is taken on the first call to this function. + + gdb_test "stepi" \ + "0x\[0-9a-fA-F\]+.*" \ + "stepi on fb$function (first call)" + + gdb_test "x /i \$pc" \ + "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+ret.*" \ + "Check stepi over fb$function stopped on ret" + + # Continue again. FUNCTION should be called a second time, this time + # with an argument such that the FP branch will not be taken. + + gdb_test "continue" \ + "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \ + "continue to fb$function instruction (second call)" + + # Extra check to make sure we stopped on the FP branch instruction. + + gdb_test "x /i \$pc" \ + "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \ + "Check breakpoint on fb$function instruction (second call)" + + # Step test, branch should not be taken. + + gdb_test "stepi" \ + "0x\[0-9a-fA-F\]+.*" \ + "stepi on fb$function (branch not taken)" + + # Extra check to verify that we landed on the instruction we expected. + + gdb_test "x /i \$pc" \ + "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fneg.*" \ + "Check stepi over fb$function stopped on fneg instruction" + +} + +test_stepi "gt" +test_stepi "ge" +test_stepi "lt" +test_stepi "le" +test_stepi "eq" +test_stepi "ne" + Index: i386-size.exp =================================================================== --- i386-size.exp (nonexistent) +++ i386-size.exp (revision 33) @@ -0,0 +1,88 @@ +# Copyright 2006, 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@gnu.org + +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + +# Test that GDB can see the sizes of symbols. + +if ![istarget "i?86-*-*"] then { + verbose "Skipping i386 unwinder tests." + return +} + +set testfile "i386-size" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +# some targets have leading underscores on assembly symbols. +# TODO: detect this automatically +set additional_flags "" +if [istarget "i?86-*-cygwin*"] then { + set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\"" +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ + executable [list debug $additional_flags]] != "" } { + untested "i386-size" + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# We use gdb_run_cmd so this stands a chance to work for remote +# targets too. +gdb_run_cmd + +gdb_expect { + -re "Program received signal SIGTRAP.*$gdb_prompt $" { + pass "run past main" + } + -re ".*$gdb_prompt $" { + fail "run past main" + } + timeout { + fail "run past main (timeout)" + } +} + +set message "backtrace shows no function" +gdb_test_multiple "backtrace 10" $message { + -re "#1\[ \t]*$hex in main.*$gdb_prompt $" { + fail $message + } + -re "#1\[ \t]*$hex in \\?\\? \\(\\).*$gdb_prompt $" { + pass $message + } +} + +set message "disassemble stops at end of main" +gdb_test_multiple "disassemble main" $message { + -re "call.*.*$gdb_prompt $" { + fail $message + } + -re ":\[ \t\]+ret\[ \t\r\n\]+End of.*$gdb_prompt $" { + pass $message + } +} Index: i386-gnu-cfi-asm.S =================================================================== --- i386-gnu-cfi-asm.S (nonexistent) +++ i386-gnu-cfi-asm.S (revision 33) @@ -0,0 +1,355 @@ +/* Copyright 2007, 2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@gnu.org + + This file is part of the gdb testsuite. + + It was generated using + "gcc -g -O9 -S -o gate.s gate.c -fasynchronous-unwind-tables", + using the following source file: + + + void *gate (void *(*gate) (void *data), void *data) + { + return 1 + (*gate) (data); + } + + Changes are marked as `CHANGE' below. */ + + .file "gate.c" + .section .debug_abbrev,"",@progbits +.Ldebug_abbrev0: + .section .debug_info,"",@progbits +.Ldebug_info0: + .section .debug_line,"",@progbits +.Ldebug_line0: + .text +.Ltext0: + .p2align 4,,15 +.globl gate + .type gate, @function +gate: +.LFB2: + .file 1 "gate.c" + .loc 1 2 0 +.LVL0: + pushl %ebp +.LCFI0: + movl %esp, %ebp +.LCFI1: + subl $8, %esp +.LCFI2: + .loc 1 3 0 + movl 12(%ebp), %eax + movl %eax, (%esp) + call *8(%ebp) + .loc 1 4 0 + leave + .loc 1 3 0 + addl $1, %eax + .loc 1 4 0 + ret +.LFE2: + .size gate, .-gate + .section .debug_frame,"",@progbits +.Lframe0: + .long .LECIE0-.LSCIE0 +.LSCIE0: + .long 0xffffffff + .byte 0x1 + .string "" + .uleb128 0x1 + .sleb128 -4 + .byte 0x8 + .byte 0xc + .uleb128 0x4 + .uleb128 0x4 + .byte 0x88 + .uleb128 0x1 + .align 4 +.LECIE0: +.LSFDE0: + .long .LEFDE0-.LASFDE0 +.LASFDE0: + .long .Lframe0 + .long .LFB2 + .long .LFE2-.LFB2 + .byte 0x4 + .long .LCFI0-.LFB2 + .byte 0xe + .uleb128 0x8 + .byte 0x85 + .uleb128 0x2 + + /* CHANGE */ + .byte 0x2f + .uleb128 0x1 + .uleb128 0x0 + /* CHANGE */ + + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .uleb128 0x5 + .align 4 +.LEFDE0: + .section .eh_frame,"a",@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 +.LSCIE1: + .long 0x0 + .byte 0x1 + .string "" + .uleb128 0x1 + .sleb128 -4 + .byte 0x8 + .byte 0xc + .uleb128 0x4 + .uleb128 0x4 + .byte 0x88 + .uleb128 0x1 + .align 4 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 +.LASFDE1: + .long .LASFDE1-.Lframe1 + .long .LFB2 + .long .LFE2-.LFB2 + .byte 0x4 + .long .LCFI0-.LFB2 + .byte 0xe + .uleb128 0x8 + .byte 0x85 + .uleb128 0x2 + + /* CHANGE */ + .byte 0x2f + .uleb128 0x1 + .uleb128 0x0 + /* CHANGE */ + + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .uleb128 0x5 + .align 4 +.LEFDE1: + .text +.Letext0: + .section .debug_loc,"",@progbits +.Ldebug_loc0: +.LLST0: + .long .LFB2-.Ltext0 + .long .LCFI0-.Ltext0 + .value 0x2 + .byte 0x74 + .sleb128 4 + .long .LCFI0-.Ltext0 + .long .LCFI1-.Ltext0 + .value 0x2 + .byte 0x74 + .sleb128 8 + .long .LCFI1-.Ltext0 + .long .LFE2-.Ltext0 + .value 0x2 + .byte 0x75 + .sleb128 8 + .long 0x0 + .long 0x0 + .section .debug_info + .long 0x74 + .value 0x2 + .long .Ldebug_abbrev0 + .byte 0x4 + .uleb128 0x1 + .long .Ldebug_line0 + .long .Letext0 + .long .Ltext0 + .long .LASF2 + .byte 0x1 + .long .LASF3 + .long .LASF4 + .uleb128 0x2 + .long 0x5f + .byte 0x1 + .long .LASF0 + .byte 0x1 + .byte 0x2 + .byte 0x1 + .long 0x5f + .long .LFB2 + .long .LFE2 + .long .LLST0 + .uleb128 0x3 + .long .LASF0 + .byte 0x1 + .byte 0x1 + .long 0x71 + .byte 0x2 + .byte 0x91 + .sleb128 0 + .uleb128 0x3 + .long .LASF1 + .byte 0x1 + .byte 0x1 + .long 0x5f + .byte 0x2 + .byte 0x91 + .sleb128 4 + .byte 0x0 + .uleb128 0x4 + .byte 0x4 + .uleb128 0x5 + .long 0x71 + .byte 0x1 + .long 0x5f + .uleb128 0x6 + .long 0x5f + .byte 0x0 + .uleb128 0x7 + .byte 0x4 + .long 0x61 + .byte 0x0 + .section .debug_abbrev + .uleb128 0x1 + .uleb128 0x11 + .byte 0x1 + .uleb128 0x10 + .uleb128 0x6 + .uleb128 0x12 + .uleb128 0x1 + .uleb128 0x11 + .uleb128 0x1 + .uleb128 0x25 + .uleb128 0xe + .uleb128 0x13 + .uleb128 0xb + .uleb128 0x3 + .uleb128 0xe + .uleb128 0x1b + .uleb128 0xe + .byte 0x0 + .byte 0x0 + .uleb128 0x2 + .uleb128 0x2e + .byte 0x1 + .uleb128 0x1 + .uleb128 0x13 + .uleb128 0x3f + .uleb128 0xc + .uleb128 0x3 + .uleb128 0xe + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x27 + .uleb128 0xc + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x11 + .uleb128 0x1 + .uleb128 0x12 + .uleb128 0x1 + .uleb128 0x40 + .uleb128 0x6 + .byte 0x0 + .byte 0x0 + .uleb128 0x3 + .uleb128 0x5 + .byte 0x0 + .uleb128 0x3 + .uleb128 0xe + .uleb128 0x3a + .uleb128 0xb + .uleb128 0x3b + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .uleb128 0x2 + .uleb128 0xa + .byte 0x0 + .byte 0x0 + .uleb128 0x4 + .uleb128 0xf + .byte 0x0 + .uleb128 0xb + .uleb128 0xb + .byte 0x0 + .byte 0x0 + .uleb128 0x5 + .uleb128 0x15 + .byte 0x1 + .uleb128 0x1 + .uleb128 0x13 + .uleb128 0x27 + .uleb128 0xc + .uleb128 0x49 + .uleb128 0x13 + .byte 0x0 + .byte 0x0 + .uleb128 0x6 + .uleb128 0x5 + .byte 0x0 + .uleb128 0x49 + .uleb128 0x13 + .byte 0x0 + .byte 0x0 + .uleb128 0x7 + .uleb128 0xf + .byte 0x0 + .uleb128 0xb + .uleb128 0xb + .uleb128 0x49 + .uleb128 0x13 + .byte 0x0 + .byte 0x0 + .byte 0x0 + .section .debug_pubnames,"",@progbits + .long 0x17 + .value 0x2 + .long .Ldebug_info0 + .long 0x78 + .long 0x25 + .string "gate" + .long 0x0 + .section .debug_aranges,"",@progbits + .long 0x1c + .value 0x2 + .long .Ldebug_info0 + .byte 0x4 + .byte 0x0 + .value 0x0 + .value 0x0 + .long .Ltext0 + .long .Letext0-.Ltext0 + .long 0x0 + .long 0x0 + .section .debug_str,"MS",@progbits,1 +.LASF1: + .string "data" +.LASF0: + .string "gate" +.LASF3: + .string "gate.c" +.LASF4: + .string "/home/jkratoch/redhat/bz165025" +.LASF2: + .string "GNU C 4.1.1 20061213 (Red Hat 4.1.1-46)" + .ident "GCC: (GNU) 4.1.1 20061213 (Red Hat 4.1.1-46)" + .section .note.GNU-stack,"",@progbits
i386-gnu-cfi-asm.S Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i386-signal.exp =================================================================== --- i386-signal.exp (nonexistent) +++ i386-signal.exp (revision 33) @@ -0,0 +1,42 @@ +# Copyright 2007, 2008 Free Software Foundation, Inc. + +# This file is part of the GDB testsuite. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then { + verbose "Skipping i386 unwinder tests." + return +} + +set testfile "i386-signal" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ + executable { debug }] != "" } { + untested i386-sigframe.exp + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +runto func +gdb_test "backtrace 10" \ + "#0 ($hex in )?func.*\r\n#1 \r\n#2 ($hex in)?main.*" + +gdb_test "finish" "Run till exit from \#0 func.*" Index: gdb1431.exp =================================================================== --- gdb1431.exp (nonexistent) +++ gdb1431.exp (revision 33) @@ -0,0 +1,63 @@ +# Copyright 2003, 2004, 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@gnu.org + +# This file is part of the gdb testsuite. + +# Tests for PR:1431. Catch gdb not continuing to second function properly. +# Note that originally this bug was reported as a problem with the "until" +# command, which actually is behaving as currently defined. What apparently +# was expected was the behavior of the newer "advance" command. + +if $tracelevel { + strace $tracelevel +} + +# Observe that the until command doesn't go all the way to sub2. + +set prms_id 0 +set bug_id 0 + +if ![istarget "sh-*-*"] then { + verbose "Skipping SH backtrace tests." + return +} + +set testfile "gdb1431" +set srcfile ${testfile}.s +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] != "" } { + untested gdb1431.exp + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# +# Run to `main' where we begin our tests. +# + +if ![runto_main] then { + gdb_suppress_tests +} + +gdb_test "advance sub1" "hello world\r\n$hex in sub1 \\(\\)" "get to sub1" +gdb_test "advance sub2" "$hex in main \\(\\)" "advance returns from sub1 frame" +gdb_test "advance sub2" "$hex in sub2 \\(\\)" "get to sub2" Index: altivec-abi.c =================================================================== --- altivec-abi.c (nonexistent) +++ altivec-abi.c (revision 33) @@ -0,0 +1,141 @@ +#include + +vector short vshort = {111, 222, 333, 444, 555, 666, 777, 888}; +vector unsigned short vushort = {100, 200, 300, 400, 500, 600, 700, 800}; +vector int vint = {-10, -20, -30, -40}; +vector unsigned int vuint = {1111, 2222, 3333, 4444}; +vector char vchar = {'a','b','c','d','e','f','g','h','i','l','m','n','o','p','q','r'}; +vector unsigned char vuchar = {'A','B','C','D','E','F','G','H','I','L','M','N','O','P','Q','R'}; +vector float vfloat = {1.25, 3.75, 5.5, 1.25}; + +vector short vshort_d = {0,0,0,0,0,0,0,0}; +vector unsigned short vushort_d = {0,0,0,0,0,0,0,0}; +vector int vint_d = {0,0,0,0}; +vector unsigned int vuint_d = {0,0,0,0}; +vector char vchar_d = {'z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z'}; +vector unsigned char vuchar_d = {'Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z'}; +vector float vfloat_d = {1.0, 1.0, 1.0, 1.0}; + +struct test_vec_struct +{ + vector signed short vshort1; + vector signed short vshort2; + vector signed short vshort3; + vector signed short vshort4; +}; + +static vector signed short test4[4] = +{ + (vector signed short) {1, 2, 3, 4, 5, 6, 7, 8}, + (vector signed short) {11, 12, 13, 14, 15, 16, 17, 18}, + (vector signed short) {21, 22, 23, 24, 25, 26, 27, 28}, + (vector signed short) {31, 32, 33, 34, 35, 36, 37, 38} +}; + +void +struct_of_vector_func (struct test_vec_struct vector_struct) +{ + vector_struct.vshort1 = vec_add (vector_struct.vshort1, vector_struct.vshort2); + vector_struct.vshort3 = vec_add (vector_struct.vshort3, vector_struct.vshort4); +} + +void +array_of_vector_func (vector signed short *matrix) +{ + matrix[0] = vec_add (matrix[0], matrix[1]); + matrix[2] = vec_add (matrix[2], matrix[3]); +} + +vector int +vec_func (vector short vshort_f, /* goes in v2 */ + vector unsigned short vushort_f, /* goes in v3 */ + vector int vint_f, /* goes in v4 */ + vector unsigned int vuint_f, /* goes in v5 */ + vector char vchar_f, /* goes in v6 */ + vector unsigned char vuchar_f, /* goes in v7 */ + vector float vfloat_f, /* goes in v8 */ + vector short x_f, /* goes in v9 */ + vector int y_f, /* goes in v10 */ + vector char a_f, /* goes in v11 */ + vector float b_f, /* goes in v12 */ + vector float c_f, /* goes in v13 */ + vector int intv_on_stack_f) +{ + + vector int vint_res; + vector unsigned int vuint_res; + vector short vshort_res; + vector unsigned short vushort_res; + vector char vchar_res; + vector float vfloat_res; + vector unsigned char vuchar_res; + + vint_res = vec_add (vint_f, intv_on_stack_f); + vint_res = vec_add (vint_f, y_f); + vuint_res = vec_add (vuint_f, ((vector unsigned int) {5,6,7,8})); + vshort_res = vec_add (vshort_f, x_f); + vushort_res = vec_add (vushort_f, + ((vector unsigned short) {1,2,3,4,5,6,7,8})); + vchar_res = vec_add (vchar_f, a_f); + vfloat_res = vec_add (vfloat_f, b_f); + vfloat_res = vec_add (c_f, ((vector float) {1.1,1.1,1.1,1.1})); + vuchar_res = vec_add (vuchar_f, + ((vector unsigned char) {'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a'})); + + return vint_res; +} + +void marker(void) {}; + +int +main (void) +{ + vector int result = {-1,-1,-1,-1}; + vector short x = {1,2,3,4,5,6,7,8}; + vector int y = {12, 22, 32, 42}; + vector int intv_on_stack = {12, 34, 56, 78}; + vector char a = {'v','e','c','t','o','r',' ','o','f',' ','c','h','a','r','s','.' }; + vector float b = {5.5, 4.5, 3.75, 2.25}; + vector float c = {1.25, 3.5, 5.5, 7.75}; + + vector short x_d = {0,0,0,0,0,0,0,0}; + vector int y_d = {0,0,0,0}; + vector int intv_on_stack_d = {0,0,0,0}; + vector char a_d = {'q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q'}; + vector float b_d = {5.0, 5.0, 5.0, 5.0}; + vector float c_d = {3.0, 3.0, 3.0, 3.0}; + + int var_int = 44; + short var_short = 3; + struct test_vec_struct vect_struct; + + vect_struct.vshort1 = (vector signed short){1, 2, 3, 4, 5, 6, 7, 8}; + vect_struct.vshort2 = (vector signed short){11, 12, 13, 14, 15, 16, 17, 18}; + vect_struct.vshort3 = (vector signed short){21, 22, 23, 24, 25, 26, 27, 28}; + vect_struct.vshort4 = (vector signed short){31, 32, 33, 34, 35, 36, 37, 38}; + + marker (); +#if 0 + /* This line is useful for cutting and pasting from the gdb command line. */ +vec_func(vshort,vushort,vint,vuint,vchar,vuchar,vfloat,x,y,a,b,c,intv_on_stack) +#endif + result = vec_func (vshort, /* goes in v2 */ + vushort, /* goes in v3 */ + vint, /* goes in v4 */ + vuint, /* goes in v5 */ + vchar, /* goes in v6 */ + vuchar, /* goes in v7 */ + vfloat, /* goes in v8 */ + x, /* goes in v9 */ + y, /* goes in v10 */ + a, /* goes in v11 */ + b, /* goes in v12 */ + c, /* goes in v13 */ + intv_on_stack); + + struct_of_vector_func (vect_struct); + array_of_vector_func (test4); + + return 0; +} +
altivec-abi.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i386-sse.c =================================================================== --- i386-sse.c (nonexistent) +++ i386-sse.c (revision 33) @@ -0,0 +1,88 @@ +/* Test program for SSE registers. + + Copyright 2004, 2007, 2008 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include +#include "i386-cpuid.h" + +typedef struct { + float f[4]; +} v4sf_t; + + +v4sf_t data[8] = + { + { { 0.0, 0.25, 0.50, 0.75 } }, + { { 1.0, 1.25, 1.50, 1.75 } }, + { { 2.0, 2.25, 2.50, 2.75 } }, + { { 3.0, 3.25, 3.50, 3.75 } }, + { { 4.0, 4.25, 4.50, 4.75 } }, + { { 5.0, 5.25, 5.50, 5.75 } }, + { { 6.0, 6.25, 6.50, 6.75 } }, + { { 7.0, 7.25, 7.50, 7.75 } }, + }; + + +int +have_sse (void) +{ + int edx = i386_cpuid (); + + if (edx & bit_SSE) + return 1; + else + return 0; +} + +int +main (int argc, char **argv) +{ + if (have_sse ()) + { + asm ("movaps 0(%0), %%xmm0\n\t" + "movaps 16(%0), %%xmm1\n\t" + "movaps 32(%0), %%xmm2\n\t" + "movaps 48(%0), %%xmm3\n\t" + "movaps 64(%0), %%xmm4\n\t" + "movaps 80(%0), %%xmm5\n\t" + "movaps 96(%0), %%xmm6\n\t" + "movaps 112(%0), %%xmm7\n\t" + : /* no output operands */ + : "r" (data) + : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"); + + puts ("Hi!"); /* first breakpoint here */ + + asm ( + "movaps %%xmm0, 0(%0)\n\t" + "movaps %%xmm1, 16(%0)\n\t" + "movaps %%xmm2, 32(%0)\n\t" + "movaps %%xmm3, 48(%0)\n\t" + "movaps %%xmm4, 64(%0)\n\t" + "movaps %%xmm5, 80(%0)\n\t" + "movaps %%xmm6, 96(%0)\n\t" + "movaps %%xmm7, 112(%0)\n\t" + : /* no output operands */ + : "r" (data) + : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"); + + puts ("Bye!"); /* second breakpoint here */ + } + + return 0; +}
i386-sse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ppc64-atomic-inst.c =================================================================== --- ppc64-atomic-inst.c (nonexistent) +++ ppc64-atomic-inst.c (revision 33) @@ -0,0 +1,44 @@ +/* This file is part of GDB, the GNU debugger. + + Copyright 2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +int main() +{ + unsigned int word = 0; + unsigned int *word_addr = &word; + unsigned long dword = 0; + unsigned long *dword_addr = &dword; + + __asm __volatile ("1: lwarx %0,0,%2\n" \ + " addi %0,%0,1\n" \ + " stwcx. %0,0,%2\n" \ + " bne- 1b" \ + : "=&b" (word), "=m" (*word_addr) \ + : "b" (word_addr), "m" (*word_addr) \ + : "cr0", "memory"); \ + + __asm __volatile ("1: ldarx %0,0,%2\n" \ + " addi %0,%0,1\n" \ + " stdcx. %0,0,%2\n" \ + " bne- 1b" \ + : "=&b" (dword), "=m" (*dword_addr) \ + : "b" (dword_addr), "m" (*dword_addr) \ + : "cr0", "memory"); \ + + return 0; +}
ppc64-atomic-inst.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i386-prologue.c =================================================================== --- i386-prologue.c (nonexistent) +++ i386-prologue.c (revision 33) @@ -0,0 +1,165 @@ +/* Unwinder test program. + + Copyright (C) 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifdef SYMBOL_PREFIX +#define SYMBOL(str) SYMBOL_PREFIX #str +#else +#define SYMBOL(str) #str +#endif + +void gdb1253 (void); +void gdb1718 (void); +void gdb1338 (void); +void jump_at_beginning (void); + +int +main (void) +{ + standard (); + stack_align_ecx (); + stack_align_edx (); + stack_align_eax (); + gdb1253 (); + gdb1718 (); + gdb1338 (); + jump_at_beginning (); + return 0; +} + +/* A normal prologue. */ + +asm(".text\n" + " .align 8\n" + SYMBOL (standard) ":\n" + " pushl %ebp\n" + " movl %esp, %ebp\n" + " pushl %edi\n" + " int $0x03\n" + " leave\n" + " ret\n"); + +/* Relevant part of the prologue from symtab/1253. */ + +asm(".text\n" + " .align 8\n" + SYMBOL (gdb1253) ":\n" + " pushl %ebp\n" + " xorl %ecx, %ecx\n" + " movl %esp, %ebp\n" + " pushl %edi\n" + " int $0x03\n" + " leave\n" + " ret\n"); + +/* Relevant part of the prologue from backtrace/1718. */ + +asm(".text\n" + " .align 8\n" + SYMBOL (gdb1718) ":\n" + " pushl %ebp\n" + " movl $0x11111111, %eax\n" + " movl %esp, %ebp\n" + " pushl %esi\n" + " movl $0x22222222, %esi\n" + " pushl %ebx\n" + " int $0x03\n" + " leave\n" + " ret\n"); + +/* Relevant part of the prologue from backtrace/1338. */ + +asm(".text\n" + " .align 8\n" + SYMBOL (gdb1338) ":\n" + " pushl %edi\n" + " pushl %esi\n" + " pushl %ebx\n" + " int $0x03\n" + " popl %ebx\n" + " popl %esi\n" + " popl %edi\n" + " ret\n"); + +/* The purpose of this function is to verify that, during prologue + skip, GDB does not follow a jump at the beginnning of the "real" + code. */ + +asm(".text\n" + " .align 8\n" + SYMBOL (jump_at_beginning) ":\n" + " pushl %ebp\n" + " movl %esp,%ebp\n" + " jmp .gdbjump\n" + " nop\n" + ".gdbjump:\n" + " movl %ebp,%esp\n" + " popl %ebp\n" + " ret\n"); + +asm(".text\n" + " .align 8\n" + SYMBOL (stack_align_ecx) ":\n" + " leal 4(%esp), %ecx\n" + " andl $-16, %esp\n" + " pushl -4(%ecx)\n" + " pushl %ebp\n" + " movl %esp, %ebp\n" + " pushl %edi\n" + " pushl %ecx\n" + " int $0x03\n" + " popl %ecx\n" + " popl %edi\n" + " popl %ebp\n" + " leal -4(%ecx), %esp\n" + " ret\n"); + +asm(".text\n" + " .align 8\n" + SYMBOL (stack_align_edx) ":\n" + " leal 4(%esp), %edx\n" + " andl $-16, %esp\n" + " pushl -4(%edx)\n" + " pushl %ebp\n" + " movl %esp, %ebp\n" + " pushl %edi\n" + " pushl %ecx\n" + " int $0x03\n" + " popl %ecx\n" + " popl %edi\n" + " popl %ebp\n" + " leal -4(%edx), %esp\n" + " ret\n"); + +asm(".text\n" + " .align 8\n" + SYMBOL (stack_align_eax) ":\n" + " leal 4(%esp), %eax\n" + " andl $-16, %esp\n" + " pushl -4(%eax)\n" + " pushl %ebp\n" + " movl %esp, %ebp\n" + " pushl %edi\n" + " pushl %ecx\n" + " int $0x03\n" + " popl %ecx\n" + " popl %edi\n" + " popl %ebp\n" + " leal -4(%eax), %esp\n" + " ret\n"); +
i386-prologue.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gdb1291.exp =================================================================== --- gdb1291.exp (nonexistent) +++ gdb1291.exp (revision 33) @@ -0,0 +1,92 @@ +# Copyright 2003, 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@gnu.org + +# This file is part of the gdb testsuite. + +# Tests for PR:1291. Ensure that backtrace works properly for stack +# frames greater than 256 bytes. + +if $tracelevel { + strace $tracelevel +} + +# Test SH backtraces with >256 byte frame stack. (PR:1291) + +set prms_id 0 +set bug_id 0 + +if ![istarget "sh-*-*"] then { + verbose "Skipping SH backtrace tests." + return +} + +set testfile "gdb1291" +set srcfile ${testfile}.s +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] != "" } { + untested gdb1291.exp + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# +# Run to `main' where we begin our tests. +# + +if ![runto_main] then { + gdb_suppress_tests +} + +gdb_test "b sub1" "Breakpoint 2.*" "set breakpoint" +gdb_test "c" "Breakpoint 2.* sub1 .*" "get to sub1" + +send_gdb "bt\n" +gdb_expect { + -re "#0.* sub1 .*\r\n#1\[ \t\]*$hex in main \\(\\).*\r\n$gdb_prompt $" { + pass "backtrace with local variable less than or equal to 256 bytes" + } + -re ".*$gdb_prompt $" { + fail "backtrace with local variable less than or equal to 256 bytes" + } + timeout { + fail "backtrace with local variable less than or equal to 256 bytes (timeout)" + } +} + +gdb_test "b sub2" "Breakpoint 3.*" "set breakpoint" +gdb_test "c" "Breakpoint 3.* sub2 .*" "get to sub2" + +send_gdb "bt\n" +gdb_expect { + -re "#0.* sub2 .*\r\n#1\[ \t\]*$hex in main \\(\\).*\r\n$gdb_prompt $" { + pass "backtrace with local variable larger than 256 bytes" + } + -re "#0.* sub2 .*\r\n#1 0x00000000 in \\?\\? \\(\\).*\r\n$gdb_prompt $" { + kfail "gdb/1291" "backtrace with local variable larger than 256 bytes" + } + -re ".*$gdb_prompt $" { + fail "backtrace with local variable larger than 256 bytes" + } + timeout { + fail "backtrace with local variable larger than 256 bytes (timeout)" + } +} Index: iwmmxt-regs.c =================================================================== --- iwmmxt-regs.c (nonexistent) +++ iwmmxt-regs.c (revision 33) @@ -0,0 +1,86 @@ +/* Register test program. + + Copyright 2007, 2008 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +void +read_regs (unsigned long long regs[16], unsigned long control_regs[6]) +{ + asm volatile ("wstrd wR0, %0" : "=m" (regs[0])); + asm volatile ("wstrd wR1, %0" : "=m" (regs[1])); + asm volatile ("wstrd wR2, %0" : "=m" (regs[2])); + asm volatile ("wstrd wR3, %0" : "=m" (regs[3])); + asm volatile ("wstrd wR4, %0" : "=m" (regs[4])); + asm volatile ("wstrd wR5, %0" : "=m" (regs[5])); + asm volatile ("wstrd wR6, %0" : "=m" (regs[6])); + asm volatile ("wstrd wR7, %0" : "=m" (regs[7])); + asm volatile ("wstrd wR8, %0" : "=m" (regs[8])); + asm volatile ("wstrd wR9, %0" : "=m" (regs[9])); + asm volatile ("wstrd wR10, %0" : "=m" (regs[10])); + asm volatile ("wstrd wR11, %0" : "=m" (regs[11])); + asm volatile ("wstrd wR12, %0" : "=m" (regs[12])); + asm volatile ("wstrd wR13, %0" : "=m" (regs[13])); + asm volatile ("wstrd wR14, %0" : "=m" (regs[14])); + asm volatile ("wstrd wR15, %0" : "=m" (regs[15])); + + asm volatile ("wstrw wCSSF, %0" : "=m" (control_regs[0])); + asm volatile ("wstrw wCASF, %0" : "=m" (control_regs[1])); + asm volatile ("wstrw wCGR0, %0" : "=m" (control_regs[2])); + asm volatile ("wstrw wCGR1, %0" : "=m" (control_regs[3])); + asm volatile ("wstrw wCGR2, %0" : "=m" (control_regs[4])); + asm volatile ("wstrw wCGR3, %0" : "=m" (control_regs[5])); +} + +void +write_regs (unsigned long long regs[16], unsigned long control_regs[6]) +{ + asm volatile ("wldrd wR0, %0" : : "m" (regs[0])); + asm volatile ("wldrd wR1, %0" : : "m" (regs[1])); + asm volatile ("wldrd wR2, %0" : : "m" (regs[2])); + asm volatile ("wldrd wR3, %0" : : "m" (regs[3])); + asm volatile ("wldrd wR4, %0" : : "m" (regs[4])); + asm volatile ("wldrd wR5, %0" : : "m" (regs[5])); + asm volatile ("wldrd wR6, %0" : : "m" (regs[6])); + asm volatile ("wldrd wR7, %0" : : "m" (regs[7])); + asm volatile ("wldrd wR8, %0" : : "m" (regs[8])); + asm volatile ("wldrd wR9, %0" : : "m" (regs[9])); + asm volatile ("wldrd wR10, %0" : : "m" (regs[10])); + asm volatile ("wldrd wR11, %0" : : "m" (regs[11])); + asm volatile ("wldrd wR12, %0" : : "m" (regs[12])); + asm volatile ("wldrd wR13, %0" : : "m" (regs[13])); + asm volatile ("wldrd wR14, %0" : : "m" (regs[14])); + asm volatile ("wldrd wR15, %0" : : "m" (regs[15])); + + asm volatile ("wldrw wCSSF, %0" : : "m" (control_regs[0])); + asm volatile ("wldrw wCASF, %0" : : "m" (control_regs[1])); + asm volatile ("wldrw wCGR0, %0" : : "m" (control_regs[2])); + asm volatile ("wldrw wCGR1, %0" : : "m" (control_regs[3])); + asm volatile ("wldrw wCGR2, %0" : : "m" (control_regs[4])); + asm volatile ("wldrw wCGR3, %0" : : "m" (control_regs[5])); +} + +int +main () +{ + unsigned long long regs[16]; + unsigned long control_regs[6]; + + read_regs (regs, control_regs); + write_regs (regs, control_regs); + + return 0; +}
iwmmxt-regs.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: powerpc-prologue.exp =================================================================== --- powerpc-prologue.exp (nonexistent) +++ powerpc-prologue.exp (revision 33) @@ -0,0 +1,88 @@ +# Copyright 2006, 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test PowerPC prologue analyzer. + +# Do not run on AIX (where we won't be able to build the tests without +# some surgery) or on PowerPC64 (ditto, dot symbols). +if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} then { + verbose "Skipping PowerPC prologue tests." + return +} + +set testfile "powerpc-prologue" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +# Don't use "debug", so that we don't have line information for the assembly +# fragments. +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } { + untested "PowerPC prologue tests" + return -1 +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# +# Run to `main' where we begin our tests. +# + +if ![runto_main] then { + gdb_suppress_tests +} + +# Testcase for PIC prologue. + +gdb_breakpoint "gdb2029_marker" +gdb_test "continue" "Breakpoint $decimal, $hex in gdb2029_marker \\(\\)" \ + "continue to PIC" + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in gdb2029_marker.*\r\n#1\[ \t\]*$hex in gdb2029.*\r\n#2\[ \t\]*$hex in main.*" \ + "backtrace in PIC marker" + +gdb_test "finish" ".*$hex in gdb2029 .*" "finish from PIC" + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in gdb2029 .*\r\n#1\[ \t\]*$hex in main.*" \ + "backtrace in PIC" + +gdb_test "info frame" \ + ".*Saved registers:.*r30 at.*r31 at.*pc at.*lr at.*" \ + "saved registers in PIC" + +# Testcase for scheduled prologue. + +gdb_breakpoint "optimized_1_marker" +gdb_test "continue" "Breakpoint $decimal, $hex in optimized_1_marker \\(\\)" \ + "continue to optimized" + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in optimized_1_marker.*\r\n#1\[ \t\]*$hex in optimized_1.*\r\n#2\[ \t\]*$hex in main.*" \ + "backtrace in optimized marker" + +gdb_test "finish" ".*$hex in optimized_1 .*" "finish from optimized" + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in optimized_1 .*\r\n#1\[ \t\]*$hex in main.*" \ + "backtrace in optimized" + +gdb_test "info frame" \ + ".*Saved registers:.*r30 at.*r31 at.*pc at.*lr at.*" \ + "saved registers in optimized" Index: thumb-prologue.exp =================================================================== --- thumb-prologue.exp (nonexistent) +++ thumb-prologue.exp (revision 33) @@ -0,0 +1,61 @@ +# Copyright 2006, 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test ARM/Thumb prologue analyzer. + +if {![istarget arm*-*]} then { + verbose "Skipping ARM prologue tests." + return +} + +set testfile "thumb-prologue" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +# Don't use "debug", so that we don't have line information for the assembly +# fragments. +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {"additional_flags=-mthumb"}] != "" } { + untested "ARM prologue tests" + return -1 +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# +# Run to `main' where we begin our tests. +# + +if ![runto_main] then { + untested "ARM prologue tests" + return -1 +} + +# Testcase for TPCS prologue. + +gdb_breakpoint "* *(int *)tpcs_offset + (int) &tpcs_frame_1" +gdb_test "continue" "Breakpoint .*, $hex in tpcs_frame_1 \\(\\)" \ + "continue to TPCS" + +gdb_test "backtrace 10" \ + "#0\[ \t\]*$hex in tpcs_frame_1 .*\r\n#1\[ \t\]*$hex in tpcs_frame .*\r\n#2\[ \t\]*$hex in main.*" \ + "backtrace in TPCS" + +gdb_test "info frame" \ + ".*Saved registers:.*r7 at.*r10 at.*r11 at.*lr at.*pc at .*" \ + "saved registers in TPCS" Index: altivec-regs.c =================================================================== --- altivec-regs.c (nonexistent) +++ altivec-regs.c (revision 33) @@ -0,0 +1,41 @@ +#include +#include + +vector unsigned int +vector_fun (vector unsigned int a, vector unsigned int b) +{ + vector unsigned int c; + a = ((vector unsigned int) vec_splat_u8(2)); + b = ((vector unsigned int) vec_splat_u8(3)); + + c = vec_add (a, b); + return c; +} + +int +main () +{ + vector unsigned int y; + vector unsigned int x; + vector unsigned int z; + int a; + + /* This line may look unnecessary but we do need it, because we want to + have a line to do a next over (so that gdb refetches the registers) + and we don't want the code to change any vector registers. + The splat operations below modify the VRs,i + so we don't want to execute them yet. */ + a = 9; + x = ((vector unsigned int) vec_splat_u8 (-2)); + y = ((vector unsigned int) vec_splat_u8 (1)); + + z = vector_fun (x, y); + x = vec_sld (x,y,2); + + x = vec_add (x, ((vector unsigned int){5,6,7,8})); + z = (vector unsigned int) vec_splat_u8 ( -2); + y = vec_add (x, z); + z = (vector unsigned int) vec_cmpeq (x,y); + + return 0; +}
altivec-regs.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: i386-gnu-cfi.exp =================================================================== --- i386-gnu-cfi.exp (nonexistent) +++ i386-gnu-cfi.exp (revision 33) @@ -0,0 +1,93 @@ +# Copyright 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@gnu.org + +# This file is part of the gdb testsuite. + +# Unwinding of DW_CFA_GNU_negative_offset_extended test program. + +if $tracelevel { + strace $tracelevel +} + +# Test i386 unwinder. + +set prms_id 0 +set bug_id 0 + +if ![istarget "i?86-*-*"] then { + verbose "Skipping i386 unwinder tests." + return +} + +set testfile "i386-gnu-cfi" +set srcfilec ${testfile}.c +set srcfileasm ${testfile}-asm.S +set binfile ${objdir}/${subdir}/${testfile} + +# some targets have leading underscores on assembly symbols. +# TODO: detect this automatically +set additional_flags "" +if [istarget "i?86-*-cygwin*"] then { + set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\"" +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfilec} ${srcdir}/${subdir}/${srcfileasm}" "${binfile}" executable [list debug $additional_flags]] != "" } { + untested i386-gnu-cfi.exp + return -1 +} + +# Get things started. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# We should stop in abort(3). + +gdb_run_cmd + +gdb_test_multiple {} "continue to abort()" { + -re ".*Program received signal SIGABRT,.*$gdb_prompt $" { + pass "continue to abort()" + } +} + +# Backtrace would crash before. + +gdb_test "bt" \ + "main \\(\\) at .*${testfile}.c.*" \ + "backtrace" + +# Check we see the inserted `DW_CFA_GNU_negative_offset_extended' CFI. +# We see there the original CFI-stored filename `gate.c'. + +gdb_test "up 3" \ + "gate \\(\[^()\]*\\) at .*gate.c.*" \ + "shift up to the modified frame" + +gdb_test_multiple "info frame" "Existence of the CFI inserted register" { + -re "Stack level 3, frame at (0x\[0-9a-f\]+):.*Saved registers:.* ecx at (0x\[0-9a-f\]+),.*" { + pass "Existence of the CFI inserted register" + if { [string compare $expect_out(1,string) $expect_out(2,string)] } then { + fail "Value of the CFI inserted register" + } else { + pass "Value of the CFI inserted register" + } + } +} Index: gdb1558.exp =================================================================== --- gdb1558.exp (nonexistent) +++ gdb1558.exp (revision 33) @@ -0,0 +1,72 @@ +# Copyright 2004, 2007, 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@gnu.org + +# This file is part of the gdb testsuite. + +# Tests for PR:1558. Hits breakpoint at main after function called +# from main. + +if $tracelevel { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +if ![istarget "sh-*-*"] then { + verbose "Skipping SH breakpoint test." + return +} + +set testfile "gdb1558" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +# Note we have to compile WITH optimization and WITHOUT debugging information to expose the bug. +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {"additional_flags=-O2"}] != "" } { + untested gdb1558.exp + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test "b main" "Breakpoint 1.*" "set breakpoint at main" +gdb_test "b sub1" "Breakpoint 2.*" "set breakpoint at sub1" +gdb_test "b sub2" "Breakpoint 3.*" "set breakpoint at sub2" + +# We can't use "runto_main" because that is exactly the problem +# we are trying to detect, stopping somewhere before main. + +gdb_run_cmd + +gdb_expect 30 { + -re "Breakpoint 1.*main .*$gdb_prompt $" { + pass "Hits breakpoint at main after function called from main" + } + -re "Breakpoint 2.*sub1 .*$gdb_prompt $" { + kfail "gdb/1558" "Hits breakpoint at main after function called from main" + } + -re "$gdb_prompt $" { + fail "Hits breakpoint at main after function called from main" + } + timeout { + fail "Hits breakpoint at main after function called from main (timeout)" + } +} Index: powerpc-d128-regs.c =================================================================== --- powerpc-d128-regs.c (nonexistent) +++ powerpc-d128-regs.c (revision 33) @@ -0,0 +1,25 @@ +/* This file is part of GDB, the GNU debugger. + + Copyright 2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Tests ppc decimal128 pseudo-registers. */ + +int main(void) +{ + _Decimal128 d128 = 1.2345678910dl; + + return 0; +}
powerpc-d128-regs.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pa-nullify.exp =================================================================== --- pa-nullify.exp (nonexistent) +++ pa-nullify.exp (revision 33) @@ -0,0 +1,163 @@ +# Copyright 2004, 2007, 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +# Test handling of nullified instructions for the pa target. + +switch -glob -- [istarget] { + "hppa-*-*" { + set testfile "pa-nullify" + } + "hppa64-*-*" { + set testfile "pa64-nullify" + } + "*" { + verbose "Skipping hppa nullification tests." + return + } +} + +set srcfile ${testfile}.s +set binfile ${objdir}/${subdir}/${testfile} +set gcorefile ${objdir}/${subdir}/${testfile}.gcore + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } { + unsupported "Testcase compile failed." + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# In the first test, we do a "step" on a function whose last instruction +# contains a branch-with-nullify. The instruction in the delay slot belongs +# to the next function. We verify that when we step off the first function +# that we end up back at the caller and not at the second instruction. + +gdb_breakpoint foo +gdb_test "run" "Breakpoint 1, .* in foo.*" "Breakpoint at foo" + +set test "stepi till main" +gdb_test_multiple "stepi" "${test}" { + -re ".*in foo.*$gdb_prompt $" { + send_gdb "stepi\n" + exp_continue -continue_timer + } + -re ".*in bar.*$gdb_prompt $" { + fail $test + } + -re ".*in main.*$gdb_prompt $" { + pass $test + } +} + +# In the second test, we verify that we can get a proper backtrace +# even when we are in a nullified instruction that belongs to the next function. +# We also verify that when stepping over a branch-with-nullify insn that we +# stay on the same insn for two steps. + +proc get_addr_of_sym { sym } { + set addr 0 + global gdb_prompt + global hex + + set test "get address of $sym" + gdb_test_multiple "print $sym" $test { + -re ".*($hex) <$sym>.*$gdb_prompt $" { + set addr $expect_out(1,string) + pass $test + } + } + + return $addr +} + +if { ! [ runto_main ] } then { gdb_suppress_tests; } + +set foo [get_addr_of_sym "foo"] +set bar [get_addr_of_sym "bar"] +set foo_last "(bar - 4)" + +gdb_breakpoint "*$foo_last" + +gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" +gdb_test "backtrace" "in foo.*in main.*" "Backtrace from last insn in foo" +gdb_test "stepi" "in foo.*" "stepi to nullified instruction stays in foo" +gdb_test "backtrace" "in foo.*in main.*" "Backtrace from nullified insn" +gdb_test "stepi" "in main.*" "stepi to main" + +# In the third test, we verify that backtraces from nullified instructions +# work even in coredumps + +proc gen_core { test } { + global gcorefile + global gdb_prompt + set gcore_works 0 + set escapedfilename [string_to_regexp $gcorefile] + + # gcore is not yet implemented for HPUX + setup_xfail hppa*-*-hpux* + + gdb_test_multiple "gcore $gcorefile" "$test: gcore" { + -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" { + pass "$test: gcore" + set gcore_works 1 + } + -re "Undefined command.*$gdb_prompt $" { + fail "$test: gcore (undefined command)" + } + -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" { + fail "$test: gcore (can't create corefile)" + } + } + + return $gcore_works +} + +proc test_core_bt { test } { + global gcorefile + + gdb_test "core $gcorefile" "Core was generated by.*" \ + "$test: load core file" "A program is being debugged already.*" "y" + + gdb_test "backtrace" ".*in foo.*in main.*" "$test: backtrace in gcore" +} + +set test "core at last insn in foo" +if { ! [ runto_main ] } then { gdb_suppress_tests; } +gdb_breakpoint "*$foo_last" +gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint" +if [gen_core $test] { + test_core_bt $test +} + +set test "core at nullified insn" +if { ! [ runto_main ] } then { gdb_suppress_tests; } +gdb_breakpoint "*$foo_last" +gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint" +gdb_test "stepi" ".*in foo.*" "$test: step to nullified instruction" +if [gen_core $test] { + test_core_bt $test +} Index: i386-unwind.c =================================================================== --- i386-unwind.c (nonexistent) +++ i386-unwind.c (revision 33) @@ -0,0 +1,46 @@ +/* Unwinder test program. + + Copyright 2003, 2004, 2007, 2008 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifdef SYMBOL_PREFIX +#define SYMBOL(str) SYMBOL_PREFIX #str +#else +#define SYMBOL(str) #str +#endif + +void +trap (void) +{ + asm ("int $0x03"); +} + +/* Make sure that main directly follows a function without an + epilogue. */ + +asm(".text\n" + " .align 8\n" + " .globl gdb1435\n" + "gdb1435:\n" + " pushl %ebp\n" + " mov %esp, %ebp\n" + " call " SYMBOL (trap) "\n" + " .globl " SYMBOL (main) "\n" + SYMBOL (main) ":\n" + " pushl %ebp\n" + " mov %esp, %ebp\n" + " call gdb1435\n");
i386-unwind.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.