This is the mail archive of the gdb-patches@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: [RFC - Python Scripting] New method gdb.Architecture.disassemble


On Tue, Feb 5, 2013 at 3:28 PM, Doug Evans <dje@google.com> wrote:
> I like the idea, but for an API I wouldn't mind seeing something
> a bit lower level.  E.g., skip the higher level disassembler entry
> points in gdb (mixed source/assembly support and all that), and provide
> more direct access to the disassembler.

The only useful entry point currently available is gdb_disassembly and
I do not think it is a bad entry point. Other disassembly functions in
disasm.c are static. However, for the Python API, my patch provides
only one option of whether to include or exclude opcodes in the
disassembled output.

> I didn't go through it with a fine toothed comb, but here are some questions.
> 1) Can we remove the py_out global?

At what level do you not want this to be global? I have made it static
to the file in the attached patch.

> 2) It seems like this will export a lot of struct ui_out to the user.
>    I'd rather provide disassembly without having to commit to supporting
>    struct ui_out in Python.

I am not very sure I understand this point. My patch does not expose
anything about the struct ui_out to the user/Python API. Python ui_out
is only a way to get results from GDB internals into a Python data
structure. Also, this Python data structure does not depend on
gdb_disassembly's display format.

2013-02-05  Siva Chandra Reddy  <sivachandra@google.com>

        Add a new method 'disassemble' to gdb.Architecture class.
        * Makefile.in: Add entries for the new file python/py-out.c
        * python/py-arch.c (archpy_disassmble): Implementation of the
        new method gdb.Architecture.disassemble.
        (arch_object_methods): Add entry for the new method.
        * python/py-out.c: Implementation of a Python ui_out.
        * python/python-internal.h: Add declarations for new utility
        functions.
        * python/python.c (_initialize_python): Initialize Python
        ui_out.

Attachment: arch_disassemble_patch_v2.txt
Description: Text document


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