-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgdbEmacs
executable file
·52 lines (47 loc) · 2.1 KB
/
gdbEmacs
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
#!/bin/bash
if [ $# -eq 1 ]
then
if [ $1 == "-h" ]
then
echo
echo "Usage: gdbEmacs <targetProgram>"
echo
exit
fi
else
echo
echo "Usage: gdbEmacs <targetProgram>"
echo
exit
fi
export GDK_NATIVE_WINDOWS=1
targetProgram=$1
# change this to include a full path if the timer hooks file is in a
# different directory than the current directory
timerHooksFile=./timerHooks
# use this for emacs23, emacs23 is recommended because it does not use the -i=mi machine interface option
# so the GUI based program control uses the normal GDB commands, which will work with the all the timer hooks
gdbEmacs23() { emacs23 -bg white -g 220x50 --eval "(gdb \"gdb --annotate=3 ${targetProgram} -x ${timerHooksFile} --cd=`pwd`\")" > /dev/null 2>&1 & }
# if you are not using emacs23, the -i=mi machine interface option must be used, unfortunatley, when
# using the mi mode, the GUI based program control will not use the standard console based GDB commands,
# e.g. instead of using 'continue', '-exec-continue' will be used, the GDB callback hooks that are used
# for timer management/adjustment will not work with the 'mi' based commands, if using this emacs version,
# you must type in the standard GDB commands from the GDB prompt command sub-window
gdbEmacs() { emacs -bg white -g 220x50 --eval "(gdb \"gdb -i=mi ${targetProgram} -x ${timerHooksFile} --cd=`pwd`\")" > /dev/null 2>&1 & }
# run the version of emacs that is installed on our system, emacs23 is recommended,
# but if not available, just run 'gdbEmacs'
if hash emacs23 2>/dev/null
then
echo "Starting emacs23 in GDB/GUD mode"
gdbEmacs23
elif hash emacs 2>/dev/null
then
echo "Starting emacs in GDB/GUD mode, note, do not use GUI buttons for program control"
echo "Use gdb commands directly in gdb sub-window, see included README for full details"
echo "Install emacs23 for full GUI based program control capability"
echo "Example install for Ubuntu based systems: 'sudo apt-get install emacs23'"
gdbEmacs
else
echo "Emacs not found, install emacs (preferably emacs23)"
echo "Example install for Ubuntu based systems: 'sudo apt-get install emacs23'"
fi