[RFC,v2,00/21] Add Python "JIT" API

Message ID 20241121124714.419946-1-jan.vrany@labware.com
Headers
Series Add Python "JIT" API |

Message

Jan Vrany Nov. 21, 2024, 12:46 p.m. UTC
  Hello,

this is a v2 of RFC series that extends GDB's Python API to allow
interfacing with JIT compilers in Python.

The v1 submission is here:

   https://inbox.sourceware.org/gdb-patches/20241111145522.560028-1-jan.vrany@labware.com/

Changes in V2:

  * addressed all Eli's comments to documentation parts
  * use nullptr instead of NULL thorough this series
  * avoid using auto in cases Andrew mentioned, also
    thorough this series.
  * updated commit message for commit
    "gdb/python: add subblocks property to gdb.Block"

Thanks,

Jan

Jan Vrany (21):
  gdb: update is_addr_in_objfile to support "dynamic" objfiles
  gdb/python: add subblocks property to gdb.Block
  gdb/python: add domain property to gdb.Symbol
  gdb/python: add void_type () method to gdb.Architecture object
  gdb/python: add function () method to gdb.Type object
  gdb/python: add template function to implement equality comparison
  gdb/python: make gdb.Symbol comparable for equality
  gdb/python: make gdb.Symtab comparable for equality
  gdb: use std::vector<> to hold on blocks in struct blockvector
  gdb/python: add gdb.Compunit
  gdb/python: allow instantiation of gdb.Objfile from Python
  gdb/python: add unlink () method to gdb.Objfile object
  gdb/python: allow instantiation of gdb.Compunit from Python
  gdb/python: allow instantiation of gdb.Symtab from Python
  gdb/python: allow instantiation of gdb.Block from Python
  gdb/python: allow instantiation of gdb.Symbol from Python
  gdb/python: add add_symbol () method to gdb.Block
  gdb/python: add more attributes to gdb.LinetableEntry objects
  gdb/python: allow instantiation of gdb.LineTableEntry objects
  gdb/python: allow instantiation of gdb.LineTable objects
  gdb/python: add section in documentation on implementing JIT interface

 gdb/Makefile.in                           |   1 +
 gdb/NEWS                                  |  17 +
 gdb/block.c                               |  59 +++
 gdb/block.h                               |  56 ++-
 gdb/buildsym.c                            |   6 +-
 gdb/doc/gdb.texinfo                       |   3 +-
 gdb/doc/python.texi                       | 322 +++++++++++++++++
 gdb/jit.c                                 |   8 +-
 gdb/mdebugread.c                          |  32 +-
 gdb/objfiles.c                            |  36 ++
 gdb/objfiles.h                            |   4 +
 gdb/python/py-arch.c                      |  16 +
 gdb/python/py-block.c                     | 196 +++++++++-
 gdb/python/py-compunit.c                  | 414 ++++++++++++++++++++++
 gdb/python/py-inferior.c                  |  10 +
 gdb/python/py-linetable.c                 | 243 ++++++++++++-
 gdb/python/py-objfile.c                   | 170 ++++++++-
 gdb/python/py-symbol.c                    | 153 +++++++-
 gdb/python/py-symtab.c                    |  70 +++-
 gdb/python/py-type.c                      |  54 +++
 gdb/python/python-internal.h              |  38 ++
 gdb/testsuite/gdb.base/jit-reader.exp     |   9 +
 gdb/testsuite/gdb.python/py-arch.exp      |   4 +
 gdb/testsuite/gdb.python/py-block.exp     |  49 +++
 gdb/testsuite/gdb.python/py-compunit.exp  | 102 ++++++
 gdb/testsuite/gdb.python/py-jit.c         |  61 ++++
 gdb/testsuite/gdb.python/py-jit.exp       |  57 +++
 gdb/testsuite/gdb.python/py-jit.py        | 110 ++++++
 gdb/testsuite/gdb.python/py-linetable.exp |  67 +++-
 gdb/testsuite/gdb.python/py-objfile.exp   |  50 ++-
 gdb/testsuite/gdb.python/py-symbol.exp    |  35 ++
 gdb/testsuite/gdb.python/py-symtab.exp    |  44 +++
 gdb/testsuite/gdb.python/py-type.exp      |  20 ++
 gdbsupport/gdb_obstack.h                  |  52 +++
 34 files changed, 2482 insertions(+), 86 deletions(-)
 create mode 100644 gdb/python/py-compunit.c
 create mode 100644 gdb/testsuite/gdb.python/py-compunit.exp
 create mode 100644 gdb/testsuite/gdb.python/py-jit.c
 create mode 100644 gdb/testsuite/gdb.python/py-jit.exp
 create mode 100644 gdb/testsuite/gdb.python/py-jit.py
  

