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


I have addressed all of Tom's comments and added docs and tests in the
attached patch. I did not add a NEWS entry as an entry already exists
for the new gdb.Architecture class.

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

        Add a new method 'disassemble' to gdb.Architecture class.
        * python/py-arch.c (archpy_disassmble): Implementation of the
        new method gdb.Architecture.disassemble.
        (arch_object_methods): Add entry for the new method.

doc/

        * gdb.texinfo (Architectures In Python): Add description about
        the new method gdb.Architecture.disassemble.

testsuite/

        * gdb.python/py-arch.c: New test case
        * gdb.python/py-arch.exp: New tests to test
        gdb.Architecture.disassemble
        * gdb.python/Makefile.in: Add py-arch to the list of
        EXECUTABLES.

I have a couple of questions for my knowledge:
1. docs.python.org says that PyList_Append sets an exception when it
fails. It does not say so for PyList_New() and PyDict_New(). However,
Tom commented that even these functions set exception on failure. In
general, how do we know if a certain Python C API function sets an
exception or not?
2. One of Tom's suggestion was to use something like this:

     asm_code == NULL ? unknown_str : asm_code

I have modified my code accordingly, but the concern I have is that
asm_code is of type 'char *', while unknown_str if of type 'const char
*'. This means that the type of result of the above expression is
dynamic! Though the code compiles with GCC, it that standard?

Thanks,
Siva Chandra

Attachment: arch_disassemble_patch_v4.txt
Description: Text document


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