summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/psim/tools/psim-gdb-bottom
blob: 4e030e5ccd16156669d288d252beff100ac5ae0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
progname=${0##*/} # fast basename hack for ksh, bash

USAGE=\
"usage: $progname [ -opts ] [prog]
	-s  -- force System V IPC support on (default=auto)
	-n  -- enable NIC support ***REQUIRES PATCHED GDB/PSIM***
	-h  -- this message
"

# Recognize special argument to force System V IPC support on
use_sysv_ipc="auto"
enable_if_sim=""

## TODO: may want command line ability to turn on some psim tracing
while getopts snh OPT
do
	case "$OPT" in
	s) use_sysv_ipc="yes";;
	n) enable_if_sim="yes";;
	h) echo "$USAGE"; exit 0;;
	*) echo "unknown option"; echo "$USAGE"; exit 0;;
	esac
done
shiftcount=`expr $OPTIND - 1`
shift $shiftcount

args=$*

if [ X${1} = "X-psim_sysv" ] ; then
  use_sysv_ipc="yes"
  shift
fi

## Generate the GDB Command Script
gen_gdb_script()
{
  echo "tar sim -f ${TREE_FILE}"
  echo "load"
  echo "b _Internal_error_Occurred"
  echo "b rtems_fatal_error_occurred"
  echo "b __assert_func"
  echo "b C_exception_handler"
  echo "printf \"Use run to start the RTEMS application\\n\""
}

if [ X${GDB} = X ] ; then
	GDB=${rtemsTarget}-gdb
fi

gen_device_tree ${1} >${TREE_FILE}
gen_gdb_script       >${GDB_FILE}

${GDB} -x ${GDB_FILE} $*

rm -f ${GDB_FILE} ${TREEFILE}
exit $?