Comments

Jan Vrany Nov. 28, 2024, 11:14 a.m. UTC | #1
Polite ping.

Thanks, Jan

On Thu, 2024-11-21 at 12:46 +0000, Jan Vrany wrote:
> Hello,
> 
> this is a v2 of RFC series that extends GDB's Python API to allow
> interfacing with JIT compilers in Python.
> 
> The v1 submission is here:
> 
>   
> https://inbox.sourceware.org/gdb-patches/20241111145522.560028-1-jan.vrany@labware.com/
> 
> Changes in V2:
> 
>   * addressed all Eli's comments to documentation parts
>   * use nullptr instead of NULL thorough this series
>   * avoid using auto in cases Andrew mentioned, also
>     thorough this series.
>   * updated commit message for commit
>     "gdb/python: add subblocks property to gdb.Block"
> 
> Thanks,
> 
> Jan
> 
> Jan Vrany (21):
>   gdb: update is_addr_in_objfile to support "dynamic" objfiles
>   gdb/python: add subblocks property to gdb.Block
>   gdb/python: add domain property to gdb.Symbol
>   gdb/python: add void_type () method to gdb.Architecture object
>   gdb/python: add function () method to gdb.Type object
>   gdb/python: add template function to implement equality comparison
>   gdb/python: make gdb.Symbol comparable for equality
>   gdb/python: make gdb.Symtab comparable for equality
>   gdb: use std::vector<> to hold on blocks in struct blockvector
>   gdb/python: add gdb.Compunit
>   gdb/python: allow instantiation of gdb.Objfile from Python
>   gdb/python: add unlink () method to gdb.Objfile object
>   gdb/python: allow instantiation of gdb.Compunit from Python
>   gdb/python: allow instantiation of gdb.Symtab from Python
>   gdb/python: allow instantiation of gdb.Block from Python
>   gdb/python: allow instantiation of gdb.Symbol from Python
>   gdb/python: add add_symbol () method to gdb.Block
>   gdb/python: add more attributes to gdb.LinetableEntry objects
>   gdb/python: allow instantiation of gdb.LineTableEntry objects
>   gdb/python: allow instantiation of gdb.LineTable objects
>   gdb/python: add section in documentation on implementing JIT
> interface
> 
>  gdb/Makefile.in                           |   1 +
>  gdb/NEWS                                  |  17 +
>  gdb/block.c                               |  59 +++
>  gdb/block.h                               |  56 ++-
>  gdb/buildsym.c                            |   6 +-
>  gdb/doc/gdb.texinfo                       |   3 +-
>  gdb/doc/python.texi                       | 322 +++++++++++++++++
>  gdb/jit.c                                 |   8 +-
>  gdb/mdebugread.c                          |  32 +-
>  gdb/objfiles.c                            |  36 ++
>  gdb/objfiles.h                            |   4 +
>  gdb/python/py-arch.c                      |  16 +
>  gdb/python/py-block.c                     | 196 +++++++++-
>  gdb/python/py-compunit.c                  | 414
> ++++++++++++++++++++++
>  gdb/python/py-inferior.c                  |  10 +
>  gdb/python/py-linetable.c                 | 243 ++++++++++++-
>  gdb/python/py-objfile.c                   | 170 ++++++++-
>  gdb/python/py-symbol.c                    | 153 +++++++-
>  gdb/python/py-symtab.c                    |  70 +++-
>  gdb/python/py-type.c                      |  54 +++
>  gdb/python/python-internal.h              |  38 ++
>  gdb/testsuite/gdb.base/jit-reader.exp     |   9 +
>  gdb/testsuite/gdb.python/py-arch.exp      |   4 +
>  gdb/testsuite/gdb.python/py-block.exp     |  49 +++
>  gdb/testsuite/gdb.python/py-compunit.exp  | 102 ++++++
>  gdb/testsuite/gdb.python/py-jit.c         |  61 ++++
>  gdb/testsuite/gdb.python/py-jit.exp       |  57 +++
>  gdb/testsuite/gdb.python/py-jit.py        | 110 ++++++
>  gdb/testsuite/gdb.python/py-linetable.exp |  67 +++-
>  gdb/testsuite/gdb.python/py-objfile.exp   |  50 ++-
>  gdb/testsuite/gdb.python/py-symbol.exp    |  35 ++
>  gdb/testsuite/gdb.python/py-symtab.exp    |  44 +++
>  gdb/testsuite/gdb.python/py-type.exp      |  20 ++
>  gdbsupport/gdb_obstack.h                  |  52 +++
>  34 files changed, 2482 insertions(+), 86 deletions(-)
>  create mode 100644 gdb/python/py-compunit.c
>  create mode 100644 gdb/testsuite/gdb.python/py-compunit.exp
>  create mode 100644 gdb/testsuite/gdb.python/py-jit.c
>  create mode 100644 gdb/testsuite/gdb.python/py-jit.exp
>  create mode 100644 gdb/testsuite/gdb.python/py-jit.py
>
  
