* configure.ac: Run gdb.cell tests when appropriate.

* configure: Regenerate.
	* lib/cell.exp: New file.
	* gdb.cell: New directory.
	* gdb.cell/configure.ac: New file.
	* gdb.cell/configure: New file.
	* gdb.cell/Makefile.in: New file.
	* gdb.cell/arch.exp: New file.
	* gdb.cell/break.c: New file.
	* gdb.cell/break.exp: New file.
	* gdb.cell/break-spu.c: New file.
	* gdb.cell/bt.c: New file.
	* gdb.cell/bt2-spu.c: New file.
	* gdb.cell/bt-spu.c: New file.
	* gdb.cell/bt.exp: New file.
	* gdb.cell/coremaker.c: New file.
	* gdb.cell/coremaker-spu.c: New file.
	* gdb.cell/core.exp: New file.
	* gdb.cell/gcore.exp: New file.
	* gdb.cell/data.c: New file.
	* gdb.cell/data.exp: New file.
	* gdb.cell/data-spu.c: New file.
	* gdb.cell/ea-cache.exp: New file.
	* gdb.cell/ea-cache.c: New file.
	* gdb.cell/ea-cache-spu.c: New file.
	* gdb.cell/ea-standalone.c: New file.
	* gdb.cell/ea-standalone.exp: New file.
	* gdb.cell/ea-test.c: New file.
	* gdb.cell/ea-test.exp: New file.
	* gdb.cell/f-regs.exp: New file.
	* gdb.cell/mem-access.c: New file.
	* gdb.cell/mem-access.exp: New file.
	* gdb.cell/mem-access-spu.c: New file.
	* gdb.cell/ptype.exp: New file.
	* gdb.cell/registers.exp: New file.
	* gdb.cell/size.c: New file.
	* gdb.cell/sizeof.exp: New file.
	* gdb.cell/size-spu.c: New file.
	* gdb.cell/solib.exp: New file.
	* gdb.cell/solib-symbol.exp: New file.
This commit is contained in:
Ulrich Weigand 2009-07-31 15:38:16 +00:00
parent ff1a52c620
commit 1ea342040c
39 changed files with 4999 additions and 0 deletions

View File

@ -1,3 +1,46 @@
2009-07-31 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* configure.ac: Run gdb.cell tests when appropriate.
* configure: Regenerate.
* lib/cell.exp: New file.
* gdb.cell: New directory.
* gdb.cell/configure.ac: New file.
* gdb.cell/configure: New file.
* gdb.cell/Makefile.in: New file.
* gdb.cell/arch.exp: New file.
* gdb.cell/break.c: New file.
* gdb.cell/break.exp: New file.
* gdb.cell/break-spu.c: New file.
* gdb.cell/bt.c: New file.
* gdb.cell/bt2-spu.c: New file.
* gdb.cell/bt-spu.c: New file.
* gdb.cell/bt.exp: New file.
* gdb.cell/coremaker.c: New file.
* gdb.cell/coremaker-spu.c: New file.
* gdb.cell/core.exp: New file.
* gdb.cell/gcore.exp: New file.
* gdb.cell/data.c: New file.
* gdb.cell/data.exp: New file.
* gdb.cell/data-spu.c: New file.
* gdb.cell/ea-cache.exp: New file.
* gdb.cell/ea-cache.c: New file.
* gdb.cell/ea-cache-spu.c: New file.
* gdb.cell/ea-standalone.c: New file.
* gdb.cell/ea-standalone.exp: New file.
* gdb.cell/ea-test.c: New file.
* gdb.cell/ea-test.exp: New file.
* gdb.cell/f-regs.exp: New file.
* gdb.cell/mem-access.c: New file.
* gdb.cell/mem-access.exp: New file.
* gdb.cell/mem-access-spu.c: New file.
* gdb.cell/ptype.exp: New file.
* gdb.cell/registers.exp: New file.
* gdb.cell/size.c: New file.
* gdb.cell/sizeof.exp: New file.
* gdb.cell/size-spu.c: New file.
* gdb.cell/solib.exp: New file.
* gdb.cell/solib-symbol.exp: New file.
2009-07-31 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* gdb.xml/tdesc-regs.exp: Skip for SPU targets.

View File

@ -273,6 +273,7 @@ PACKAGE_BUGREPORT=
ac_unique_file="gdb.base"
ac_subdirs_all="$ac_subdirs_all gdb.hp"
ac_subdirs_all="$ac_subdirs_all gdb.cell"
ac_subdirs_all="$ac_subdirs_all gdb.stabs"
ac_subdirs_all="$ac_subdirs_all gdb.gdbtk"
# Factoring default headers for most tests.
@ -1541,6 +1542,26 @@ subdirs="$subdirs gdb.hp"
;;
esac
# Add Cell/B.E. specific tests when appropriate.
# We need support for both PowerPC and SPU targets configured in.
case $target in
powerpc*-*-linux*)
have_spu_target=no
for targ in `echo $enable_targets | sed 's/,/ /g'`
do
case "${targ}" in
spu*|all) have_spu_target=yes ;;
esac
done
if test x$have_spu_target = xyes; then
subdirs="$subdirs gdb.cell"
fi
;;
esac
# With stabs.
# Check whether --with-stabs or --without-stabs was given.

View File

