How to access files (open/read/close) from gdb script ?
Jim Ingham
jingham@apple.com
Mon Sep 26 17:27:00 GMT 2005
The gdb testsuites are an example of how to do this. They use
"expect" to drive gdb and parse it's output. There are also a lot of
Tcl helper libraries in the testsuite/lib directory that manage
stepping, etc. So one pretty easy option is to use the dejagnu harness.
In any case, you can run the gdb testsuite (using "make check") to
get an example of how to use Tcl & Expect to script gdb.
Also, if you can get the Insight debugger, that has a Tcl Interpreter
build into gdb, and you can write scripts and just "source" them in
Insight. At that point, you can do anything you could do in plain
Tcl...
I think DanielJ also has mentioned working on scripting bindings
using the MI in the past, but I don't know the state of this. That
is a little bit more work, but would allow you to run gdb under
another scripting language if you wanted.
Jim
On Sep 26, 2005, at 8:53 AM, David Lamy-Charrier wrote:
>> Maybe you can integrate this with an expect / tcl script ? AFAIK gdb
>> scripting
>> does not allow such stuff.
>>
>
> I am not sure to understand correclty:
> you mean that I can write a tcl script to do that, but how can I then
> launch the tcl script ?
>
> Thanks,
> David
>
More information about the Gdb
mailing list