source: rtems-testing/sim-scripts/gdb-sim.in @ 3a7a4df

4.11
Last change on this file since 3a7a4df was fa9697c, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 16, 2009 at 7:47:32 PM

2009-09-16 Joel Sherrill <joel.sherrill@…>

  • gdb-sim-run.in: Rerun when coverage enabled and a zero-length coverage file is produced.
  • gdb-sim.in: Spacing.
  • skyeye-support: Disable stty sane on abort.
  • Property mode set to 100755
File size: 3.1 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"
96bspSupportsLCD="no"
97bspSupportsTCPIP="no"
98
99###################################################################
100###################################################################
101###################################################################
102##INSERT BSP SUPPORT HERE
103###################################################################
104###################################################################
105###################################################################
106
107## Some BSPs must generate device trees to provide to the simulator
108if [ ${bspGeneratesDeviceTree} = "yes" ] ; then
109  TREE_FILE=@BSP@_tree.${LOGNAME}
110  bspGenerateDeviceTree ${baseToRun} >${TREE_FILE}
111fi
112
113### generate bsp specific load command
114if [ ${bspGeneratesGDBCommands} = "no" ] ; then
115  cat <<EOF
116tar sim
117load
118EOF
119else
120  bspGenerateGDBCommands
121fi >@BSP@-cmds
122
123###  Add CPU specific commands
124case @CPU_TARGET@ in
125  *powerpc*) echo  "b C_exception_handler" ;;
126  *)       ;;
127esac >>@BSP@-cmds
128
129###  Add generic commands which break on known bad places
130cat >>@BSP@-cmds <<EOF
131b _Internal_error_Occurred
132b rtems_fatal_error_occurred
133b __assert
134printf "Use run to start the RTEMS application\\n"
135EOF
136
137### Now source the rtems gdb
138vfile=`dirname $0`/rtems-gdb-macros-${v}
139if [ ! -r ${vfile} ] ; then
140  echo WARNING!!! RTEMS GDB Macro files not found
141else
142  echo "source ${vfile}" >>@BSP@-cmds
143fi
144
145${GDB} --command=@BSP@-cmds $*
146
147if [ ${bspGeneratesDeviceTree} = "yes" ] ; then
148  rm -f @BSP@_tree.${LOGNAME}
149fi
150test_exit $?
Note: See TracBrowser for help on using the repository browser.