@ -43,6 +43,23 @@ case $target in
AC_CONFIG_SUBDIRS(gdb.hp) ;;
esac
# Add Cell/B.E. specific tests when appropriate.
# We need support for both PowerPC and SPU targets configured in.
case $target in
powerpc*-*-linux*)
have_spu_target=no
for targ in `echo $enable_targets | sed 's/,/ /g'`
do
case "${targ}" in
spu*|all) have_spu_target=yes ;;
esac
done
if test x$have_spu_target = xyes; then
AC_CONFIG_SUBDIRS(gdb.cell)
fi
;;
esac
# With stabs.
AC_ARG_WITH(stabs,
[ --with-stabs arrange to use stabs instead of host debug format],,

View File

@ -0,0 +1,20 @@
VPATH = @srcdir@
srcdir = @srcdir@
EXECUTABLES = break bt coremaker data mem-access size
SPU_EXECUTABLES = break-spu bt-spu bt2-spu coremaker-spu data-spu \
ea-cache-spu ea-standalone ea-test mem-access-spu size-spu
all info install-info dvi install uninstall installcheck check:
@echo "Nothing to be done for $@..."
clean mostlyclean:
-rm -f *~ *.o a.out core corefile gcore.test
-rm -f $(EXECUTABLES) $(SPU_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.*

View File

@ -0,0 +1,116 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# This testcase checks if the "show architecture" command works properly.
load_lib cell.exp
set ppu_file "break"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "break-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
# No programm running, default architecture should be powerpc:common.
gdb_test "show architecture" \
"The target architecture is set automatically.*currently powerpc:common.*" \
"startup architecture is powerpc:common"
if ![runto_main] then {
fail "Can't run to main"
return 0
}
# In PPU thread, architecture should be powerpc:common.
gdb_test "show architecture" \
"The target architecture is set automatically.*currently powerpc:common.*" \
"ppu architecture is powerpc:common"
# Switch to SPU thread.
cont_spu_main
check_spu_arch ""
# Remember thread ID of first thread to hit SPU main.
send_gdb "thread\n"
gdb_expect 10 {
-re "Current thread is (\[0-9\]*) .*\r\n$gdb_prompt $" {
pass "Retrieve current thread"
set thread_id $expect_out(1,string)
}
-re "$gdb_prompt $" {
fail "Retrieve current thread"
return 0
}
timeout {
fail "Retrieve current thread (timed out)"
return 0
}
}
# Stress Test: Switching from PPU- to SPU-Thread and back 'rep' times.
set rep 100
for {set i 0} {$i < $rep} {incr i} {
# Switch to PPU Thread.
gdb_test "t 1" \
"Switching to thread 1.*" \
"switch back to thread 1 (PPU) #$i"
# In PPU Thread, architecture should again be powerpc:common.
gdb_test "show architecture" \
"The target architecture is set automatically.*currently powerpc:common.*" \
"ppu architecture is powerpc:common again #$i"
# Thread switching to SPU.
gdb_test "t $thread_id" \
"Switching to thread $thread_id.*at.*$spu_file.c.*" \
"switch back to thread $thread_id (spu) #$i"
# Standing in SPU thread again, architecture should be spu:256K again.
check_spu_arch "spu architecture is spu256K again #$i"
}
# End of Stress Test loop
gdb_exit
return 0

View File

@ -0,0 +1,43 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
void foo (void);
int
main (unsigned long long speid, unsigned long long argp,
unsigned long long envp)
{
int i;
printf ("Hello World! from spu\n");
i = 5;
foo ();
printf ("i = %d\n", i);
return 0;
}
void
foo (void)
{
printf ("in foo\n");
}

View File

@ -0,0 +1,71 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
#include <libspe2.h>
#include <pthread.h>
#include <sys/wait.h>
extern spe_program_handle_t break_spu;
#define nr_t 5
void *
spe_thread (void * arg)
{
int flags = 0;
unsigned int entry = SPE_DEFAULT_ENTRY;
spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg;
spe_program_load (*ctx, &break_spu);
spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL);
pthread_exit (NULL);
}
int
main (void)
{
int thread_id[nr_t];
pthread_t pts[nr_t];
spe_context_ptr_t ctx[nr_t];
int value = 1;
int cnt;
for (cnt = 0; cnt < nr_t; cnt++)
{
ctx[cnt] = spe_context_create (0, NULL);
thread_id[cnt]
= pthread_create (&pts[cnt], NULL, &spe_thread, &ctx[cnt]);
}
for (cnt = 0; cnt < nr_t; cnt++)
pthread_join (pts[cnt], NULL);
for (cnt = 0; cnt < nr_t; cnt++)
spe_context_destroy (ctx[cnt]);
return 0;
}
void
foo ()
{
printf ("foo in break\n");
return;
}

View File

@ -0,0 +1,103 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# This testcases tests setting and deleting breakpoints on PPU and SPU.
load_lib cell.exp
set testfile "break"
set ppu_file "break"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "break-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
# Delete breakpoints before starting the application. The debugger
# shouldn't prompt for anything.
gdb_test "delete breakpoints" \
"" \
"No prompt when deleting non-existing breakpoints"
gdb_test "break main" \
"Breakpoint.*at.* file .*$testfile.c, line.*" \
"breakpoint main in ppu"
if ![runto_main] then {
fail "Can't run to main"
return 0
}
delete_breakpoints
# Re-set breakpoint at main in PPU binary.
gdb_test "break main" \
"Breakpoint.*at.* file .*$testfile.c, line.*" \
"breakpoint function"
# Set breakpoint in SPU binary.
send_gdb "break $spu_file.c:10\n"
gdb_expect {
-re ".*$spu_file.c.*Make breakpoint pending.*y or \\\[n\\\]. $" {
gdb_test "y" "Breakpoint.*$spu_file.*pending." "set pending breakpoint"
}
timeout { fail "Timeout while setting breakpoint in spu binary" }
}
# Check breakpoints.
gdb_test "info break" \
"Num\[ \]+Type\[ \]+Disp\[ \]+Enb\[ \]+Address\[ \]+What.*
\[0-9\]+\[\t \]+breakpoint keep y.*in main at.*$testfile.c.*
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*$spu_file.c:10.*" \
"breakpoint info"
gdb_test "continue" \
"Continuing.*Switching to Thread.*Breakpoint.*main.*at.*$spu_file.c.*" \
"continuing to spu thread"
gdb_exit
return 0

View File

@ -0,0 +1,30 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
#include <sys/syscall.h>
int
main (unsigned long long speid, unsigned long long argp,
unsigned long long envp)
{
__send_to_ppe (0x2111, 0, NULL);
return 0;
}

101
gdb/testsuite/gdb.cell/bt.c Normal file
View File

@ -0,0 +1,101 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
#include <stdlib.h>
#include <libspe2.h>
#include <pthread.h>
#include <sys/wait.h>
extern spe_program_handle_t bt_spu;
extern spe_program_handle_t bt2_spu;
#define nr_t 5
void *
spe_thread (void * arg)
{
int flags = 0;
unsigned int entry = SPE_DEFAULT_ENTRY;
spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg;
spe_program_load (*ctx, &bt_spu);
spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL);
pthread_exit (NULL);
}
int
indirect_handler (unsigned char *base, unsigned long offset)
{
int flags = 0;
unsigned int entry = SPE_DEFAULT_ENTRY;
spe_context_ptr_t ctx = spe_context_create (0, NULL);
spe_program_load (ctx, &bt2_spu);
spe_context_run (ctx, &entry, flags, NULL, NULL, NULL);
return 0;
}
static pthread_mutex_t crash_mutex = PTHREAD_MUTEX_INITIALIZER;
static int crash_count = 0;
int
crash_handler (unsigned char *base, unsigned long offset)
{
int count;
pthread_mutex_lock (&crash_mutex);
count = ++crash_count;
pthread_mutex_unlock (&crash_mutex);
while (count < nr_t)
;
abort ();
}
int
main (void)
{
int thread_id[nr_t];
pthread_t pts[nr_t];
spe_context_ptr_t ctx[nr_t];
int value = 1;
int cnt;
spe_callback_handler_register (indirect_handler, 0x11, SPE_CALLBACK_NEW);
spe_callback_handler_register (crash_handler, 0x12, SPE_CALLBACK_NEW);
for (cnt = 0; cnt < nr_t; cnt++)
{
ctx[cnt] = spe_context_create (0, NULL);
thread_id[cnt]
= pthread_create (&pts[cnt], NULL, &spe_thread, &ctx[cnt]);
}
for (cnt = 0; cnt < nr_t; cnt++)
pthread_join (pts[cnt], NULL);
for (cnt = 0; cnt < nr_t; cnt++)
spe_context_destroy (ctx[cnt]);
return 0;
}

