OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-old/gdb-7.1/gdb/testsuite/gdb.arch
    from Rev 227 to Rev 816
    Reverse comparison

Rev 227 → Rev 816

/alpha-step.c
0,0 → 1,116
/* Copyright 2005, 2007, 2008, 2009, 2010 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: Makefile.in =================================================================== --- Makefile.in (nonexistent) +++ Makefile.in (revision 816) @@ -0,0 +1,17 @@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +EXECUTABLES = altivec-abi altivec-regs + +all info install-info dvi install uninstall installcheck check: + @echo "Nothing to be done for $@..." + +clean mostlyclean: + -rm -f *~ *.o a.out *.x *.ci *.tmp + -rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES) + +distclean maintainer-clean realclean: clean + -rm -f *~ core + -rm -f Makefile config.status config.log + -rm -f *-init.exp + -rm -fr *.log summary detail *.plog *.sum *.psum site.* Index: i386-signal.c =================================================================== --- i386-signal.c (nonexistent) +++ i386-signal.c (revision 816) @@ -0,0 +1,58 @@ +/* Unwinder test program for signal frames. + + Copyright 2007, 2008, 2009, 2010 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. */ + +/* Note: to make sure that the Dwarf unwinder gets to handle + the frame, we add an extra 'nop' after the label. Otherwise, + the epilogue unwinder will see the 'ret' and grab the frame. */ + +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" + " nop\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 816) @@ -0,0 +1,82 @@ +/* Unwinder test program. + + Copyright 2006, 2007, 2008, 2009, 2010 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: spu-info.exp =================================================================== --- spu-info.exp (nonexistent) +++ spu-info.exp (revision 816) @@ -0,0 +1,249 @@ +# Copyright 2007, 2008, 2009, 2010 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.*" \ + "info spu dma" + +# 'info spu proxydma'. +gdb_test "info spu proxydma" \ + "Tag-Group Status.*Tag-Group Mask.*" \ + "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\[\r\n\]+" \ + "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.*get.*5.*0.*0.*0x00080\[ \r\n\]+" \ + "info spu dma (non-empty)" +gdb_test "finish" "" "finish" + +# Mailbox Test +# 'info spu mailbox' should be empty. +c_to "Marker Mbox" +set msg "info spu mailbox" +gdb_test_multiple "info spu mailbox" $msg { + -re "SPU Outbound Mailbox.*0x00000000.*SPU Outbound Interrupt Mailbox.*0x00000000.*$gdb_prompt $" { + pass $msg + } + -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" { + # Older kernels had a bug that caused them to return arbitrary values + # when attempting to read from an empty mailbox via spufs. + xfail $msg + } +} + +# '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: pa64-nullify.s =================================================================== --- pa64-nullify.s (nonexistent) +++ pa64-nullify.s (revision 816) @@ -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: i386-gnu-cfi.c =================================================================== --- i386-gnu-cfi.c (nonexistent) +++ i386-gnu-cfi.c (revision 816) @@ -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: e500-regs.exp =================================================================== --- e500-regs.exp (nonexistent) +++ e500-regs.exp (revision 816) @@ -0,0 +1,222 @@ +# Copyright 2003, 2004, 2007, 2008, 2009, 2010 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 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. + +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 = .0, 0, 0, 1, 0, 0, 0, 1.." +} 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 = .1, 0, 0, 0, 1, 0, 0, 0.." +} + +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: vsx-regs.exp =================================================================== --- vsx-regs.exp (nonexistent) +++ vsx-regs.exp (revision 816) @@ -0,0 +1,189 @@ +# Copyright (C) 2008, 2009, 2010 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 register setting and fetching + +if $tracelevel then { + strace $tracelevel +} + +# +# Test the use of VSX registers, for Powerpc. +# + +set prms_id 0 +set bug_id 0 + +if {![istarget "powerpc*"] || [skip_vsx_tests]} then { + verbose "Skipping vsx register tests." + return +} + +set testfile "vsx-regs" +set binfile ${objdir}/${subdir}/${testfile} +set srcfile ${testfile}.c + +set compile_flags {debug nowarnings quiet} +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 vsx-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 +} + +# Data sets used throughout the test + +set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x0, 0x0., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x0, 0x0, 0x0., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0.." + +set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.." + +set vector_register3 ".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.." + +set float_register ".raw 0xdeadbeefdeadbeef." + +# First run the F0~F31/VS0~VS31 tests + +# 1: Set F0~F31 registers and check if it reflects on VS0~VS31. +for {set i 0} {$i < 32} {incr i 1} { + send_gdb "set \$f$i = 1\.3" +} + +for {set i 0} {$i < 32} {incr i 1} { + gdb_test "info reg vs$i" "vs$i.*$vector_register1" "info reg vs$i (doubleword 0)" +} + +# 2: Set VS0~VS31 registers and check if it reflects on F0~F31. +for {set i 0} {$i < 32} {incr i 1} { + for {set j 0} {$j < 4} {incr j 1} { + send_gdb "set \$vs$i.v4_int32\[$j\] = 0xdeadbeef" + } +} + +for {set i 0} {$i < 32} {incr i 1} { + gdb_test "info reg f$i" "f$i.*$float_register" "info reg f$i" +} + +for {set i 0} {$i < 32} {incr i 1} { + gdb_test "info reg vs$i" "vs$i.*$vector_register2" "info reg vs$i (doubleword 1)" +} + +# Now run the VR0~VR31/VS32~VS63 tests + +# 1: Set VR0~VR31 registers and check if it reflects on VS32~VS63. +for {set i 0} {$i < 32} {incr i 1} { + for {set j 0} {$j < 4} {incr j 1} { + send_gdb "set \$vr$i.v4_int32\[$j\] = 1" + } +} + +for {set i 32} {$i < 64} {incr i 1} { + gdb_test "info reg vs$i" "vs$i.*$vector_register3" "info reg vs$i" +} +# 2: Set VS32~VS63 registers and check if it reflects on VR0~VR31. +for {set i 32} {$i < 64} {incr i 1} { + for {set j 0} {$j < 4} {incr j 1} { + send_gdb "set \$vs$i.v4_int32\[$j\] = 1" + } +} + +for {set i 0} {$i < 32} {incr i 1} { + gdb_test "info reg vr$i" "vr$i.*$vector_register3" "info reg vr$i" +} + +set escapedfilename [string_to_regexp ${objdir}/${subdir}/vsx-core.test] + +set core_supported 0 + +gdb_test_multiple "gcore ${objdir}/${subdir}/vsx-core.test" \ + "Save a VSX-enabled corefile" \ +{ + -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" { + pass "Save a VSX-enabled corefile" + global core_supported + set core_supported 1 + } + -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" { + unsupported "Save a VSX-enabled corefile" + global core_supported + set core_supported 0 + } +} + +if {!$core_supported} { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test_multiple "core ${objdir}/${subdir}/vsx-core.test" \ + "re-load generated corefile" \ +{ + -re ".* is not a core dump:.*$gdb_prompt $" { + fail "re-load generated corefile (bad file format)" + # No use proceeding from here. + return; + } + -re ".*: No such file or directory.*$gdb_prompt $" { + fail "re-load generated corefile (file not found)" + # No use proceeding from here. + return; + } + -re ".*Couldn't find .* registers in core file.*$gdb_prompt $" { + fail "re-load generated corefile (incomplete note section)" + } + -re "Core was generated by .*$gdb_prompt $" { + pass "re-load generated corefile" + } + -re ".*$gdb_prompt $" { + fail "re-load generated corefile" + } + timeout { + fail "re-load generated corefile (timeout)" + } +} + +for {set i 0} {$i < 32} {incr i 1} { + gdb_test "info reg vs$i" "vs$i.*$vector_register2" "Restore vs$i from core file" +} + +for {set i 32} {$i < 64} {incr i 1} { + gdb_test "info reg vs$i" "vs$i.*$vector_register3" "Restore vs$i from core file" +} Index: gdb1291.s =================================================================== --- gdb1291.s (nonexistent) +++ gdb1291.s (revision 816) @@ -0,0 +1,128 @@ +! Copyright 2004, 2010 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: ppc-dfp.c =================================================================== --- ppc-dfp.c (nonexistent) +++ ppc-dfp.c (revision 816) @@ -0,0 +1,46 @@ +/* Copyright 2008, 2009, 2010 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 + +#ifdef __powerpc64__ +typedef Elf64_auxv_t auxv_t; +#else +typedef Elf32_auxv_t auxv_t; +#endif + +#ifndef PPC_FEATURE_HAS_DFP +#define PPC_FEATURE_HAS_DFP 0x00000400 +#endif + +int +main (int argc, char *argv[], char *envp[], auxv_t auxv[]) +{ + int i; + + for (i = 0; auxv[i].a_type != AT_NULL; i++) + if (auxv[i].a_type == AT_HWCAP) { + if (!(auxv[i].a_un.a_val & PPC_FEATURE_HAS_DFP)) + return 1; + + break; + } + + asm ("mtfsfi 7, 5, 1\n"); /* Set DFP rounding mode. */ + + return 0; +}
ppc-dfp.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: thumb2-it.S =================================================================== --- thumb2-it.S (nonexistent) +++ thumb2-it.S (revision 816) @@ -0,0 +1,182 @@ +/* Thumb-2 IT blocks test program. + + Copyright 2010 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 . */ + + .syntax unified + .text + .p2align 2 + .code 16 + +#ifndef __thumb2__ + + .type main,%function + .thumb_func + .globl main +main: + mov r0, #0 + bx lr @ No Thumb-2 + +#else + + .type main,%function + .thumb_func + .globl main +main: + mov r0, #0 + bx lr @ Thumb-2 OK + + @ One conditional instruction, executed. + .type it_1,%function + .thumb_func +it_1: + mov r0, #0 @ Setup + cmp r0, #0 @ Setup + it eq @ IT instruction, Expected == 1 + addeq r0, #1 @ Reached + bx lr @ Done + + @ One conditional instruction, skipped. + .type it_2,%function + .thumb_func +it_2: + mov r0, #0 @ Setup + cmp r0, #0 @ Setup + it ne @ IT instruction, Expected == 0 + addne r0, #1 @ Not reached + bx lr @ Done, Check $r0 == 0 + + @ Block of four, alternating, starting with executed. + .type it_3,%function + .thumb_func +it_3: + mov r0, #0 @ Setup + cmp r0, #0 @ Setup + itete ge @ IT instruction, Expected == 2 + addge r0, #1 @ Reached + addlt r0, #2 @ Not reached + addge r0, #4 @ Reached + addlt r0, #8 @ Not reached + bx lr @ Done, Check $r0 == 5 + + @ Block of four, changing flags. + .type it_4,%function + .thumb_func +it_4: + mov r0, #0 @ Setup + cmp r0, #0 @ Setup + itttt ge @ IT instruction, Expected == 2 + addge r0, #1 @ Reached + cmpge r0, #10 @ Reached + addge r0, #4 @ Not reached + addge r0, #8 @ Not reached + bx lr @ Done, Check $r0 == 1 + + @ Block of two, ending with taken branch. + .type it_5,%function + .thumb_func +it_5: + mov r0, #0 @ Setup + cmp r0, #0 @ Setup + itt ge @ IT instruction, Expected == 2 + addge r0, #1 @ Reached + bge .L5 @ Reached + add r0, #2 @ Never reached +.L5: bx lr @ Done, Check $r0 == 1 + + @ Block of two, ending with untaken branch. + .type it_6,%function + .thumb_func +it_6: + mov r0, #0 @ Setup + cmp r0, #0 @ Setup + ite ge @ IT instruction, Expected == 2 + addge r0, #1 @ Reached + blt .L6 @ Not reached + add r0, #2 @ Reached +.L6: bx lr @ Done, Check $r0 == 3 + + @ Block of four, taken, of different sizes + .type it_7,%function + .thumb_func +it_7: + mov r0, #0 @ Setup + cmp r0, #0 @ Setup + itttt ge @ IT instruction, Expected == 4 + addge.n r0, #1 @ Reached + addge.w r0, #2 @ Reached + addge.n r0, #4 @ Reached + addge.w r0, #8 @ Reached + bx lr @ Done, Check $r0 == 15 + + @ Block of four, only first executed. + .type it_3,%function + .thumb_func +it_8: + mov r0, #0 @ Setup + cmp r0, #0 @ Setup + iteee ge @ IT instruction, Expected == 1 + addge r0, #1 @ Reached + addlt r0, #2 @ Not reached + addlt r0, #4 @ Not reached + addlt r0, #8 @ Not reached + bx lr @ Done, Check $r0 == 1 + + .type it_breakpoints,%function + .thumb_func +it_breakpoints: + mov r0, #0 + cmp r0, #0 + it eq @ Location 1 @ Break 1 + moveq r0, #0 + + it eq @ Location 2 + moveq r0, #0 @ Break 2 + + it ne @ Location 3 + movne r0, #0 @ Break 3 + + @ An IT block of maximum size. + itttt eq @ Location 4 + moveq.w r0, #0 + moveq.w r0, #0 + moveq.w r0, #0 + moveq.w r0, #0 @ Break 4 + + @ Just outside an IT block. + it eq + moveq r0, #0 + mov r0, #0 @ Location 5 @ Break 5 + + @ After something that looks like an IT block, but + @ is the second half of an instruction. + .p2align 6 + cmp r0, r0 + b 1f + b.w .+0xe14 @ 0xf000 0xbf08 -> second half is IT EQ +1: mov r0, #0 @ Location 6 @ Break 6 + + @ After something that looks like an IT block, but + @ is data. + .p2align 6 + b 1f + .short 0xbf08 +1: mov r0, #0 @ Location 7 @ Break 7 + + bx lr + +#endif /* __thumb2__ */
thumb2-it.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-sse.exp =================================================================== --- i386-sse.exp (nonexistent) +++ i386-sse.exp (revision 816) @@ -0,0 +1,110 @@ +# Copyright 2004, 2005, 2007, 2008, 2009, 2010 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-*-*] && ![istarget x86_64-*-* ] } { + verbose "Skipping x86 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 first breakpoint in main" +gdb_continue_to_breakpoint "continue to first breakpoint in main" + +if [istarget i?86-*-*] { + set nr_regs 8 +} else { + set nr_regs 16 +} + +for { set r 0 } { $r < $nr_regs } { incr r } { + 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" +} + +for { set r 0 } { $r < $nr_regs } { incr r } { + 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 second breakpoint in main" +gdb_continue_to_breakpoint "continue to second breakpoint in main" + +for { set r 0 } { $r < $nr_regs } { incr r } { + gdb_test "print data\[$r\]" \ + ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \ + "check contents of data\[$r\]" +} Index: ppc64-atomic-inst.exp =================================================================== --- ppc64-atomic-inst.exp (nonexistent) +++ ppc64-atomic-inst.exp (revision 816) @@ -0,0 +1,66 @@ +# Copyright 2008, 2009, 2010 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 quiet" + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat $compile_flags 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: ia64-breakpoint-shadow.exp =================================================================== --- ia64-breakpoint-shadow.exp (nonexistent) +++ ia64-breakpoint-shadow.exp (revision 816) @@ -0,0 +1,80 @@ +# Copyright 2009, 2010 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 ![istarget "ia64-*-*"] { + verbose "Skipping ia64-breakpoint-shadow test." + return +} + +set testfile ia64-breakpoint-shadow +set srcfile ${testfile}.S +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + untested "Couldn't compile test program" + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# We need to start the inferior to place the breakpoints in the memory at all. +if ![runto_main] { + untested start + return -1 +} + +# The default "auto" mode removes all the breakpoints when we stop (and not +# running the nonstop mode). We would not be able to test the shadow. +gdb_test "set breakpoint always-inserted on" +gdb_test "show breakpoint always-inserted" "Always inserted breakpoint mode is on." + +set match "\nDump of assembler code for function main:\r\n(.*)End of assembler dump.\r\n$gdb_prompt $" + +set test "disassembly without breakpoints" +gdb_test_multiple "disass main" $test { + -re $match { + set orig $expect_out(1,string) + pass $test + } +} + +set test "slot 0 breakpoint placed" +gdb_test_multiple "b bundle" $test { + -re "Breakpoint \[0-9\] at (0x\[0-9a-f\]*0):.*$gdb_prompt $" { + pass $test + set bpt2address $expect_out(1,string) + } +} + +if ![info exists bpt2address] { + return -1 +} + +gdb_test "b *($bpt2address + 1)" "Breakpoint \[0-9\] at .*" "slot 1 breakpoint placed" +gdb_test "b *($bpt2address + 2)" "Can't insert breakpoint for non-existing slot X" "slot 2 (slot X) breakpoint refusal" + +set test "disassembly with breakpoints" +gdb_test_multiple "disass main" $test { + -re $match { + set got $expect_out(1,string) + if [string equal -nocase $orig $got] { + pass $test + } else { + fail $test + } + } +} Index: amd64-i386-address.exp =================================================================== --- amd64-i386-address.exp (nonexistent) +++ amd64-i386-address.exp (revision 816) @@ -0,0 +1,43 @@ +# Copyright 2009, 2010 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. + +# Test UNsigned extension of the 32-bit inferior address on a 64-bit host. +# On native 32-bit host the test always PASSed. + +if {![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]} then { + verbose "Skipping amd64->i386 adress test." + return +} + +if [prepare_for_testing amd64-i386-address.exp amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]] { + return -1 +} + +gdb_run_cmd + +set test "trap stop" +gdb_test_multiple "" $test { + -re "Program received signal SIGTRAP,.*_start .*$gdb_prompt $" { + pass $test + } +} + +gdb_test "x/wx \$esp" "0x\[0-9a-f\]*:\t0xdeadf00d" + +# Failure case would be: +# 0xff8d7f00: Cannot access memory at address 0xff8d7f00 +gdb_test "x/wx \$ebx" "0x\[0-9a-f\]*:\t0xdeadf00d" Index: spu-info.c =================================================================== --- spu-info.c (nonexistent) +++ spu-info.c (revision 816) @@ -0,0 +1,234 @@ +/* Copyright 2007, 2008, 2009, 2010 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 816) @@ -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: ia64-breakpoint-shadow.S =================================================================== --- ia64-breakpoint-shadow.S (nonexistent) +++ ia64-breakpoint-shadow.S (revision 816) @@ -0,0 +1,44 @@ +/* Copyright 2009, 2010 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. + It tests displaced stepping over various insns that require special + handling. */ + + .text + .align 16 + .global main + .proc main +main: + mov r2=r12 + mov r14=1 + ;; +bundle: + /* Store value 1 into `long' variable on stack. */ + st8.rel [r2]=r14 + /* This long constant requires L-X slot in this bundle. */ + movl r14=0x7fffffff + ;; + /* Store value 0x7fffffff into `long' variable on stack. */ + st8.rel [r2]=r14 + mov r14=r0 + ;; + mov r8=r14 + mov r12=r2 + br.ret.sptk.many b0 + + .endp main + + .section .note.GNU-stack,"",@progbits
ia64-breakpoint-shadow.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-d128-regs.exp =================================================================== --- powerpc-d128-regs.exp (nonexistent) +++ powerpc-d128-regs.exp (revision 816) @@ -0,0 +1,76 @@ +# This testcase is part of GDB, the GNU debugger. + +# Copyright 2008, 2009, 2010 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 816) @@ -0,0 +1,52 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2004, 2007, 2008, 2009, 2010 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 816) @@ -0,0 +1,76 @@ +# Copyright 2003, 2004, 2007, 2008, 2009, 2010 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 "*-*-cygwin*"] || [istarget "*-*-mingw*"] } 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: i386-size-overlap.c =================================================================== --- i386-size-overlap.c (nonexistent) +++ i386-size-overlap.c (revision 816) @@ -0,0 +1,51 @@ +/* Overlapping symbol sizes test program. + + Copyright 2007, 2008, 2009, 2010 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: vsx-regs.c =================================================================== --- vsx-regs.c (nonexistent) +++ vsx-regs.c (revision 816) @@ -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; +}
vsx-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-disp-step.S =================================================================== --- i386-disp-step.S (nonexistent) +++ i386-disp-step.S (revision 816) @@ -0,0 +1,123 @@ +/* Copyright 2009, 2010 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. + It tests displaced stepping over various insns that require special + handling. */ + + .text + + .global main +main: + nop + +/***********************************************/ + +/* Test call/ret. */ + + nop + .global test_call +test_call: + call test_call_subr + nop + .global test_ret_end +test_ret_end: + nop + +/***********************************************/ + +/* Absolute jump with leading prefixes. + These don't occur in normal code, but gdb should still DTRT. */ + + nop + .global test_prefixed_abs_jump +test_prefixed_abs_jump: + ds + jmp *test_prefixed_abs_jump_addr + .data +test_prefixed_abs_jump_addr: + .4byte test_prefixed_abs_jump_target + .text +test_prefixed_abs_jump_target: + nop + .global test_prefixed_abs_jump_end +test_prefixed_abs_jump_end: + nop + +/***********************************************/ + +/* Test syscall. */ + + mov $0x14,%eax /* getpid */ + .global test_syscall +test_syscall: + int $0x80 + nop + .global test_syscall_end +test_syscall_end: + nop + +/***********************************************/ + +/* Test syscall again, this time with a prefix. + These don't occur in normal code, but gdb should still DTRT. */ + + mov $0x14,%eax /* getpid */ + .global test_prefixed_syscall +test_prefixed_syscall: + repnz + int $0x80 + nop + .global test_prefixed_syscall_end +test_prefixed_syscall_end: + nop + +/***********************************************/ + +/* Test stepping over int3. + The prefixes are pointless, but it's possible, so we exercise it. */ + + nop + .global test_int3 +test_int3: + repz + repz + int3 + nop + .global test_int3_end +test_int3_end: + nop + +/***********************************************/ + +/* all done */ + + pushl $0 + call exit + hlt + +/***********************************************/ + +/* subroutine to help test call/ret */ + +test_call_subr: + nop + .global test_call_end +test_call_end: + nop + + .global test_ret +test_ret: + ret
i386-disp-step.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-prologue.exp =================================================================== --- powerpc-prologue.exp (nonexistent) +++ powerpc-prologue.exp (revision 816) @@ -0,0 +1,88 @@ +# Copyright 2006, 2007, 2008, 2009, 2010 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.*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.*pc at.*lr at.*" \ + "saved registers in optimized" Index: iwmmxt-regs.c =================================================================== --- iwmmxt-regs.c (nonexistent) +++ iwmmxt-regs.c (revision 816) @@ -0,0 +1,86 @@ +/* Register test program. + + Copyright 2007, 2008, 2009, 2010 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: i386-prologue.c =================================================================== --- i386-prologue.c (nonexistent) +++ i386-prologue.c (revision 816) @@ -0,0 +1,166 @@ +/* Unwinder test program. + + Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 + 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 816) @@ -0,0 +1,92 @@ +# Copyright 2003, 2007, 2008, 2009, 2010 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: ppc-fp.c =================================================================== --- ppc-fp.c (nonexistent) +++ ppc-fp.c (revision 816) @@ -0,0 +1,36 @@ +/* Copyright 2008, 2009, 2010 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 . */ + +int +main (int argc, char *argv[]) +{ + double result; + + asm ("fdiv %0, %1, %1\n" /* Invalid operation. */ + : "=f" (result) + : "f" (0.0)); + + asm ("mtfsf 0xff, %0\n" /* Reset FPSCR. */ + : + : "f" (0.0)); + + asm ("fdiv %0, %1, %2\n" /* Division by zero. */ + : "=f" (result) + : "f" (1.25), "f" (0.0)); + + return 0; +}
ppc-fp.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: altivec-regs.c =================================================================== --- altivec-regs.c (nonexistent) +++ altivec-regs.c (revision 816) @@ -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 816) @@ -0,0 +1,93 @@ +# Copyright 2007, 2008, 2009, 2010 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 "*-*-cygwin*"] || [istarget "*-*-mingw*"] } 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: i386-permbkpt.S =================================================================== --- i386-permbkpt.S (nonexistent) +++ i386-permbkpt.S (revision 816) @@ -0,0 +1,30 @@ +/* Copyright 2009, 2010 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. */ + +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +#ifdef SYMBOL_PREFIX +# define SYMBOL(str) CONCAT1(SYMBOL_PREFIX, str) +#else +# define SYMBOL(str) str +#endif + + .global SYMBOL(main) +SYMBOL(main): + int3 + ret
i386-permbkpt.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-cpuid.h =================================================================== --- i386-cpuid.h (nonexistent) +++ i386-cpuid.h (revision 816) @@ -0,0 +1,75 @@ +/* Helper file for i386 platform. Runtime check for MMX/SSE/SSE2 support. + + Copyright 2004, 2007, 2008, 2009, 2010 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: amd64-disp-step.S =================================================================== --- amd64-disp-step.S (nonexistent) +++ amd64-disp-step.S (revision 816) @@ -0,0 +1,181 @@ +/* Copyright 2009, 2010 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. + It tests displaced stepping over various insns that require special + handling. */ + + .text + + .global main +main: + nop + +/***********************************************/ + +/* test call/ret */ + + .global test_call +test_call: + call test_call_subr + nop + .global test_ret_end +test_ret_end: + nop + +/***********************************************/ + +/* test abs-jmp/rep-ret */ + +test_abs_jmp_setup: + mov $test_abs_jmp_return,%rdx + push %rdx + mov $test_abs_jmp_subr,%rdx + .global test_abs_jmp +test_abs_jmp: + jmp *%rdx +test_abs_jmp_return: + nop + .global test_rep_ret_end +test_rep_ret_end: + nop + +/***********************************************/ + +/* test syscall */ + + .global test_syscall + mov $0x27,%eax /* getpid */ +test_syscall: + syscall + nop +test_syscall_end: + nop + +/***********************************************/ + +/* Test stepping over int3. + The prefixes are pointless, but it's possible, so we exercise it. */ + + nop + .global test_int3 +test_int3: + repz + repz + int3 + nop + .global test_int3_end +test_int3_end: + nop + +/***********************************************/ + +/* test rip-relative + GDB picks a spare register to hold the rip-relative address. + Exercise all the possibilities (rax-rdi, sans rsp). */ + + .global test_rip_rax +test_rip_rax: + add answer(%rip),%rax + .global test_rip_rax_end +test_rip_rax_end: + nop + + .global test_rip_rbx +test_rip_rbx: + add answer(%rip),%rbx + .global test_rip_rbx_end +test_rip_rbx_end: + nop + + .global test_rip_rcx +test_rip_rcx: + add answer(%rip),%rcx + .global test_rip_rcx_end +test_rip_rcx_end: + nop + + .global test_rip_rdx +test_rip_rdx: + add answer(%rip),%rdx + .global test_rip_rdx_end +test_rip_rdx_end: + nop + + .global test_rip_rbp +test_rip_rbp: + add answer(%rip),%rbp + .global test_rip_rbp_end +test_rip_rbp_end: + nop + + .global test_rip_rsi +test_rip_rsi: + add answer(%rip),%rsi + .global test_rip_rsi_end +test_rip_rsi_end: + nop + + .global test_rip_rdi +test_rip_rdi: + add answer(%rip),%rdi + .global test_rip_rdi_end +test_rip_rdi_end: + nop + + /* skip over test data */ + jmp done + +/* test rip-relative data */ + +answer: .8byte 42 + +/***********************************************/ + +/* all done */ + +done: + mov $0,%rdi + call exit + hlt + +/***********************************************/ + +/* subroutine to help test call/ret */ + +test_call_subr: + nop + .global test_call_end +test_call_end: + nop + + .global test_ret +test_ret: + ret + +/***********************************************/ + +/* subroutine to help test abs-jmp/rep-ret */ + +test_abs_jmp_subr: + nop + .global test_abs_jmp_end +test_abs_jmp_end: + nop + + .global test_rep_ret +test_rep_ret: + repz + ret
amd64-disp-step.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-size.c =================================================================== --- i386-size.c (nonexistent) +++ i386-size.c (revision 816) @@ -0,0 +1,48 @@ +/* Symbol size test program. + + Copyright 2006, 2007, 2008, 2009, 2010 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 816) @@ -0,0 +1,86 @@ +# Copyright 2004, 2007, 2008, 2009, 2010 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 .* 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 +insert_breakpoint "stack_check_probe_1" 16 +insert_breakpoint "stack_check_probe_2" 40 +insert_breakpoint "stack_check_probe_loop_1" 68 +insert_breakpoint "stack_check_probe_loop_2" 60 + Index: ppc-dfp.exp =================================================================== --- ppc-dfp.exp (nonexistent) +++ ppc-dfp.exp (revision 816) @@ -0,0 +1,79 @@ +# Copyright (C) 2008, 2009, 2010 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 Decimal Floating Point registers setting and fetching + +if $tracelevel then { + strace $tracelevel +} + +if ![istarget "powerpc*"] then { + verbose "Skipping powerpc decimal floating point register tests." + return +} + +set testfile "ppc-dfp" +set binfile ${objdir}/${subdir}/${testfile} +set srcfile ${testfile}.c + +if [get_compiler_info $binfile] { + warning "get_compiler failed" + return -1 +} + +if ![test_compiler_info gcc*] { + # We use GCC's extended asm syntax + warning "unknown compiler" + return -1 +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {quiet debug}] != "" } { + unsupported "This machine doesn't support Decimal Floating Point." + return -1 +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_breakpoint [gdb_get_line_number "Set DFP rounding mode."] + +gdb_run_cmd + +# When the prompt comes back we'll be at the Set DFP rounding mode breakpoint. +# Unless the program bails out after checking AT_HWCAP. +gdb_expect { + -re "Program exited with code 01.\[\r\n\]+$gdb_prompt $" { + unsupported "This machine doesn't support Decimal Floating Point." + return -1 + } + + -re ".*$gdb_prompt $" {} +} + +# First, verify if FPSCR is all zeroes. +gdb_test "print \$fpscr" " = 0" "FPSCR is all zeroes" + +# Step over "set rounding mode" instruction. +gdb_test "next" "" "" + +# Verify that the following bits are set (See Power ISA for details): +# +# 29:31 - DFP Rounding Control +gdb_test "print/t \$fpscr" " = 10100000000000000000000000000000000" "FPSCR for round to nearest, ties toward zero rounding mode" Index: thumb-prologue.c =================================================================== --- thumb-prologue.c (nonexistent) +++ thumb-prologue.c (revision 816) @@ -0,0 +1,106 @@ +/* Unwinder test program. + + Copyright 2006, 2007, 2008, 2009, 2010 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: e500-abi.exp =================================================================== --- e500-abi.exp (nonexistent) +++ e500-abi.exp (revision 816) @@ -0,0 +1,87 @@ +# Copyright 2003, 2007, 2008, 2009, 2010 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 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 816) @@ -0,0 +1,81 @@ +# Copyright 2004, 2007, 2008, 2009, 2010 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: gdb1558.c =================================================================== --- gdb1558.c (nonexistent) +++ gdb1558.c (revision 816) @@ -0,0 +1,37 @@ +/* Copyright 2004, 2005, 2007, 2008, 2009, 2010 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 816) @@ -0,0 +1,75 @@ +# Copyright 2007, 2008, 2009, 2010 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: thumb2-it.exp =================================================================== --- thumb2-it.exp (nonexistent) +++ thumb2-it.exp (revision 816) @@ -0,0 +1,163 @@ +# Copyright 2010 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 single stepping over Thumb-2 IT blocks. + +if {![istarget arm*-*eabi*]} then { + verbose "Skipping Thumb-2 tests." + return +} + +set testfile "thumb2-it" +set srcfile ${testfile}.S +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } { + untested thumb2-it.exp + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + untested thumb2-it.exp + return -1 +} + +# Make sure that the compiler options allow Thumb-2. +gdb_test_multiple "list" "list main" { + -re ".*@ No Thumb-2.*$gdb_prompt $" { + pass "list main" + untested thumb2-it.exp + return -1 + } + -re ".*@ Thumb-2 OK.*$gdb_prompt $" { + pass "list main" + } +} + +proc test_it_block { func } { + global gdb_prompt + global software_step + + if { ! [gdb_breakpoint "*${func}"] } { + unresolved "$func, IT block tests" + return + } + + gdb_test "call ${func}()" "Breakpoint.*@ Setup.*" "$func, call" + + set expected 0 + set reached 0 + set steps 0 + set ok 1 + while { $ok } { + set ok 0 + set msg "$func, stepi $steps" + gdb_test_multiple "stepi" "$msg" { + -re ".*@ Setup.*$gdb_prompt $" { + pass "$msg" + set ok 1 + } + -re ".*@ IT instruction, Expected == (\[0-9\]*)\r\n$gdb_prompt $" { + set expected $expect_out(1,string) + pass "$msg" + set ok 1 + } + -re ".*@ Reached.*$gdb_prompt $" { + incr reached + pass "$msg" + set ok 1 + if { [regexp {@ Reached, Set ([^\r\n]*)\r\n} $expect_out(0,string) dummy change] } { + gdb_test "set $change" "" "$func, set $change" + } + } + -re ".*@ Not reached.*$gdb_prompt $" { + # An instruction in an IT block whose predicate is false when + # we reach it. If using software single step, we should not + # stop here. + if { $software_step } { + fail "$msg" + } else { + pass "$msg" + set ok 1 + } + } + -re ".*@ Never reached.*$gdb_prompt $" { + # An instruction that should be branched over. + fail "$msg" + } + -re ".*@ Done.*$gdb_prompt $" { + pass "$msg" + if { $reached == $expected } { + pass "$func, correct instructions reached" + } else { + fail "$func, correct instructions reached" + } + if { [regexp {@ Done, Check ([^\r\n]*)\r\n} $expect_out(0,string) dummy check] } { + gdb_test "print $check" ".* = 1" "$func, $check" + } + } + } + if { ! $ok } { + break + } + incr steps + continue + } + + gdb_test "continue" "" "$func, continue" + return +} + +proc test_it_break { ndx } { + global software_step + + set line [gdb_get_line_number "@ Break ${ndx}"] + + if { ! [gdb_breakpoint "${line}"] } { + unresolved "continue to breakpoint: test ${ndx}" + return + } + + if { $software_step } { + gdb_continue_to_breakpoint "test ${ndx}" ".*@ Location ${ndx}.*" + } else { + gdb_continue_to_breakpoint "test ${ndx}" ".*@ Break ${ndx}.*" + } +} + +# If we are using software single-stepping in GDB, then GDB will not +# stop at conditional instructions with a false predicate during stepi. +# If we are using a simulator or debug interface with hardware single +# step, then GDB will stop at such instructions. +if { [istarget arm*-linux*] } { + set software_step 1 +} else { + set software_step 0 +} + +for { set i 1 } { $i <= 8 } { incr i } { + test_it_block it_${i} +} + +gdb_breakpoint "*it_breakpoints" +gdb_test "call it_breakpoints()" "Breakpoint.*" +for { set i 1 } { $i <= 7 } { incr i } { + test_it_break ${i} +} Index: gdb1431.s =================================================================== --- gdb1431.s (nonexistent) +++ gdb1431.s (revision 816) @@ -0,0 +1,128 @@ +! Copyright 2004, 2010 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 816) @@ -0,0 +1,184 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2004, 2007, 2008, 2009, 2010 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); + +void stack_check_probe_1 (void); +void stack_check_probe_2 (void); +void stack_check_probe_loop_1 (void); +void stack_check_probe_loop_2 (void); + +int +main (void) +{ + li_stw (); + stack_check_probe_1 (); + stack_check_probe_2 (); + stack_check_probe_loop_1 (); + stack_check_probe_loop_2 (); + 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"); + +/* Asm for procedure stack_check_probe_1(). + + The purpose of this function is to verify that GDB can skip the stack + checking probing at the beginning of the prologue. */ + +asm (" .csect .text[PR]\n" + " .align 2\n" + " .globl stack_check_probe_1\n" + " .globl .stack_check_probe_1\n" + " .csect stack_check_probe_1[DS]\n" + "stack_check_probe_1:\n" + " .long .stack_check_probe_1, TOC[tc0], 0\n" + " .csect .text[PR]\n" + ".stack_check_probe_1:\n" + " stw 0,-12336(1)\n" + " stw 31,-4(1)\n" + " stwu 1,-48(1)\n" + " mr 31,1\n" + " lwz 1,0(1)\n" + " lwz 31,-4(1)\n" + " blr\n"); + +/* Asm for procedure stack_check_probe_2 (). + + Similar to stack_check_probe_1, but with a different probing sequence + (several probes). */ + +asm (" .csect .text[PR]\n" + " .align 2\n" + " .globl stack_check_probe_2\n" + " .globl .stack_check_probe_2\n" + " .csect stack_check_probe_2[DS]\n" + "stack_check_probe_2:\n" + " .long .stack_check_probe_2, TOC[tc0], 0\n" + " .csect .text[PR]\n" + ".stack_check_probe_2:\n" + " stw 0,-16384(1)\n" + " stw 0,-20480(1)\n" + " stw 0,-24576(1)\n" + " stw 0,-28672(1)\n" + " stw 0,-28752(1)\n" + " mflr 0\n" + " stw 31,-4(1)\n" + " stw 0,8(1)\n" + " stwu 1,-16464(1)\n" + " mr 31,1\n" + " lwz 1,0(1)\n" + " lwz 0,8(1)\n" + " mtlr 0\n" + " lwz 31,-4(1)\n" + " blr\n"); + +/* Asm for procedure stack_check_probe_loop_1() and stack_check_probe_loop_2(). + + Similar to stack_check_probe_1, but with a different probing sequence + (probing loop). */ + +asm (" .csect .text[PR]\n" + " .align 2\n" + " .globl stack_check_probe_loop_1\n" + " .globl .stack_check_probe_loop_1\n" + " .csect stack_check_probe_loop_1[DS]\n" + "stack_check_probe_loop_1:\n" + " .long .stack_check_probe_loop_1, TOC[tc0], 0\n" + " .csect .text[PR]\n" + ".stack_check_probe_loop_1:\n" + " addi 12,1,-12288\n" + " lis 0,-8\n" + " ori 0,0,4096\n" + " add 0,12,0\n" + "LPSRL1..0:\n" + " cmpw 0,12,0\n" + " beq 0,LPSRE1..0\n" + " addi 12,12,-4096\n" + " stw 0,0(12)\n" + " b LPSRL1..0\n" + "LPSRE1..0:\n" + " stw 0,-4080(12)\n" + " mflr 0\n" + " stw 31,-4(1)\n" + " stw 0,8(1)\n" + " lis 0,0xfff8\n" + " ori 0,0,16\n" + " stwux 1,1,0\n" + " mr 31,1\n" + " lwz 1,0(1)\n" + " lwz 0,8(1)\n" + " mtlr 0\n" + " lwz 31,-4(1)\n" + " blr\n"); + +asm (" .csect .text[PR]\n" + " .align 2\n" + " .globl stack_check_probe_loop_2\n" + " .globl .stack_check_probe_loop_2\n" + " .csect stack_check_probe_loop_2[DS]\n" + "stack_check_probe_loop_2:\n" + " .long .stack_check_probe_loop_2, TOC[tc0], 0\n" + " .csect .text[PR]\n" + ".stack_check_probe_loop_2:\n" + " addi 12,1,-12288\n" + " lis 0,-8\n" + " add 0,12,0\n" + "LPSRL2..0:\n" + " cmpw 0,12,0\n" + " beq 0,LPSRE2..0\n" + " addi 12,12,-4096\n" + " stw 0,0(12)\n" + " b LPSRL2..0\n" + "LPSRE2..0:\n" + " mflr 0\n" + " stw 31,-4(1)\n" + " stw 0,8(1)\n" + " lis 0,0xfff8\n" + " ori 0,0,16\n" + " stwux 1,1,0\n" + " mr 31,1\n" + " lwz 1,0(1)\n" + " lwz 0,8(1)\n" + " mtlr 0\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: altivec-abi.exp =================================================================== --- altivec-abi.exp (nonexistent) +++ altivec-abi.exp (revision 816) @@ -0,0 +1,159 @@ +# Copyright (C) 2002, 2003, 2005, 2007, 2008, 2009, 2010 +# 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." + 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 print frame-arguments all" + 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: i386-prologue.exp =================================================================== --- i386-prologue.exp (nonexistent) +++ i386-prologue.exp (revision 816) @@ -0,0 +1,238 @@ +# Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 +# 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 "*-*-cygwin*"] || [istarget "*-*-mingw*"] } 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: iwmmxt-regs.exp =================================================================== --- iwmmxt-regs.exp (nonexistent) +++ iwmmxt-regs.exp (revision 816) @@ -0,0 +1,77 @@ +# Copyright 2007, 2008, 2009, 2010 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: altivec-regs.exp =================================================================== --- altivec-regs.exp (nonexistent) +++ altivec-regs.exp (revision 816) @@ -0,0 +1,236 @@ +# Copyright (C) 2002, 2003, 2005, 2007, 2008, 2009, 2010 +# 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 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." + 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 +} + +gdb_test "set print frame-arguments all" + +# 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: ppc-fp.exp =================================================================== --- ppc-fp.exp (nonexistent) +++ ppc-fp.exp (revision 816) @@ -0,0 +1,97 @@ +# Copyright (C) 2008, 2009, 2010 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 floating point register setting and fetching + +if $tracelevel then { + strace $tracelevel +} + +if ![istarget "powerpc*"] then { + verbose "Skipping powerpc floating point register tests." + return +} + +set testfile "ppc-fp" +set binfile ${objdir}/${subdir}/${testfile} +set srcfile ${testfile}.c + +if [get_compiler_info $binfile] { + warning "get_compiler failed" + return -1 +} + +if ![test_compiler_info gcc*] { + # We use GCC's extended asm syntax + warning "unknown compiler" + return -1 +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {quiet debug}] != "" } { + verbose "Skipping FPSCR tests." + return -1 +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_breakpoint [gdb_get_line_number "Invalid operation."] +gdb_breakpoint [gdb_get_line_number "Division by zero."] + +gdb_run_cmd + +# When the prompt comes back we'll be in the invalid operation breakpoint. +gdb_expect { -re ".*$gdb_prompt $" {} } + +# First, verify if FPSCR exists and is all zeroes. +gdb_test_multiple "print \$fpscr" "FPSCR exists" { + -re " = 0\[\r\n\]+$gdb_prompt $" { pass "FPSCR is all zeroes" } + + -re " = void\[\r\n\]+$gdb_prompt $" { + # There's no FPSCR. Skip this testcase. + verbose "Skipping powerpc floating point register tests." + return + } +} + +# Step over invalid operation. +gdb_test "next" "" "" + +# Verify that the following bits are set (See Power ISA for details): +# +# 32 - Floating-Point Exception Summary (FX) +# 34 - Floating-Point Invalid Operation Summary (VX) +# 42 - Floating-Point Invalid Operation Exception (VXZDZ) +# 47 - Floating-Point Result Class Descriptor (C) +# 51 - Floating-Point Unordered or NaN (FU or ?) +gdb_test "print/t \$fpscr" " = 10100000001000010001000000000000" "FPSCR for invalid operation" + +gdb_continue_to_breakpoint "go to division by zero" + +# Step over division by zero. +gdb_test "next" "" "" + +# Verify that the following bits are set (See Power ISA for details): +# +# 32 - Floating-Point Exception Summary (FX) +# 37 - Floating-Point Zero Divide Exception (ZX) +# 49 - Floating-Point Greater Than or Positive (FG or >) +# 51 - Floating-Point Unordered or NaN (FU or ?) +gdb_test "print/t \$fpscr" " = 10000100000000000101000000000000" "FPSCR for division by zero" Index: e500-abi.c =================================================================== --- e500-abi.c (nonexistent) +++ e500-abi.c (revision 816) @@ -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: amd64-i386-address.S =================================================================== --- amd64-i386-address.S (nonexistent) +++ amd64-i386-address.S (revision 816) @@ -0,0 +1,24 @@ +/* Copyright 2009, 2010 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. */ + +_start: .globl _start + movl $0xdeadf00d, %eax + pushl %eax + movl %esp, %ebx + int3 + nop + nop
amd64-i386-address.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-regs.c =================================================================== --- e500-regs.c (nonexistent) +++ e500-regs.c (revision 816) @@ -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: alpha-step.exp =================================================================== --- alpha-step.exp (nonexistent) +++ alpha-step.exp (revision 816) @@ -0,0 +1,113 @@ +# Copyright 2005, 2007, 2008, 2009, 2010 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-disp-step.exp =================================================================== --- i386-disp-step.exp (nonexistent) +++ i386-disp-step.exp (revision 816) @@ -0,0 +1,170 @@ +# Copyright 2009, 2010 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. + +# Test i386 displaced stepping. + +if $tracelevel { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +if ![istarget "i?86-*-linux*"] then { + verbose "Skipping x86 displaced stepping tests." + return +} + +set testfile "i386-disp-step" +set srcfile ${testfile}.S +set binfile ${objdir}/${subdir}/${testfile} + +set additional_flags "-Wa,-g" + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { + untested i386-disp-step.exp + return -1 +} + +# Get things started. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test "set displaced-stepping on" "" +gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*" + +if ![runto_main] then { + fail "Can't run to main" + return 0 +} + +########################################## + +# Test call/ret. + +gdb_test "break test_call" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_call" +gdb_test "break test_call_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_call_end" + +gdb_test "break test_ret" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_ret" +gdb_test "break test_ret_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_ret_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_call ().*" \ + "continue to test_call" +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_call_end ().*" \ + "continue to test_call_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_ret ().*" \ + "continue to test_ret" +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_ret_end ().*" \ + "continue to test_ret_end" + +########################################## + +# Absolute jump with leading prefixes. +# These don't occur in normal code, but gdb should still DTRT. + +gdb_test "break test_prefixed_abs_jump" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_prefixed_abs_jump" +gdb_test "break test_prefixed_abs_jump_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_prefixed_abs_jump_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_prefixed_abs_jump ().*" \ + "continue to test_prefixed_abs_jump" +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_prefixed_abs_jump_end ().*" \ + "continue to test_prefixed_abs_jump_end" + +########################################## + +# Test syscall. + +gdb_test "break test_syscall" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_syscall" +gdb_test "break test_syscall_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_syscall_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_syscall ().*" \ + "continue to test_syscall" +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_syscall_end ().*" \ + "continue to test_syscall_end" + +########################################## + +# Test prefixed syscall. +# These don't occur in normal code, but gdb should still DTRT. + +gdb_test "break test_prefixed_syscall" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_prefixed_syscall" +gdb_test "break test_prefixed_syscall_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_prefixed_syscall_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_prefixed_syscall ().*" \ + "continue to test_prefixed_syscall" +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_prefixed_syscall_end ().*" \ + "continue to test_prefixed_syscall_end" + +########################################## + +# int3 (with prefixes) +# These don't occur in normal code, but gdb should still DTRT. + +gdb_test "break test_int3" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_int3" +gdb_test "break test_int3_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_int3_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_int3 ().*" \ + "continue to test_int3" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_int3_end ().*" \ + "continue to test_int3_end" + +########################################## + +# Done, run program to exit. + +gdb_continue_to_end "i386-disp-step" Index: i386-bp_permanent.exp =================================================================== --- i386-bp_permanent.exp (nonexistent) +++ i386-bp_permanent.exp (revision 816) @@ -0,0 +1,104 @@ +# Copyright (C) 2008, 2009, 2010 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 stepping over permanent breakpoints on i386. + +if ![istarget "i?86-*-*"] then { + verbose "Skipping skip over permanent breakpoint on i386 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 +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# +# Run to `main' where we begin our tests. +# + +if ![runto_main] then { + return -1 +} + +set function standard + +set retcode [gdb_test_multiple "disassemble $function" "Disassemble function '$function'" { + -re ".*($hex) <\\+0>.*($hex) <\\+4>.*($hex) <\\+5>.*($hex) <\\+6>.*$gdb_prompt $" { + set function_start $expect_out(1,string); + set address $expect_out(2,string); + set address1 $expect_out(3,string); + set address2 $expect_out(4,string); + } +}] + +if {$retcode != 0} { + fail "Disassemble failed, skipping entire test." + return -1 +} + +gdb_breakpoint "*$function_start" + +gdb_breakpoint "*$address" + +gdb_test "continue" "Breakpoint .*, $function_start in $function.*" \ + "Stop at the '$function' start breakpoint (fetching esp)." + +# We want to fetch esp at the start of '$function' function to make sure +# skip_permanent_breakpoint implementation really skips only the perm. +# breakpoint. If, for whatever reason, 'leave' instruction doesn't get +# executed, esp will not have this value. +set start_esp 0 +gdb_test_multiple "print \$esp" "Fetch esp value." { + -re "\\\$1.*($hex).*$gdb_prompt $" { + set start_esp $expect_out(1,string); + } +} + +gdb_test "continue" "Breakpoint .*, $address in $function.*" \ + "Stop at permanent breakpoint." + +gdb_test "stepi" "$address1|$address2 in $function.*" \ + "Single stepping past permanent breakpoint." + +gdb_test "print \$esp" ".*$start_esp.*" \ + "ESP value does not match - step_permanent_breakpoint wrong." + Index: i386-size.exp =================================================================== --- i386-size.exp (nonexistent) +++ i386-size.exp (revision 816) @@ -0,0 +1,88 @@ +# Copyright 2006, 2007, 2008, 2009, 2010 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 816) @@ -0,0 +1,355 @@ +/* Copyright 2007, 2008, 2009, 2010 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 816) @@ -0,0 +1,42 @@ +# Copyright 2007, 2008, 2009, 2010 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 816) @@ -0,0 +1,63 @@ +# Copyright 2003, 2004, 2007, 2008, 2009, 2010 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 816) @@ -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 816) @@ -0,0 +1,125 @@ +/* Test program for SSE registers. + + Copyright 2004, 2007, 2008, 2009, 2010 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[] = + { + { { 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 } }, +#ifdef __x86_64__ + { { 8.0, 8.25, 8.50, 8.75 } }, + { { 9.0, 9.25, 9.50, 9.75 } }, + { { 10.0, 10.25, 10.50, 10.75 } }, + { { 11.0, 11.25, 11.50, 11.75 } }, + { { 12.0, 12.25, 12.50, 12.75 } }, + { { 13.0, 13.25, 13.50, 13.75 } }, + { { 14.0, 14.25, 14.50, 14.75 } }, + { { 15.0, 15.25, 15.50, 15.75 } }, +#endif + }; + + +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"); +#ifdef __x86_64__ + asm ("movaps 128(%0), %%xmm8\n\t" + "movaps 144(%0), %%xmm9\n\t" + "movaps 160(%0), %%xmm10\n\t" + "movaps 176(%0), %%xmm11\n\t" + "movaps 192(%0), %%xmm12\n\t" + "movaps 208(%0), %%xmm13\n\t" + "movaps 224(%0), %%xmm14\n\t" + "movaps 240(%0), %%xmm15\n\t" + : /* no output operands */ + : "r" (data) + : "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"); +#endif + + asm ("nop"); /* 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"); +#ifdef __x86_64__ + asm ( + "movaps %%xmm8, 128(%0)\n\t" + "movaps %%xmm9, 144(%0)\n\t" + "movaps %%xmm10, 160(%0)\n\t" + "movaps %%xmm11, 176(%0)\n\t" + "movaps %%xmm12, 192(%0)\n\t" + "movaps %%xmm13, 208(%0)\n\t" + "movaps %%xmm14, 224(%0)\n\t" + "movaps %%xmm15, 240(%0)\n\t" + : /* no output operands */ + : "r" (data) + : "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"); +#endif + + 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 816) @@ -0,0 +1,44 @@ +/* This file is part of GDB, the GNU debugger. + + Copyright 2008, 2009, 2010 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: thumb-prologue.exp =================================================================== --- thumb-prologue.exp (nonexistent) +++ thumb-prologue.exp (revision 816) @@ -0,0 +1,61 @@ +# Copyright 2006, 2007, 2008, 2009, 2010 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.*" \ + "saved registers in TPCS" Index: i386-permbkpt.exp =================================================================== --- i386-permbkpt.exp (nonexistent) +++ i386-permbkpt.exp (revision 816) @@ -0,0 +1,52 @@ +# Copyright (C) 2009, 2010 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 inserting breakpoints over permanent breakpoints on i386 and amd64. + +if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then { + verbose "Skipping i386 test for multi break at permanent breakpoint location." + return +} + +set testfile "i386-permbkpt" +set srcfile ${testfile}.S +set binfile ${objdir}/${subdir}/${testfile} + +# Some targets have leading underscores on assembly symbols. +# TODO: detect this automatically +set additional_flags "" +if { [istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"] } then { + set additional_flags "additional_flags=-DSYMBOL_PREFIX=_" +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { + untested i386-permbkpt.exp + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test "break main" "" "First permanent break" +gdb_test "break main" "" "Second permanent break" Index: powerpc-d128-regs.c =================================================================== --- powerpc-d128-regs.c (nonexistent) +++ powerpc-d128-regs.c (revision 816) @@ -0,0 +1,25 @@ +/* This file is part of GDB, the GNU debugger. + + Copyright 2008, 2009, 2010 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: gdb1558.exp =================================================================== --- gdb1558.exp (nonexistent) +++ gdb1558.exp (revision 816) @@ -0,0 +1,72 @@ +# Copyright 2004, 2007, 2008, 2009, 2010 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: pa-nullify.exp =================================================================== --- pa-nullify.exp (nonexistent) +++ pa-nullify.exp (revision 816) @@ -0,0 +1,163 @@ +# Copyright 2004, 2007, 2008, 2009, 2010 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 816) @@ -0,0 +1,46 @@ +/* Unwinder test program. + + Copyright 2003, 2004, 2007, 2008, 2009, 2010 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 Index: amd64-disp-step.exp =================================================================== --- amd64-disp-step.exp (nonexistent) +++ amd64-disp-step.exp (revision 816) @@ -0,0 +1,239 @@ +# Copyright 2009, 2010 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. + +# Test amd64 displaced stepping. + +if $tracelevel { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +if ![istarget "x86_64-*-linux*"] then { + verbose "Skipping x86_64 displaced stepping tests." + return +} + +set newline "\[\r\n\]*" + +set testfile "amd64-disp-step" +set srcfile ${testfile}.S +set binfile ${objdir}/${subdir}/${testfile} + +set additional_flags "-Wa,-g" + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { + untested amd64-disp-step.exp + return -1 +} + +# Get things started. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test "set displaced-stepping on" "" +gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*" + +if ![runto_main] then { + fail "Can't run to main" + return 0 +} + +########################################## + +# Test call/ret. + +gdb_test "break test_call" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_call" +gdb_test "break test_call_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_call_end" + +gdb_test "break test_ret" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_ret" +gdb_test "break test_ret_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_ret_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_call ().*" \ + "continue to test_call" +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_call_end ().*" \ + "continue to test_call_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_ret ().*" \ + "continue to test_ret" +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_ret_end ().*" \ + "continue to test_ret_end" + +########################################## + +# Test abs-jmp/rep-ret. + +gdb_test "break test_abs_jmp" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_abs_jmp" +gdb_test "break test_abs_jmp_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_abs_jmp_end" + +gdb_test "break test_rep_ret" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_rep_ret" +gdb_test "break test_rep_ret_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_rep_ret_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_abs_jmp ().*" \ + "continue to test_abs_jmp" +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_abs_jmp_end ().*" \ + "continue to test_abs_jmp_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_rep_ret ().*" \ + "continue to test_rep_ret" +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_rep_ret_end ().*" \ + "continue to test_rep_ret_end" + +########################################## + +# Test syscall. + +gdb_test "break test_syscall" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_syscall" +gdb_test "break test_syscall_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_syscall_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_syscall ().*" \ + "continue to test_syscall" +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_syscall_end ().*" \ + "continue to test_syscall_end" + +########################################## + +# int3 (with prefixes) +# These don't occur in normal code, but gdb should still DTRT. + +gdb_test "break test_int3" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_int3" +gdb_test "break test_int3_end" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break test_int3_end" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_int3 ().*" \ + "continue to test_int3" + +gdb_test "continue" \ + "Continuing.*Breakpoint.*, test_int3_end ().*" \ + "continue to test_int3_end" + +########################################## + +# Test rip-relative. +# GDB picks a spare register to hold the rip-relative address. +# Exercise all the possibilities (rax-rdi, sans rsp). + +# The order must much the order in srcfile. +set rip_regs { "rax" "rbx" "rcx" "rdx" "rbp" "rsi" "rdi" } + +# Assign val to all specified regs. + +proc set_regs { regs val } { + global gdb_prompt + + foreach reg ${regs} { + # Use send_gdb/gdb_expect so that these aren't logged as pass/fail. + send_gdb "set \$${reg} = ${val}\n" + gdb_expect 10 { + -re "$gdb_prompt $" { + verbose "Setting ${reg} to ${val}." 2 + } + timeout { + warning "Couldn't set ${reg} to ${val}." + } + } + } +} + +# Verify all REGS equal VAL, except REG which equals REG_VAL. + +proc verify_regs { test_name regs val except_reg except_reg_val } { + global newline + + foreach reg ${regs} { + set expected ${val} + if { "${reg}" == "${except_reg}" } { + set expected ${except_reg_val} + } + # The cast to (int) is because RBP is printed as a pointer. + gdb_test "p (int) \$${reg}" " = ${expected}${newline}" "${test_name} ${reg} expected value" + } +} + +proc rip_test { reg } { + global srcfile rip_regs + + set test_start_label "test_rip_${reg}" + set test_end_label "test_rip_${reg}_end" + + gdb_test "break ${test_start_label}" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break ${test_start_label}" + gdb_test "break ${test_end_label}" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "break ${test_end_label}" + + gdb_test "continue" \ + "Continuing.*Breakpoint.*, ${test_start_label} ().*" \ + "continue to ${test_start_label}" + + set_regs ${rip_regs} 0 + + gdb_test "continue" \ + "Continuing.*Breakpoint.*, ${test_end_label} ().*" \ + "continue to ${test_end_label}" + + verify_regs "test rip w/${reg}" ${rip_regs} 0 ${reg} 42 +} + +foreach reg ${rip_regs} { + rip_test $reg +} + +########################################## + +# Done, run program to exit. + +gdb_continue_to_end "amd64-disp-step"

powered by: WebSVN 2.1.0

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