This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Doubt turning GDB commands into bash script


Hello all,

I'm trying to write a bash script that can handle my usage of (K)GDB.
It starts kdmx on one GNOME terminal, and then starts minicom on a
second terminal, and GDB on a third one. So far, so (more or less)
good. The thing goes tricky of course, when, after launching and
setting kdmx, minicom and GDB, I'll have to start and stop KGDB
execution many times, which means I will be sending "echo g >
/proc/sysrq-trigger" commands through minicom, perform some debugging
with GDB, send "cont" with GDB to resume execution, stop again,
perform some GDB commands, resume again, etc (the loop goes on). This
is achievable through a bash script? How can I specify that one
command goes to minicom and another one to KGDB? I understand that
maybe this doubt may not have to do with (K)GDB explicitly and is more
about bash scripting, but maybe there is some (K)GDB feature that I
don't know. I've been in the docs but haven't found anything on this.
My script goes below.

1. My bash script so far:

#!/bin/bash

cd /home/cloud/Desktop/Downloads/kdmx/
./kdmx -n -d -p/dev/ttyS0 -b115200 &
sleep 5
gnome-terminal --window-with-profile=KGDB -e "minicom -o -w -p
/dev/pts/1 -S /home/cloud/Desktop/minicom.txt"
gnome-terminal --window-with-profile=KGDB -e cd
/home/cloud/Desktop/linux-2.6.32.4/
gdb -write /home/cloud/Desktop/vmlinux -x /home/cloud/Desktop/script.gdb

2. minicom.txt:

send <username>
send <password>
send su
send <root_password>
send echo g > /proc/sysrq-trigger

3. script.gdb:

set remotebaud 115200
target remote /dev/pts/2
set debug remote 1
info reg $es
cont

Regards,
JoÃo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]