View File

@ -0,0 +1,90 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# This testcases tests mixed-architecture backtrace support
load_lib cell.exp
set testfile "bt"
set ppu_file "bt"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "bt-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
set spu2_file "bt2-spu"
set spu2_src ${srcdir}/${subdir}/${spu2_file}.c
set spu2_bin ${objdir}/${subdir}/${spu2_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binaries.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
if { [gdb_compile_cell_spu $spu2_src $spu2_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_cell_embedspu $spu2_bin $spu2_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o $spu2_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
if ![runto_main] then {
fail "Can't run to main"
return 0
}
gdb_test "continue" ".*Program received signal SIGABRT, Aborted.*"
gdb_test "backtrace" ".*abort.*crash_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu2_file.c.*<cross-architecture call>.*spe_context_run.*indirect_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu_file.c.*<cross-architecture call>.*spe_context_run.*spe_thread.*at.*$ppu_file.c.*"
for {set thread_id 2} {$thread_id < 7} {incr thread_id} {
gdb_test "t $thread_id" \
"Switching to thread $thread_id.*" \
"switch to thread $thread_id"
gdb_test "backtrace" \
".*crash_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu2_file.c.*<cross-architecture call>.*spe_context_run.*indirect_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu_file.c.*<cross-architecture call>.*spe_context_run.*spe_thread.*at.*$ppu_file.c.*" \
"backtrace in thread $thread_id"
}
gdb_exit
return 0

View File

@ -0,0 +1,30 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
#include <sys/syscall.h>
int
main (unsigned long long speid, unsigned long long argp,
unsigned long long envp)
{
__send_to_ppe (0x2112, 0, NULL);
return 0;
}

2246
gdb/testsuite/gdb.cell/configure vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
dnl Process this file file with autoconf to produce a configure script.
dnl This file is a shell script fragment that supplies the information
dnl necessary to tailor a template configure script into the configure
dnl script appropriate for this directory. For more information, check
dnl any existing configure script.
AC_PREREQ(2.59)
AC_INIT(arch.exp)
CC=${CC-cc}
AC_SUBST(CC)
AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../../..)
AC_CANONICAL_SYSTEM
AC_OUTPUT(Makefile)

View File

@ -0,0 +1,105 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# This testcases tests mixed-architecture core file support
load_lib cell.exp
set testfile "coremaker"
set ppu_file "coremaker"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "coremaker-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {![isnative]} then {
return 0
}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
# Run program to generate a core file -- see gdb.base/corefile.exp
set found 0
set coredir "${objdir}/${subdir}/coredir.[getpid]"
file mkdir $coredir
catch "system \"(cd ${coredir}; ulimit -c unlimited; ${ppu_bin}; true) >/dev/null 2>&1\""
set names [glob -nocomplain -directory $coredir core.*]
if {[llength $names] == 1} {
set corefile [file join $coredir [lindex $names 0]]
remote_exec build "mv $corefile ${objdir}/${subdir}/corefile"
set found 1
}
remote_exec build "rmdir $coredir"
if { $found == 0 } {
warning "can't generate a core file - core tests suppressed - check ulimit -c"
return 0
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
send_gdb "core-file $objdir/$subdir/corefile\n"
gdb_expect {
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "core-file command"
}
-re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "core-file command (with bad program name)"
}
-re ".*$gdb_prompt $" { fail "core-file command" }
timeout { fail "(timeout) core-file command" }
}
gdb_test "backtrace" ".*abort.*main.*at.*$ppu_file.c.*"
for {set thread_id 2} {$thread_id < 7} {incr thread_id} {
gdb_test "t $thread_id" \
"Switching to thread $thread_id.*" \
"switch to thread $thread_id"
gdb_test "backtrace" \
".*terminal_func.*factorial_func.*value=1.*factorial_func.*value=2.*factorial_func.*value=3.*factorial_func.*value=4.*factorial_func.*value=5.*factorial_func.*value=6.*main.*speid.*argp.*envp.*at.*$spu_file.c.*<cross-architecture call>.*spe_context_run.*spe_thread.*at.*$ppu_file.c.*" \
"backtrace in thread $thread_id"
}
gdb_exit
return 0

View File

@ -0,0 +1,46 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <spu_mfcio.h>
void
terminal_func ()
{
spu_write_out_intr_mbox (0);
spu_read_in_mbox ();
}
int
factorial_func (int value)
{
if (value > 1)
value *= factorial_func (value - 1);
terminal_func ();
return value;
}
int
main (unsigned long long speid, unsigned long long argp,
unsigned long long envp)
{
factorial_func (6);
return 0;
}

View File

@ -0,0 +1,63 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
#include <stdlib.h>
#include <libspe2.h>
#include <pthread.h>
#include <sys/wait.h>
extern spe_program_handle_t coremaker_spu;
#define nr_t 5
void *
spe_thread (void * arg)
{
int flags = 0;
unsigned int entry = SPE_DEFAULT_ENTRY;
spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg;
spe_program_load (*ctx, &coremaker_spu);
spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL);
pthread_exit (NULL);
}
int
main (void)
{
int thread_id[nr_t];
pthread_t pts[nr_t];
spe_context_ptr_t ctx[nr_t];
unsigned int value;
int cnt;
for (cnt = 0; cnt < nr_t; cnt++)
{
ctx[cnt] = spe_context_create (0, NULL);
thread_id[cnt]
= pthread_create (&pts[cnt], NULL, &spe_thread, &ctx[cnt]);
}
for (cnt = 0; cnt < nr_t; cnt++)
spe_out_intr_mbox_read (ctx[cnt], &value, 1, SPE_MBOX_ALL_BLOCKING);
abort ();
}

View File

@ -0,0 +1,36 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
int
main (unsigned long long speid, unsigned long long argp,
unsigned long long envp)
{
char var_char = 'c';
short var_short = 7;
int var_int = 1337;
long var_long = 123456;
long long var_longlong = 123456789;
float var_float = 1.23;
double var_double = 2.3456;
long double var_longdouble = 3.45678;
return 0; /* Marker SPU End */
}

View File

@ -0,0 +1,72 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
#include <libspe2.h>
#include <pthread.h>
#include <sys/wait.h>
extern spe_program_handle_t data_spu;
#define nr_t 1
void *
spe_thread (void *arg)
{
int flags = 0;
unsigned int entry = SPE_DEFAULT_ENTRY;
spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg;
spe_program_load (*ctx, &data_spu);
spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL);
pthread_exit (NULL);
}
int main (void)
{
int thread_id[nr_t];
pthread_t pts[nr_t];
spe_context_ptr_t ctx[nr_t];
int cnt;
char var_char = 'c';
short var_short = 7;
int var_int = 1337;
long var_long = 123456;
long long var_longlong = 123456789;
float var_float = 1.23;
double var_double = 2.3456;
long double var_longdouble = 3.45678;
for (cnt = 0; cnt < nr_t; cnt++)
{
ctx[cnt] = spe_context_create(0, NULL);
thread_id[cnt]
= pthread_create (&pts[cnt], NULL, &spe_thread, &ctx[cnt]);
}
for (cnt = 0; cnt < nr_t; cnt++)
pthread_join (pts[cnt], NULL);
for (cnt = 0; cnt < nr_t; cnt++)
spe_context_destroy (ctx[cnt]);
return 0;
}

View File

@ -0,0 +1,125 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# This testcases tries to read variables of each kind both on PPU and SPU.
load_lib cell.exp
set testfile "data"
set ppu_file "data"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "data-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
proc check_var { name value } {
gdb_test "print $name" \
".*=.*$value" \
"check_var $name = $value"
}
proc set_var { name value } {
gdb_test "set var $name = $value" \
"" \
"set var $name = $value"
}
proc dotest { name value } {
set_var $name $value
check_var $name $value
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
if ![runto_main] then {
fail "Can't run to main"
return 0
}
# Set values.
dotest var_char 'z'
dotest var_short 8
dotest var_int 321
dotest var_long 523442
dotest var_longlong 235354533
xfail "dotest var_float 33.2113"
xfail "dotest var_double 2.3456"
xfail "dotest var_longdouble 3.456789"
gdb_test "break 55" \
"Breakpoint.*at.*file.*$testfile.c, line 55.*" \
"set breakpoint"
gdb_test "continue" \
"Breakpoint.*at.*$testfile.c.*55.*" \
"continue to bp at line 55"
# Lookup variables.
check_var var_char 'c'
check_var var_short 7
check_var var_int 1337
check_var var_long 123456
check_var var_longlong 123456789
xfail "check_var var_float 1.23"
xfail "check_var var_double 2.3456"
xfail "check_var var_longdouble 3.456789"
cont_spu_main
c_to "Marker SPU End" $spu_file.c
# In SPU Thread, arch should now be spu:256K.
check_spu_arch ""
# Lookup variables.
check_var var_char 'c'
check_var var_short 7
check_var var_int 1337
check_var var_long 123456
check_var var_longlong 123456789
xfail "check_var var_float 1.23"
xfail "check_var var_double 2.3456"
xfail "check_var var_longdouble 3.456789"
gdb_exit
return 0

View File

@ -0,0 +1,41 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
#include <spu_mfcio.h>
__ea int *ppe_int_ptr;
int
main (unsigned long long speid, unsigned long long argp,
unsigned long long envp)
{
printf ("spe.c | argp = 0x%llx\n", argp);
#ifdef __EA32__
ppe_int_ptr = (__ea int *)(unsigned long)argp;
#else
ppe_int_ptr = (__ea int *)argp;
#endif
printf ("spe.c | value = %d\n", *ppe_int_ptr);
*ppe_int_ptr = 42; /* Marker SPUEA */
printf ("spe.c | value = %d\n", *ppe_int_ptr);
return 0;
}

View File

@ -0,0 +1,64 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
#include <libspe2.h>
#include <pthread.h>
#include <sys/wait.h>
extern spe_program_handle_t ea_cache_spu;
int int_var = 23;
void *
spe_thread (void *arg)
{
int flags = 0;
unsigned int entry = SPE_DEFAULT_ENTRY;
spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg;
spe_program_load (*ctx, &ea_cache_spu);
spe_context_run (*ctx, &entry, flags, &int_var, NULL, NULL);
pthread_exit (NULL);
}
int
main (void)
{
spe_context_ptr_t ctx;
pthread_t pts;
int thread_id;
printf ("ppe.c | int_var vor %d | adr int_var %p\n", int_var, &int_var);
/* Create SPE context and pthread. */
ctx = spe_context_create (0, NULL);
thread_id = pthread_create (&pts, NULL, &spe_thread, &ctx);
/* Join the pthread. */
pthread_join (pts, NULL);
/* Destroy the SPE context. */
spe_context_destroy (ctx);
printf ("ppe.c | int_var nach %d\n", int_var);
return 0;
}

View File

@ -0,0 +1,90 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# Testcase for ea software managed cache.
load_lib cell.exp
set ppu_file "ea-cache"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "ea-cache-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
if ![runto_main] then {
fail "Can't run to main"
return 0
}
# Set breakpoint in SPU binary.
cont_spu_main
c_to "Marker SPUEA" $spu_file.c
gdb_test "p *ppe_int_ptr" \
".*=.*23.*" \
"p *ppe_int_ptr"
gdb_test "set *ppe_int_ptr=42" "" ""
gdb_test "p *ppe_int_ptr" \
".*=.*42.*" \
"p *ppe_int_ptr"
# Now switch to thread 1 (PPU) and look at int_var. ppe_int_ptr points to
# int_var and should now also contain 42 (ea cache has been flushed).
gdb_test "t 1" \
".*Switching to thread 1.*" \
"Switch to thread 1"
gdb_test "p int_var" \
".*=.*42.*" \
"p int_var on ppu"
gdb_exit
return 0

View File

@ -0,0 +1,34 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
#include <ea.h>
int
main (unsigned long long speid, unsigned long long argp,
unsigned long long envp)
{
int a;
__ea int *myarray = malloc_ea (3 * sizeof (int));
memset_ea (myarray, 0, 3 * sizeof (int));
a = ++myarray[0]; /* Marker SPUEA1 */
printf("a: %d, myarray[0]: %d\n", a, myarray[0]); /* Marker SPUEA2 */
return 0;
}

View File

@ -0,0 +1,64 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# Testcase for ea software managed cache in a standalone binary.
load_lib cell.exp
set testfile "ea-standalone"
set srcfile ${srcdir}/${subdir}/${testfile}.c
set binary ${objdir}/${subdir}/${testfile}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $srcfile $binary executable {debug}] != "" } {
unsupported "Compile spu binary failed, so all tests in this file will automatically fail."
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binary}
if ![runto_main] then {
fail "Can't run to main"
return 0
}
c_to "Marker SPUEA1" $srcfile
gdb_test "p myarray\[0\]" \
".*= 0" \
"p myarray\[0\]"
c_to "Marker SPUEA2" $srcfile
gdb_test "p myarray\[0\]" \
".*= 1" \
"p myarray\[0\]"
gdb_test "call __cache_flush()" "" "call cache_flush()"
gdb_test "p myarray\[0\]" \
".*= 1" \
"p myarray\[0\]"
gdb_exit
return 0

