This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Python Scripting Question


On 11/09/2009 08:25 AM, Tom Tromey wrote:
> Arjun> Traceback (most recent call last):
> Arjun>   File "<string>", line 2, in <module>
> Arjun> TypeError: argument 1 must be string without null bytes, not str
> Arjun> Error while executing Python code.
>
> Arjun> Is this a bug, am I misunderstanding the right way to do it, or what?
>
> It is a bug.
>
> Arjun> 2. Ideally, I'd like to write a really simple script that:
> Arjun> - starts running a program
> Arjun> - steps through each instruction one by one, recording the opcode for
> Arjun> each instruction performed
> Arjun> - and stops when the program is over.
>
> Arjun> Does gdb-python support that?
>
> Not yet.  Better execution control is on our wish-list.  There was a SoC
> project to implement some of this; the patches need a bit of reworking
> though.
>
> Tom
>   
It looks as though the two main things this would need would be to:

1. Be able to access the output one gets from executing a GDB command.
Ideally one would get an object with various fields filled in based on
the type of command, but for my purposes even a string would do - as
long as the results can be accessed somehow.

2. Some python objects for representing the current execution state of
the program, where one could call methods for determining what's going on.

Then in my case, a script would be conceptually as simple as:

whileProgramStillRunning()
   nexti
   op = getopcode from (disassemble at $pc, $pc+1)
   // do whatever i want with the result

How easy to hack in would this be?

-Arjun


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]