* Doubt turning GDB commands into bash script
@ 2014-11-05 17:37 joaoandreferro
2014-11-06 18:23 ` joaoandreferro
0 siblings, 1 reply; 2+ messages in thread
From: joaoandreferro @ 2014-11-05 17:37 UTC (permalink / raw)
To: gdb
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Doubt turning GDB commands into bash script
2014-11-05 17:37 Doubt turning GDB commands into bash script joaoandreferro
@ 2014-11-06 18:23 ` joaoandreferro
0 siblings, 0 replies; 2+ messages in thread
From: joaoandreferro @ 2014-11-06 18:23 UTC (permalink / raw)
To: gdb
It seems that what I need is here:
http://www.humbug.in/2010/utility-to-send-commands-or-data-to-other-terminals-ttypts/
I understand now the silliness of the original question, my ignorance
on bash scripting put me searching for something on (K)GDB that has
nothing to do with it.
Regards,
João
Citando joaoandreferro@sapo.pt:
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-06 18:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-05 17:37 Doubt turning GDB commands into bash script joaoandreferro
2014-11-06 18:23 ` joaoandreferro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox