Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Arjun Roy <roy.arjun@gmail.com>
To: tromey@redhat.com
Cc: gdb@sourceware.org
Subject: Re: Python Scripting Question
Date: Mon, 09 Nov 2009 20:22:00 -0000	[thread overview]
Message-ID: <4AF87557.8020701@stanford.edu> (raw)
In-Reply-To: <m31vk7ll74.fsf@fleche.redhat.com>

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


  parent reply	other threads:[~2009-11-09 20:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-08 15:08 Arjun Roy
2009-11-09 17:16 ` Tom Tromey
2009-11-09 17:23   ` Tom Tromey
2009-11-09 17:44     ` Daniel Jacobowitz
2009-11-09 18:12       ` Tom Tromey
2009-11-09 20:22   ` Arjun Roy [this message]
2009-11-09 21:12     ` Tom Tromey
2009-11-13 14:36       ` scott snyder
2009-11-13 23:06         ` Arjun Roy
2009-11-18 20:43         ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AF87557.8020701@stanford.edu \
    --to=roy.arjun@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox