source: rtems-testing/sim-scripts/gdb-sim.in @ 33a3fc7

4.11
Last change on this file since 33a3fc7 was 33a3fc7, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 13, 2009 at 9:24:46 PM

2009-08-13 Joel Sherrill <joel.sherrill@…>

  • Makefile, gdb-sim-run.in, gdb-sim.in, mkrun, skyeye-support, tsim-support: GDB now works with tsim and skyeye simulator BSPs.
  • Property mode set to 100755
File size: 2.8 KB
Line 
1#! /bin/sh
2#
3#  Framework script tailored for the @CPU@/@BSP@
4#
5#  NOTE: If the does not have the name of a specific CPU/BSP pair, then
6#        this is the source file.  If it does have specific CPU/BSP pair,
7#        then this is generated output and should NOT be edited.
8#
9#  $Id$
10#
11
12trap "test_exit 1" 1 2 3 13 14 15
13
14inGDBScript=yes
15
16progname=${0##*/}        # fast basename hack for ksh, bash
17
18USAGE=\
19"usage: $progname [ -opts ] test
20        -i         -- interactive (default=no time limit)
21
22System V IPC and Coverage are not supported by all BSPs or simulators.
23"
24
25for v in 4.10 4.9 4.8 4.7 ""
26do
27  type @CPU_TARGET@-rtems${v}-gdb >/dev/null 2>&1
28  if [ $? -eq 0 ] ; then
29    GDB=@CPU_TARGET@-rtems${v}-gdb
30    break
31  fi
32done
33
34if [ X${GDB} = X ] ; then
35  echo "Unable to find a GDB for @CPU_TARGET@ along your PATH"
36  exit 1
37fi
38
39test_exit()
40{
41  exit_code=$1
42  rm -f @BSP@-cmds
43  exit $exit_code
44}
45
46#   log an error to stderr
47prerr()
48{
49    echo "$*" >&2
50}
51
52fatal() {
53    [ "$1" ] && prerr $*
54    prerr "$USAGE"
55    exit 1
56}
57
58warn() {
59    [ "$1" ] && prerr $*
60}
61
62check_status()
63{
64  if [ $1 -ne 0 ] ; then
65    shift
66    echo "FAILED: " "$*" >&2
67    test_exit 1
68  fi
69}
70
71type ${runBSP}
72check_status $? "Path appears to be broken (cannot find ${runBSP})"
73
74if [ $# -eq 0 ] ; then
75  echo "No arguments .. no executable specified"
76  exit 1
77fi
78
79use_sysv_ipc="no"
80while getopts s OPT
81do
82 case "$OPT" in
83   s) use_sysv_ipc="yes";;
84   *) ;;
85 esac
86done
87
88shiftcount=`expr $OPTIND - 1`
89shift $shiftcount
90
91args=$*
92
93### Set BSP defaults.  If BSP does not have default, it will override
94bspGeneratesGDBCommands="no"
95bspGeneratesDeviceTree="no"
96
97###################################################################
98###################################################################
99###################################################################
100##INSERT BSP SUPPORT HERE
101###################################################################
102###################################################################
103###################################################################
104
105## Some BSPs must generate device trees to provide to the simulator
106if [ ${bspGeneratesDeviceTree} = "yes" ] ; then
107  TREE_FILE=@BSP@_tree.${LOGNAME}
108  bspGenerateDeviceTree ${baseToRun} >${TREE_FILE}
109fi
110
111### generate bsp specific load command
112if [ ${bspGeneratesGDBCommands} = "no" ] ; then
113  cat <<EOF
114tar sim
115load
116EOF
117else
118  bspGenerateGDBCommands
119fi >@BSP@-cmds
120
121###  Add CPU specific commands
122case @CPU_TARGET@ in
123  *powerpc*) echo  "b C_exception_handler" ;;
124  *)       ;;
125esac >>@BSP@-cmds
126
127###  Add generic commands which break on known bad places
128cat >>@BSP@-cmds <<EOF
129b _Internal_error_Occurred
130b rtems_fatal_error_occurred
131b __assert
132printf "Use run to start the RTEMS application\\n"
133EOF
134
135${GDB} --command=@BSP@-cmds $*
136
137if [ ${bspGeneratesDeviceTree} = "yes" ] ; then
138  rm -f @BSP@_tree.${LOGNAME}
139fi
140test_exit $?
Note: See TracBrowser for help on using the repository browser.