From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 729C83858D1E for ; Tue, 16 Jan 2024 12:45:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 729C83858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 729C83858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705409140; cv=none; b=xYzsf+CNt4TDadBcHGP3HWV461x5bflY75DqKmVhp1m5AFYkQoT08zqXXJsPqQfIceyJOzjZ3R8yO0pnHBTIcquhDk2DQEa6SjuzEla9WuiObKgtXXGHSyscckpj3x3WKXGyV2wV71qEq1+XYPt7ix/N6GUYrymDFVwZtwUvBhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705409140; c=relaxed/simple; bh=GIRH9q49BLybBaUKAaXmHh1WRA8ASP98rGX+2AuDuWI=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=ALegaPv3fae3NpNFIEuTzIknAke8F1No2a8VH0HGwPtsQl37Tyo6O8adGGU4XeBoDoHHwT2GNwRHJaQg94B7rhbHBjsSbDyFjUhHRARDTbJY5/ErzeMW9JjyqlSwwxZxzAp9gR8vGyLRDBNQtFpf7sLt0BJLF8sB2ZPJw4rNHl4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rPioz-0003Lb-Rm; Tue, 16 Jan 2024 07:45:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=M5RmXzNwrYTgBvgT2LkRQWgUW6Suso5N12kFxrGy2Jk=; b=Q+Lw3AqjKstH R0jFmbuI52LM9ChxxhqnC4QAx9OhR4RR4rrv+3rPgqk35MVjbbEAyzSRDIGbKaEc1e8G23pzHyFzN jX+hYHAirhFyisjxj1ntWsjKNE+Jg3nhQAR0Gi207Bx7xl8z66X0zgyj67jctKFGtBal3CfenFM2S x4R5z4YOppvoMcpIAy/rqpOZH1u6xrlNm82dgcBrIZNFnOba6f5myE0cF2SxZpjDY/BY8HWxLSv0d sPILeytfHdVtIbEC3uwRH024GPLXjcYQGCl1v2eByEABd3U361tAPiX7AyqlRNq5WneWzGfRlaSh1 QoQLymZK629ZVO+IZqIohQ==; Date: Tue, 16 Jan 2024 14:45:13 +0200 Message-Id: <83edehcuqu.fsf@gnu.org> From: Eli Zaretskii To: Matheus Branco Borella Cc: gdb-patches@sourceware.org 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) Subject: Re: [PATCH v4] Add support for creating new types from the Python API References: <20240116045439.171157-1-dark.ryu.550@gmail.com> X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > From: Matheus Branco Borella > Cc: eli@gnu.org, > Matheus Branco Borella > 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