Eli Zaretskii Nov. 28, 2024, 12:03 p.m. UTC | #2
> From: Jan Vraný <Jan.Vrany@labware.com>
> Date: Thu, 28 Nov 2024 11:14:46 +0000
> 
> Polite ping.

I already reviewed the documentation parts, didn't I?
  
Jan Vrany Nov. 28, 2024, 12:29 p.m. UTC | #3
On Thu, 2024-11-28 at 14:03 +0200, Eli Zaretskii wrote:
> > From: Jan Vraný <Jan.Vrany@labware.com>
> > Date: Thu, 28 Nov 2024 11:14:46 +0000
> > 
> > Polite ping.
> 
> I already reviewed the documentation parts, didn't I?
> 

Yes, you did. I have already addressed all your comments
(the code is in branch users/jv/feature-py-jit-api-gen2 in
sourceware repo). 

No code has been reviewed (apart Andrew's comments on one patch
which resulted in v2), hence the ping. 

I'm bit unsure about the rules, whether I'm supposed to send new
version after each review or whether to wait for more reviews to
accumulate and then submit next version. 
If I should have sent v3 instead, I'm happy to do that (and will do
next time). 

Thanks! Jan
  
Guinevere Larsen Nov. 28, 2024, 12:33 p.m. UTC | #4
On 11/28/24 9:29 AM, Jan Vraný wrote:
> On Thu, 2024-11-28 at 14:03 +0200, Eli Zaretskii wrote:
>>> From: Jan Vraný <Jan.Vrany@labware.com>
>>> Date: Thu, 28 Nov 2024 11:14:46 +0000
>>>
>>> Polite ping.
>> I already reviewed the documentation parts, didn't I?
>>
> Yes, you did. I have already addressed all your comments
> (the code is in branch users/jv/feature-py-jit-api-gen2 in
> sourceware repo).
>
> No code has been reviewed (apart Andrew's comments on one patch
> which resulted in v2), hence the ping.
>
> I'm bit unsure about the rules, whether I'm supposed to send new
> version after each review or whether to wait for more reviews to
> accumulate and then submit next version.
> If I should have sent v3 instead, I'm happy to do that (and will do
> next time).

There's no hard rule, to my knowledge. Some people send new versions for 
every docs review, some wait for significant changes (in docs or code). 
I think it's fine to wait for a code review before sending a new version.

I can't review this change as I don't understand neither JIT nor the 
python interface, though. Hope this gets looked at quickly :)
  
Jan Vrany Dec. 6, 2024, 11:29 a.m. UTC | #5
Polite ping.

Thanks, Jan

