public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Matheus Branco Borella <dark.ryu.550@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v4] Add support for creating new types from the Python API
Date: Tue, 16 Jan 2024 14:45:13 +0200	[thread overview]
Message-ID: <83edehcuqu.fsf@gnu.org> (raw)
In-Reply-To: <20240116045439.171157-1-dark.ryu.550@gmail.com> (message from Matheus Branco Borella on Tue, 16 Jan 2024 01:54:40 -0300)

> From: Matheus Branco Borella <dark.ryu.550@gmail.com>
> Cc: eli@gnu.org,
> 	Matheus Branco Borella <dark.ryu.550@gmail.com>
> Date: Tue, 16 Jan 2024 01:54:40 -0300
> 
>  gdb/Makefile.in                           |   2 +
>  gdb/NEWS                                  |  16 +
>  gdb/doc/python.texi                       | 161 +++++++
>  gdb/python/py-float-format.c              | 307 +++++++++++++
>  gdb/python/py-objfile.c                   |  17 +
>  gdb/python/py-type-init.c                 | 520 ++++++++++++++++++++++
>  gdb/python/python-internal.h              |  34 ++
>  gdb/python/python.c                       |  50 +++
>  gdb/testsuite/gdb.python/py-type-init.c   |  21 +
>  gdb/testsuite/gdb.python/py-type-init.exp | 132 ++++++
>  10 files changed, 1260 insertions(+)
>  create mode 100644 gdb/python/py-float-format.c
>  create mode 100644 gdb/python/py-type-init.c
>  create mode 100644 gdb/testsuite/gdb.python/py-type-init.c
>  create mode 100644 gdb/testsuite/gdb.python/py-type-init.exp

Thanks.

> diff --git a/gdb/NEWS b/gdb/NEWS
> index 11cd6c0663e..e541544a027 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -87,6 +87,22 @@ show remote thread-options-packet
>    ** New function gdb.interrupt(), that interrupts GDB as if the user
>       typed control-c.
>  
> +  ** Functions that allow creation of instances of gdb.Type, and a new
> +     class gdb.FloatFormat that may be used to create floating point
> +     types.  The functions that allow new type creation are:
> +      - gdb.init_type: Create a new type given a type code.
> +      - gdb.init_integer_type: Create a new integer type.
> +      - gdb.init_character_type: Create a new character type.
> +      - gdb.init_boolean_type: Create a new boolean type.
> +      - gdb.init_float_type: Create a new floating point type.
> +      - gdb.init_decfloat_type: Create a new decimal floating point type.
> +      - gdb.can_create_complex_type: Whether a type can be used to create a
> +          new complex type.
> +      - gdb.init_complex_type: Create a new complex type.
> +      - gdb.init_pointer_type: Create a new pointer type.
> +          * This allows creating pointers of arbitrary size.
> +      - gdb.init_fixed_point_type: Create a new fixed point type.
> +
>  * Debugger Adapter Protocol changes

This part is okay.

> +@var{format} is an reference to a @code{gdb.FloatFormat} object, as
                   ^^^^^^^^^^^^
"a reference"

> +@findex gdb.init_pointer_type
> +@defun gdb.init_pointer_type (owner, target, bit_size, name)
> +This function creates a new @code{gdb.Type} instance corresponding to a
> +pointer type that points to @var{target} and is owned by the given
> +@var{owner}, with the given @var{name} and size.

I asked previously what does BIT_SIZE mean for pointer types.  Is it
the size of the pointer or of the data type to which the pointer
points?  If it's the size of the pointer, then does it mean this
function can create pointers of arbitrary sizes regardless of the
sizes of pointers that are supported by the target?

> +When creating a floating point type through @code{gdb.init_float_type},
> +one has to use a @code{gdb.FloatFormat} object. These objects may be
                                                 ^^
Two spaces there, please.

> +@defvar FloatFormat.totalsize
> +The size of the floating point number, in bits. Currently, accepted
                                                 ^^
Likewise.

> +@defvar FloatFormat.intbit
> +This is a boolean values that indicates whether the integer bit is part
> +of the value or if it is determined implicitly. A value of true
                                                 ^^
And here.

> +@defvar FloatFormat.name
> +The name of the float format. Used internally, for debugging purposes.
                               ^^
And here.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>

  reply	other threads:[~2024-01-16 12:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16  4:54 Matheus Branco Borella
2024-01-16 12:45 ` Eli Zaretskii [this message]
2024-01-16 17:50   ` Matheus Branco Borella
2024-01-16 18:20   ` [PATCH v4] Add support for creating new types from the Python API Matheus Branco Borella
2024-01-16 18:56     ` Eli Zaretskii
2024-01-16 21:27       ` Matheus Branco Borella
2024-02-06 18:20 ` Tom Tromey
2024-02-21 18:11   ` Matheus Branco Borella

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=83edehcuqu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dark.ryu.550@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).