Newer
Older
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
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# a shell script to run in the Qemu PC emulator an eCos
# application that's been built with "Grub" startup mode.
#
# It runs Qemu with a
# single serial port connected to a telnet
# server socket.
#
# An instance of the "xterm" X11 terminal emulator is started with
# telnet command to connect to that virtual serial port on port
#
# When $2 is 'ddd' a debugger window is opened accordingly
PORTFILENAME=/tmp/$USER.portnum
@STARTUP_SCRIPTS@/findport.pl > $PORTFILENAME
PORTNUM=`head -n 1 /tmp/$USER.portnum`
SERIALPORTNUM=`tail -n 1 /tmp/$USER.portnum`
GDB_BIN=gdb
GDB_TUI_BIN=gdbtui
TERMINAL=urxvt
BINARY="$1"
echo $PWD
echo "target remote :$PORTNUM" > .gdbinit
echo "br cyg_user_start" >> .gdbinit
if [[ $1 == "ddd" ]] || [[ $1 == "gdb" ]] || [[ $1 == "cgdb" ]]; then
DEBUG="-s -S -gdb tcp::$PORTNUM"
fi
XTERMEXE="telnet localhost $SERIALPORTNUM"
# start a terminal that will telnet to the virtual machine's serial port
(sleep 0.5; $TERMINAL -geometry 120x80 -title "eCos Serial 0" -name "eCos Serial 0" -e $XTERMEXE )&
sleep 0.5
# start ddd Debugger
if [[ "$2" == "ddd" ]]; then
(sleep 0.5; $TERMINAL -e ddd --command .gdbinit --gdb --debugger $GDB_BIN $BINARY ) &
fi
# start GDB in xterm terminal
if [[ "$2" == "gdb" ]]; then
(sleep 0.5; $TERMINAL -e $GDB_BIN $BINARY ) &
fi
# start GDBTUI in xterm terminal
if [[ "$2" == "gdbtui" ]]; then
(sleep 0.5; $TERMINAL -e $GDB_TUI_BIN $BINARY ) &
fi
# start cgdb in xterm terminal
if [[ "$2" == "cgdb" ]]; then
(sleep 0.5; $TERMINAL -e cgdb $BINARY ) &
fi
# MACHINE=$(gcc -dumpmachine|cut -f1 -d-)
# if [[ $MACHINE == "x86_64" ]]; then
# BITS="64"
# else
# BITS="32"
# fi
qemu-system-i386 -machine pc,accel=tcg \
$DEBUG \
-kernel $BINARY \
-serial telnet:localhost:$SERIALPORTNUM,server,nowait