View File

@ -0,0 +1,33 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
__ea int *ppe_pointer;
int *normal_pointer;
int
main (unsigned long long speid, unsigned long long argp,
unsigned long long envp)
{
static __ea int *local_ppe_pointer;
static int *local_normal_pointer;
return 0;
}

View File

@ -0,0 +1,124 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# Testcase for __ea pointer
load_lib cell.exp
set testfile "ea-test"
set source ${srcdir}/${subdir}/${testfile}.c
set binary ${objdir}/${subdir}/${testfile}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $source $binary executable {debug}] != "" } {
unsupported "Compile spu binary failed, so all tests in this file will automatically fail."
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binary}
if ![runto_main] then {
fail "Can't run to main"
return 0
}
# p
gdb_test "p ppe_pointer" \
"(int.*@__ea).*0x0.*" \
"p ppe_pointer"
gdb_test "p normal_pointer" \
"(int.*).*0x0.*" \
"p normal_pointer"
gdb_test "p local_ppe_pointer" \
"(int.*@__ea).*0x0.*" \
"p local_ppe_pointer"
gdb_test "p local_normal_pointer" \
"(int.*).*0x0.*" \
"p local_normal_pointer"
# ptype
gdb_test "ptype ppe_pointer" \
"type = int.*@__ea" \
"ptype ppe_pointer"
gdb_test "ptype normal_pointer" \
"type = int.*" \
"ptype normal_pointer"
gdb_test "ptype local_ppe_pointer" \
"type = int.*@__ea" \
"ptype local_ppe_pointer"
gdb_test "ptype local_normal_pointer" \
"type = int.*" \
"ptype local_normal_pointer"
# info locals
gdb_test "info locals" \
".*local_ppe_pointer =.*0x0.*local_normal_pointer =.*0x0.*" \
"info locals"
# p &
gdb_test "p &ppe_pointer" \
".*=.*(int.*@__ea.*).*0x.*" \
"p &ppe_pointer"
gdb_test "p &normal_pointer" \
".*=.*(int.*).*0x.*" \
"p &normal_pointer"
gdb_test "p &local_ppe_pointer" \
".*=.*(int.*@__ea.*).*0x.*" \
"p &local_ppe_pointer"
gdb_test "p &local_normal_pointer" \
".*=.*(int.*).*0x.*" \
"p &local_normal_pointer"
# ptype *
gdb_test "ptype *ppe_pointer" \
"type = int" \
"ptype *ppe_pointer"
gdb_test "ptype *normal_pointer" \
"type = int" \
"ptype *normal_pointer"
gdb_test "ptype *local_ppe_pointer" \
"type = int" \
"ptype *local_ppe_pointer"
gdb_test "ptype *local_normal_pointer" \
"type = int" \
"ptype *local_normal_pointer"
gdb_exit
return 0

View File

@ -0,0 +1,89 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# This testcase tests access to SPU vector registers while language is fortran.
load_lib cell.exp
set ppu_file "break"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "break-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
proc check_vector_regs {} {
for {set check_reg 0} {$check_reg < 128} {incr check_reg} {
gdb_test "p \$r$check_reg" \
"r$check_reg.*=.*\(.*\).*" \
"p \$r$check_reg"
gdb_test "ptype \$r$check_reg" \
"type = Type,.*C_Union :: __spu_builtin_type_vec128.*int128_t :: uint128.*int64_t :: v2_int64.*int32_t :: v4_int32\(.*\).*int16_t :: v8_int16\(.*\).*int8_t :: v16_int8\(.*\).*double :: v2_double\(.*\).*float :: v4_float\(.*\).*End Type __spu_builtin_type_vec128.*" \
"ptype \$r$check_reg"
}
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
# No programm running, no registers should be available.
gdb_test "info all-registers" \
"The program has no registers now." \
"info all-registers"
if ![runto_main] then {
fail "Can't run to main"
return 0
}
cont_spu_main
gdb_test "set language fortran" \
"Warning: the current language does not match this frame.*" \
"set language fortran"
check_vector_regs
gdb_exit
return 0

View File

@ -0,0 +1,117 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# This testcases tests mixed-architecture core file support
load_lib cell.exp
set testfile "coremaker"
set ppu_file "coremaker"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "coremaker-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {![isnative]} then {
return 0
}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
if ![runto_main] then {
fail "Can't run to main"
return 0
}
gdb_test "continue" ".*Aborted.*"
set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
"save a corefile" \
{
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
pass "save a corefile"
}
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
unsupported "save a corefile"
return -1
}
}
# Now restart gdb and load the corefile.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
send_gdb "core-file $objdir/$subdir/gcore.test\n"
gdb_expect {
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "core-file command"
}
-re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "core-file command (with bad program name)"
}
-re ".*$gdb_prompt $" { fail "core-file command" }
timeout { fail "(timeout) core-file command" }
}
gdb_test "t 6" "Switching to thread 6.*"
gdb_test "backtrace" ".*abort.*main.*at.*$ppu_file.c.*"
for {set thread_id 1} {$thread_id < 6} {incr thread_id} {
gdb_test "t $thread_id" \
"Switching to thread $thread_id.*" \
"switch to thread $thread_id"
gdb_test "backtrace" \
".*terminal_func.*factorial_func.*value=1.*factorial_func.*value=2.*factorial_func.*value=3.*factorial_func.*value=4.*factorial_func.*value=5.*factorial_func.*value=6.*main.*speid.*argp.*envp.*at.*$spu_file.c.*<cross-architecture call>.*spe_context_run.*spe_thread.*at.*$ppu_file.c.*" \
"backtrace in thread $thread_id"
}
gdb_exit
return 0

