Re: gdb script

Paul Pluzhnikov
2009-07-23T00:34:52Z

On Wed, Jul 22, 2009 at 2:30 PM, Joel Brobecker<brobecker@adacore.com> wrote:

>> *can any one please help me out why gdb is not giving control back to
>> script
>
> That's actually the documented behavior.

Really? I thought script execution stopped only on errors:

Node: Command Files

An error in any command terminates execution of the command
file and control is returned to the console.

Anyway, this seems to work for me:

cat t.c
int main() { return 0; }

gcc -g t.c

cat gdb.cmd
break main
run
info reg
quit

gdb -q -nx -x gdb.cmd ./a.out
Breakpoint 1 at 0x40044c: file t.c, line 1.

Breakpoint 1, main () at t.c:1
1 int main() { return 0; }
rax 0x7ffff7ddca60 140737351895648
rbx 0x7ffff7ffdc00 140737354128384
rcx 0x400470 4195440
rdx 0x7fffffffdb88 140737488345992
rsi 0x7fffffffdb78 140737488345976
rdi 0x1 1
rbp 0x7fffffffda90 0x7fffffffda90
rsp 0x7fffffffda90 0x7fffffffda90
r8 0x7ffff7ddb2e0 140737351889632
r9 0x7ffff7dee580 140737351968128
r10 0x0 0
r11 0x7ffff7a9c0d0 140737348485328
r12 0x0 0
r13 0x7fffffffdb70 140737488345968
r14 0x0 0
r15 0x0 0
rip 0x40044c 0x40044c <main+4>
eflags 0x246 [ PF ZF IF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
fctrl 0x37f 895
fstat 0x0 0
ftag 0xffff 65535
fiseg 0x0 0
fioff 0x0 0
foseg 0x0 0
fooff 0x0 0
fop 0x0 0
mxcsr 0x1f80 [ IM DM ZM OM UM PM ]
The program is running. Exit anyway? (y or n) [answered Y; input not
from terminal]

--
Paul Pluzhnikov