-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathgdbterm
executable file
·46 lines (39 loc) · 1.79 KB
/
gdbterm
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
#!/bin/bash -e
##############################################################################
# #
# Copyright (C) 2022 MachineWare GmbH #
# All Rights Reserved #
# #
# This is work is licensed under the terms described in the LICENSE file #
# found in the root directory of this source tree. #
# #
##############################################################################
gdb="gdb-multiarch"
term="xterm"
# check if gdb and xterm can be found
$gdb -v >/dev/null 2>&1 || { echo >&2 "$gdb not found, aborting."; exit 1; }
$term -v >/dev/null 2>&1 || { echo >&2 "$term not found, aborting."; exit 1; }
name="" # Name of the processor to connect to
host="" # Simulation host
port="" # Port to use for the GDB remote serial protocol
syms="" # Location(s) of the symbol file(s)
# parse command line
while getopts "n:h:p:s:" opt; do
case "$opt" in
n) name="$OPTARG" ;;
h) host="$OPTARG" ;;
p) port="$OPTARG" ;;
s) syms="$syms $OPTARG" ;;
?) echo "Usage $(basename $0) [-n name] [-h host] [-p port] [-s syms]"
exit 1
esac
done
test "$name" != "" || { echo >&2 "cpu name cannot be empty"; exit 1; }
test "$port" != "" || { echo >&2 "gdb port not specified"; exit 1; }
args="--nx -ex=\"set confirm off\""
for s in $syms; do
args="$args -ex=\"add-symbol-file $s\""
done
args="$args -ex=\"set confirm on\""
args="$args -ex=\"target remote $host:$port\""
$term -fa 'Monospace' -fs 12 -T "$name" -e "$gdb $args" &