View File

@ -0,0 +1,36 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
int
main (unsigned long long speid, unsigned long long argp,
unsigned long long envp)
{
int i;
static int test_var;
printf ("Hello World! from spu\n");
test_var = 5;
i = 5; /* Marker SPUEA */
printf ("i = %d\n", i);
return 0;
}

View File

@ -0,0 +1,67 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
#include <libspe2.h>
#include <pthread.h>
#include <sys/wait.h>
extern spe_program_handle_t mem_access_spu;
#define nr_t 1
void *
spe_thread (void *arg)
{
int flags = 0;
unsigned int entry = SPE_DEFAULT_ENTRY;
spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg;
spe_program_load (*ctx, &mem_access_spu);
spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL);
pthread_exit (NULL);
}
int
main (void)
{
int thread_id[nr_t];
pthread_t pts[nr_t];
spe_context_ptr_t ctx[nr_t];
int value = 1;
int cnt;
static int test_var;
test_var = 5;
for (cnt = 0; cnt < nr_t; cnt++) /* Marker PPUEA */
{
ctx[cnt] = spe_context_create (0, NULL);
thread_id[cnt]
= pthread_create (&pts[cnt], NULL, &spe_thread, &ctx[cnt]);
}
for (cnt = 0; cnt < nr_t; cnt++)
pthread_join (pts[cnt], NULL);
for (cnt = 0; cnt < nr_t; cnt++)
spe_context_destroy (ctx[cnt]);
return 0;
}

View File

