From: joaoandreferro@sapo.pt
To: gdb@sourceware.org
Subject: Doubt turning GDB commands into bash script
Date: Wed, 05 Nov 2014 17:37:00 -0000 [thread overview]
Message-ID: <20141105173707.Horde.YLsQWojsKNRsa4xuaCdSiA1@mail.sapo.pt> (raw)
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
next reply other threads:[~2014-11-05 17:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-05 17:37 joaoandreferro [this message]
2014-11-06 18:23 ` joaoandreferro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141105173707.Horde.YLsQWojsKNRsa4xuaCdSiA1@mail.sapo.pt \
--to=joaoandreferro@sapo.pt \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox