Bob5421
Bob5421

Reputation: 9163

is there a way to script GDB with python or c program?

I want to write a script that will read a process memory, and display its contents with some modification/format. It would be create if i could run a c program inside gdb and send gdb commands from this program. Do you know if it is possible ?

Upvotes: 0

Views: 187

Answers (1)

Employed Russian
Employed Russian

Reputation: 213877

It would be great if i could run a c program inside gdb and send gdb commands from this program.

That's easy:

(gdb) shell /tmp/a.out > /tmp/gdb.script
(gdb) source /tmp/gdb.script

If your gdb is built with Python support, much better scripting support is available. Start here.

Upvotes: 1

Related Questions