@ -0,0 +1,170 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# This testcases tests on PPU and SPU if variables and registers are accessible
# via print and set by using names and adresses.
load_lib cell.exp
set ppu_file "mem-access"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "mem-access-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
# Get the adress to symbol name. If $reg
# is set to 1, get address from a register.
proc get_adress_from_name { name reg } {
global gdb_prompt
set adr ""
if { $reg == 1 } {
set q "x/x $name"
} else {
set q "x/x &$name"
}
gdb_test_multiple $q "get address from $name" {
-re "(0x.....):.*$gdb_prompt $" { # Registers.
set adr $expect_out(1,string)
pass "get adress from $name = $adr"
}
-re "(0x........) <.*$gdb_prompt $" { # PPU address.
set adr $expect_out(1,string)
pass "get adress from $name = $adr"
}
-re "(0x....) <.*$gdb_prompt $" { # SPU address.
set adr $expect_out(1,string)
pass "get adress from $name = $adr"
}
-re "(0x...) <.*$gdb_prompt $" { # SPU address.
set adr $expect_out(1,string)
pass "get adress from $name = $adr"
}
}
return ${adr}
}
# Try to set a $value at adress $adr.
proc set_adr_content { adr value } {
gdb_test "set *$adr=$value" \
"" \
"set *$adr=$value"
}
# Try to set a $value for $symbol.
proc set_symbol_content { symbol value } {
gdb_test "set $symbol=$value" \
"" \
"set *$symbol=$value"
}
# Check if $value is at *adr
proc test_adr_content { adr value } {
gdb_test "p *$adr" \
".*=.*$value.*" \
"(ptr) *$adr==$value"
}
proc test_symbol_content { symbol value } {
gdb_test "p $symbol" \
".*=.*$value.*" \
"(symbol) $symbol==$value"
}
# Check VARNAME. Check if it has the inital
# value INITIALVALUE. Set it to NEWVALUE.
# Check if set properly. Do it via symbols and
# pointers.
proc check_var { varname initalvalue newvalue } {
# Initial value should be $initalvalue.
test_symbol_content $varname $initalvalue
# Get pointer to symbol and check if the
# initial value is found.
set adr [get_adress_from_name $varname 0]
test_adr_content $adr $initalvalue
# Re-set value using the pointer.
set_adr_content $adr $newvalue
# Test values by pointer and by symbol.
test_adr_content $adr $newvalue
test_symbol_content $varname $newvalue
# Set value back to initalvalue using symbol
# name and check it.
set_symbol_content $varname $initalvalue
test_adr_content $adr $initalvalue
test_symbol_content $varname $initalvalue
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
if ![runto_main] then {
fail "Can't run to main"
return 0
}
# Check in PPU thread.
c_to "Marker PPUEA" $ppu_file.c
check_var "test_var" 5 7
# Go to SPU thread.
cont_spu_main
c_to "Marker SPUEA" $spu_file.c
check_spu_arch ""
# Check in SPU thread.
check_var "test_var" 5 7
# Check $sp register.
set adr [get_adress_from_name "\$sp" 1]
set_adr_content $adr 8
test_adr_content $adr 8
gdb_exit
return 0

View File

@ -0,0 +1,145 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# Test ptype and print/set of SPU-side registers.
load_lib cell.exp
set ppu_file "break"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "break-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
if ![runto_main] then {
fail "Can't run to main"
return 0
}
# Continue to SPU
cont_spu_main
gdb_test "info registers r2" \
"r2.*\{uint128 =.*v2_int64 =.*v4_int32 =.*v8_int16 =.*v16_int8 =.*v2_double =.*v4_float =.*\}.*" \
"info registers r2"
for {set check_reg 10} {$check_reg < 12} {incr check_reg} {
gdb_test "print \$r$check_reg\.v4_int32" \
".*= \{.*,.*,.*,.*\}" \
"print \$r$check_reg\.v4_int32"
gdb_test "ptype \$r$check_reg" \
"type = union __spu_builtin_type_vec128.*\{.*int128_t uint128.* \
int64_t v2_int64.*int32_t v4_int32.*int16_t v8_int16.* \
int8_t v16_int8.*double v2_double.*float v4_float.*\}" \
"ptype \$r$check_reg"
gdb_test "set \$r$check_reg\.v4_int32 = {1,2,3,4}" \
"" \
"set \$r$check_reg\.v4_int32 = {1,2,3,4}"
gdb_test "print \$r$check_reg\.v4_int32" \
".*= \{.*1, 2, 3, 4.*\}" \
"print \$r$check_reg\.v4_int32"
gdb_test "print \$r$check_reg.v4_int32\[0\]" \
".*= 1.*" \
"print \$r$check_reg.v4_int32\[0\]"
gdb_test "print \$r$check_reg.v4_int32\[1\]" \
".*= 2.*" \
"print \$r$check_reg.v4_int32\[1\]"
gdb_test "print \$r$check_reg.v4_int32\[2\]" \
".*= 3.*" \
"print \$r$check_reg.v4_int32\[2\]"
gdb_test "print \$r$check_reg.v4_int32\[3\]" \
".*= 4.*" \
"print \$r$check_reg.v4_int32\[3\]"
gdb_test "print \$r$check_reg.v4_int32\[4\]" \
"no such vector element" \
"print \$r$check_reg.v4_int32\[4\]"
# Set single array elements to other values and check the results.
gdb_test "set \$r$check_reg\.v4_int32\[0\] = 5" \
"" \
"set \$r$check_reg\.v4_int32\[0\] = 5"
gdb_test "print \$r$check_reg.v4_int32\[0\]" \
".*= 5.*" \
"print \$r$check_reg.v4_int32\[0\]"
gdb_test "set \$r$check_reg\.v4_int32\[1\] = 6" \
"" \
"set \$r$check_reg\.v4_int32\[1\] = 6"
gdb_test "print \$r$check_reg.v4_int32\[1\]" \
".*= 6.*" \
"print \$r$check_reg.v4_int32\[1\]"
gdb_test "set \$r$check_reg\.v4_int32\[2\] = 7" \
"" \
"set \$r$check_reg\.v4_int32\[2\] = 7"
gdb_test "print \$r$check_reg.v4_int32\[2\]" \
".*= 7.*" \
"print \$r$check_reg.v4_int32\[2\]"
gdb_test "set \$r$check_reg\.v4_int32\[3\] = 8" \
"" \
"set \$r$check_reg\.v4_int32\[3\] = 8"
gdb_test "print \$r$check_reg.v4_int32\[3\]" \
".*= 8.*" \
"print \$r$check_reg.v4_int32\[3\]"
# Now there should be {5, 6, 7, 8} in that array.
gdb_test "print \$r$check_reg\.v4_int32" \
".*= \{.*5, 6, 7, 8.*\}" \
"print \$r$check_reg\.v4_int32"
}
gdb_exit
return 0

View File

@ -0,0 +1,106 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# This testcase tests registers on PPU and SPU.
load_lib cell.exp
set ppu_file "break"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "break-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
# No programm running, no registers should be available.
gdb_test "info all-registers" \
"The program has no registers now." \
"info all-registers"
if ![runto_main] then {
fail "Can't run to main"
return 0
}
# Check registers in PPU thread.
gdb_test "info reg r0" "r0.*" "info register r0"
gdb_test "info reg r31" "r31.*" "info register r31"
gdb_test "info reg r32" "Invalid register.*r32.*" "(invalid) info register r32"
gdb_test "info reg pc" "pc.*" "info register pc"
gdb_test "info reg cr" "cr.*" "info register cr"
gdb_test "info reg lr" "lr.*" "info register lr"
gdb_test "info reg ctr" "ctr.*" "info register ctr"
gdb_test "info reg xer" "xer.*" "info register xer"
# Continue to SPU thread.
cont_spu_main
# In SPU thread, check SPU registers.
for {set check_reg 0} {$check_reg < 128} {incr check_reg} {
gdb_test "info reg r$check_reg" \
"r$check_reg.*uint128.*=.*v2\_int64.*v4\_int32.*v8\_int16.*v16\_int8.*v2\_double.*v4\_float.*" \
"info register r$check_reg"
}
gdb_test "info reg r128" \
"Invalid register.*r128.*" \
"(invalid) info register r128"
gdb_test "info reg pc" "pc.*main.*" "info register pc"
gdb_test "info reg id" "id.*" "info register id"
gdb_test "info reg sp" "sp.*" "info register sp"
gdb_test "info reg fpscr" "fpscr.*" "info register fpscr"
gdb_test "info reg srr0" "srr0.*" "info register srr0"
gdb_test "info reg lslr" "lslr.*" "info register lslr"
gdb_test "info reg decr" "decr.*" "info register decr"
gdb_test "info reg decr_status" "decr_status.*" "info register decr-status"
gdb_test "info reg cr" "Invalid register.*cr.*" "info register cr"
gdb_test "info reg lr" "Invalid register.*lr.*" "info register lr"
gdb_test "info reg ctr" "Invalid register.*ctr.*" "info register ctr"
gdb_test "info reg xer" "Invalid register.*xer.*" "info register xer"
gdb_exit
return 0

View File

@ -0,0 +1,53 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
int
main (unsigned long long speid, unsigned long long argp,
unsigned long long envp)
{
int c = sizeof (char); /* Break here. */
printf ("sizeof(char)=%d\n", c);
int s = sizeof (short);
printf ("sizeof(short)=%d\n", s);
int i = sizeof (int);
printf ("sizeof(int)=%d\n", i);
int l = sizeof (long);
printf ("sizeof(long)=%d\n", l);
int ll = sizeof (long long);
printf ("sizeof(long long)=%d\n", ll);
int f = sizeof (float);
printf ("sizeof(float)=%d\n", f);
int d = sizeof (double);
printf ("sizeof(double)=%d\n", d);
int ld = sizeof (long double);
printf ("sizeof(long double)=%d\n", ld);
return 0;
}

View File

@ -0,0 +1,87 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009 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 <http://www.gnu.org/licenses/>.
Contributed by Markus Deuling <deuling@de.ibm.com> */
#include <stdio.h>
#include <libspe2.h>
#include <pthread.h>
#include <sys/wait.h>
extern spe_program_handle_t size_spu;
#define nr_t 1
void *
spe_thread (void *arg)
{
int flags = 0;
unsigned int entry = SPE_DEFAULT_ENTRY;
spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg;
spe_program_load (*ctx, &size_spu);
spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL);
pthread_exit (NULL);
}
int
main (void)
{
int thread_id[nr_t];
pthread_t pts[nr_t];
spe_context_ptr_t ctx[nr_t];
int cnt;
int c = sizeof (char);
printf ("sizeof(char)=%d\n", c);
int s = sizeof (short);
printf ("sizeof(short)=%d\n", s);
int i = sizeof (int);
printf ("sizeof(int)=%d\n", i);
int l = sizeof (long);
printf ("sizeof(long)=%d\n", l);
int ll = sizeof (long long);
printf ("sizeof(long long)=%d\n", ll);
int f = sizeof (float);
printf ("sizeof(float)=%d\n", f);
int d = sizeof (double);
printf ("sizeof(double)=%d\n", d);
int ld = sizeof (long double);
printf ("sizeof(long double)=%d\n", ld);
for (cnt = 0; cnt < nr_t; cnt++)
{
ctx[cnt] = spe_context_create (0, NULL);
thread_id[cnt]
= pthread_create (&pts[cnt], NULL, &spe_thread, &ctx[cnt]);
}
for (cnt = 0; cnt < nr_t; cnt++)
pthread_join (pts[cnt], NULL);
for (cnt = 0; cnt < nr_t; cnt++)
spe_context_destroy (ctx[cnt]);
return 0;
}