On Thu, 2024-11-28 at 11:14 +0000, Jan Vrany wrote:
> Polite ping.
> 
> Thanks, Jan
> 
> On Thu, 2024-11-21 at 12:46 +0000, Jan Vrany wrote:
> > Hello,
> > 
> > this is a v2 of RFC series that extends GDB's Python API to allow
> > interfacing with JIT compilers in Python.
> > 
> > The v1 submission is here:
> > 
> >   
> > https://inbox.sourceware.org/gdb-patches/20241111145522.560028-1-jan.vrany@labware.com/
> > 
> > Changes in V2:
> > 
> >   * addressed all Eli's comments to documentation parts
> >   * use nullptr instead of NULL thorough this series
> >   * avoid using auto in cases Andrew mentioned, also
> >     thorough this series.
> >   * updated commit message for commit
> >     "gdb/python: add subblocks property to gdb.Block"
> > 
> > Thanks,
> > 
> > Jan
> > 
> > Jan Vrany (21):
> >   gdb: update is_addr_in_objfile to support "dynamic" objfiles
> >   gdb/python: add subblocks property to gdb.Block
> >   gdb/python: add domain property to gdb.Symbol
> >   gdb/python: add void_type () method to gdb.Architecture object
> >   gdb/python: add function () method to gdb.Type object
> >   gdb/python: add template function to implement equality
> > comparison
> >   gdb/python: make gdb.Symbol comparable for equality
> >   gdb/python: make gdb.Symtab comparable for equality
> >   gdb: use std::vector<> to hold on blocks in struct blockvector
> >   gdb/python: add gdb.Compunit
> >   gdb/python: allow instantiation of gdb.Objfile from Python
> >   gdb/python: add unlink () method to gdb.Objfile object
> >   gdb/python: allow instantiation of gdb.Compunit from Python
> >   gdb/python: allow instantiation of gdb.Symtab from Python
> >   gdb/python: allow instantiation of gdb.Block from Python
> >   gdb/python: allow instantiation of gdb.Symbol from Python
> >   gdb/python: add add_symbol () method to gdb.Block
> >   gdb/python: add more attributes to gdb.LinetableEntry objects
> >   gdb/python: allow instantiation of gdb.LineTableEntry objects
> >   gdb/python: allow instantiation of gdb.LineTable objects
> >   gdb/python: add section in documentation on implementing JIT
> > interface
> > 
> >  gdb/Makefile.in                           |   1 +
> >  gdb/NEWS                                  |  17 +
> >  gdb/block.c                               |  59 +++
> >  gdb/block.h                               |  56 ++-
> >  gdb/buildsym.c                            |   6 +-
> >  gdb/doc/gdb.texinfo                       |   3 +-
> >  gdb/doc/python.texi                       | 322 +++++++++++++++++
> >  gdb/jit.c                                 |   8 +-
> >  gdb/mdebugread.c                          |  32 +-
> >  gdb/objfiles.c                            |  36 ++
> >  gdb/objfiles.h                            |   4 +
> >  gdb/python/py-arch.c                      |  16 +
> >  gdb/python/py-block.c                     | 196 +++++++++-
> >  gdb/python/py-compunit.c                  | 414
> > ++++++++++++++++++++++
> >  gdb/python/py-inferior.c                  |  10 +
> >  gdb/python/py-linetable.c                 | 243 ++++++++++++-
> >  gdb/python/py-objfile.c                   | 170 ++++++++-
> >  gdb/python/py-symbol.c                    | 153 +++++++-
> >  gdb/python/py-symtab.c                    |  70 +++-
> >  gdb/python/py-type.c                      |  54 +++
> >  gdb/python/python-internal.h              |  38 ++
> >  gdb/testsuite/gdb.base/jit-reader.exp     |   9 +
> >  gdb/testsuite/gdb.python/py-arch.exp      |   4 +
> >  gdb/testsuite/gdb.python/py-block.exp     |  49 +++
> >  gdb/testsuite/gdb.python/py-compunit.exp  | 102 ++++++
> >  gdb/testsuite/gdb.python/py-jit.c         |  61 ++++
> >  gdb/testsuite/gdb.python/py-jit.exp       |  57 +++
> >  gdb/testsuite/gdb.python/py-jit.py        | 110 ++++++
> >  gdb/testsuite/gdb.python/py-linetable.exp |  67 +++-
> >  gdb/testsuite/gdb.python/py-objfile.exp   |  50 ++-
> >  gdb/testsuite/gdb.python/py-symbol.exp    |  35 ++
> >  gdb/testsuite/gdb.python/py-symtab.exp    |  44 +++
> >  gdb/testsuite/gdb.python/py-type.exp      |  20 ++
> >  gdbsupport/gdb_obstack.h                  |  52 +++
> >  34 files changed, 2482 insertions(+), 86 deletions(-)
> >  create mode 100644 gdb/python/py-compunit.c
> >  create mode 100644 gdb/testsuite/gdb.python/py-compunit.exp
> >  create mode 100644 gdb/testsuite/gdb.python/py-jit.c
> >  create mode 100644 gdb/testsuite/gdb.python/py-jit.exp
> >  create mode 100644 gdb/testsuite/gdb.python/py-jit.py
> > 
>