View File

@ -0,0 +1,120 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# Check size of data types both on PPU and SPU.
load_lib cell.exp
set ppu_file "size"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "size-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
# Ask GDB about the sizes of data types. This has
# to be done in PPU thread and SPU thread.
proc get_gdb_size { type } {
global gdb_prompt
set val "0"
gdb_test_multiple "print/d sizeof(${type})" "get sizeof(${type})" {
-re "\\$\[0-9\]* = (\[-\]*\[0-9\]*).*$gdb_prompt $" {
set val $expect_out(1,string)
pass "get sizeof ($type) = $val"
}
}
return ${val}
}
# Compare sizes from GDB and sizeof().
proc size_compare { type gdb_size } {
set expr [string_to_regexp "sizeof(${type})=${gdb_size}"]
gdb_test "next" \
".*" \
"next"
# Checks against string_to_regexp fails in remote testing.
if ![is_remote target] {
gdb_test "next" \
"${expr}.*" \
"check sizeof \"$type\" \"$gdb_size\" "
} else {
gdb_test "next" ".*" "check sizeof deactivate in remote testing"
}
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
if ![runto_main] then {
fail "Can't run to main"
return 0
}
# Compare sizes.
size_compare "char" [get_gdb_size "char"]
size_compare "short" [get_gdb_size "short"]
size_compare "int" [get_gdb_size "int"]
size_compare "long" [get_gdb_size "long"]
size_compare "long long" [get_gdb_size "long long"]
size_compare "float" [get_gdb_size "float"]
size_compare "double" [get_gdb_size "double"]
size_compare "long double" [get_gdb_size "long double"]
# Continue to SPU thread.
cont_spu_main
check_spu_arch ""
# Compare sizes in SPU thread.
size_compare "char" [get_gdb_size "char"]
size_compare "short" [get_gdb_size "short"]
size_compare "int" [get_gdb_size "int"]
size_compare "long" [get_gdb_size "long"]
size_compare "long long" [get_gdb_size "long long"]
size_compare "float" [get_gdb_size "float"]
size_compare "double" [get_gdb_size "double"]
size_compare "long double" [get_gdb_size "long double"]
gdb_exit
return 0

View File

@ -0,0 +1,80 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# Testcase for multiple symbol disambiguation patch.
load_lib cell.exp
set ppu_file "break"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "break-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
if ![runto_main] then {
fail "Can't run to main"
return 0
}
# Breakpoint resolved in PPU thread.
gdb_test "break foo" \
"Breakpoint.*file.*$ppu_file.c.*" \
"br foo in break"
# Continue to SPU
cont_spu_main
check_spu_arch ""
# Breakpoint resolved in SPU thread.
delete_breakpoints
gdb_test "break foo" \
"Breakpoint.*file.*$spu_file.c.*" \
"br foo in $spu_file.c"
gdb_exit
return 0

View File

@ -0,0 +1,86 @@
# Copyright 2009 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 <http://www.gnu.org/licenses/>.
#
# Contributed by Markus Deuling <deuling@de.ibm.com>.
#
# Testsuite for Cell Broadband Engine combined debugger
# This testcase checks 'info sharedlibrary ' command.
load_lib cell.exp
set ppu_file "break"
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
set ppu_bin ${objdir}/${subdir}/${ppu_file}
set spu_file "break-spu"
set spu_src ${srcdir}/${subdir}/${spu_file}.c
set spu_bin ${objdir}/${subdir}/${spu_file}
if {[skip_cell_tests]} {
return 0
}
# Compile SPU binary.
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
unsupported "Compiling spu binary failed."
return -1
}
# Compile PPU binary.
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
unsupported "Embedding spu binary failed."
return -1
}
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
unsupported "Compiling ppu binary failed."
return -1
}
if [get_compiler_info ${ppu_bin}] {
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${ppu_bin}
# No programm running, no libraries should be loaded.
gdb_test "info sharedlibrary" \
"No shared libraries loaded at this time." \
"no shared library is loaded"
if ![runto_main] then {
fail "Can't run to main"
return 0
}
# Standing in PPU thread, now some libs should be loaded
# including libspe library.
gdb_test "info sharedlibrary" \
"From.*To.*Syms Read.*Shared Object Library.*libspe.*" \
"binary started, some libraries loaded"
# Continue to SPU
cont_spu_main
check_spu_arch ""
# In SPU thread now, the SPU binary should now appear in the list
# of shared libraries.
gdb_test "info sharedlibrary" \
"From.*To.*Syms Read.*Shared Object Library.*libspe.*$spu_bin.*@.*x.*" \
"spu thread, spu binary as shared library"
gdb_exit
return 0