public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Guillermo E. Martinez" <guillermo.e.martinez@oracle.com>
To: David Faust <david.faust@oracle.com>
Cc: gcc-patches@gcc.gnu.org, Indu Bhagat <indu.bhagat@oracle.com>
Subject: Re: [PATCH] btf: Add support to BTF_KIND_ENUM64 type
Date: Wed, 28 Sep 2022 16:07:33 -0500	[thread overview]
Message-ID: <a8f2ba94-4daa-7a9e-dfa9-1806554e3cfa@oracle.com> (raw)
In-Reply-To: <2debbcea-96b5-f89c-191b-5787bbb2b048@oracle.com>



On 9/28/22 13:45, David Faust wrote:
> Hi Guillermo,
> 

Hi David,

> Thanks for the patch. Just a couple of small nits on the changelog
> entries below but otherwise very nice, LGTM.
> 
> But, please wait a couple of days before pushing to give Indu time
> to raise any objections about the changes in ctfc/dwarf2ctf.
>

OK. Thanks for your comments!.
  
> Thanks!
> David
> 
> On 8/29/22 14:11, Guillermo E. Martinez via Gcc-patches wrote:
>> Hello GCC team,
>>
>> The following patch update BTF/CTF backend to support
>> BTF_KIND_ENUM64 type.
>>
>> Comments will be welcomed and appreciated!,
>>
>> Kind regards,
>> guillermo
>> --
>>
>> BTF supports 64-bits enumerators with following encoding:
>>
>>    struct btf_type:
>>      name_off: 0 or offset to a valid C identifier
>>      info.kind_flag: 0 for unsigned, 1 for signed
>>      info.kind: BTF_KIND_ENUM64
>>      info.vlen: number of enum values
>>      size: 1/2/4/8
>>
>> The btf_type is followed by info.vlen number of:
>>
>>      struct btf_enum64
>>      {
>>        uint32_t name_off;   /* Offset in string section of enumerator name.  */
>>        uint32_t val_lo32;   /* lower 32-bit value for a 64-bit value Enumerator */
>>        uint32_t val_hi32;   /* high 32-bit value for a 64-bit value Enumerator */
>>      };
>>
>> So, a new btf_enum64 structure was added to represent BTF_KIND_ENUM64
>> and a new field in ctf_dtdef to represent specific type's properties, in
>> the particular case for CTF enums it helps to distinguish when its
>> enumerators values are signed or unsigned, later that information is
>> used to encode the BTF enum type.
>>
>> gcc/ChangeLog:
>>
>> 	* btfout.cc (btf_calc_num_vbytes): Compute enumeration size depending of
>> 	enumerator type btf_enum{,64}.
>> 	(btf_asm_type): Update btf_kflag according to enumerators sign,
>> 	using correct BPF type in BTF_KIND_ENUMi{,64}.
>> 	(btf_asm_enum_const): New argument to represent the size of
>> 	the BTF enum type.
>> 	* ctfc.cc (ctf_add_enum): Use and initialization of flag field to
>> 	CTF_ENUM_F_NONE.
>> 	(ctf_add_enumerator): New argument to represent CTF flags,
>> 	updating the comment and flag vaue according to enumerators
>> 	sing.
>> 	* ctfc.h (ctf_dmdef): Update dmd_value to HOST_WIDE_INT to allow
>> 	use 32/64 bits enumerators.
>> 	(ctf_dtdef): Add flags to to describe specifyc type's properties.
> 
> typo: specific
> 

Fixed in v2.

>> 	* dwarf2ctf.cc (gen_ctf_enumeration_type): Update flags field
>> 	depending when a signed enumerator value is found.
>> 	include/btf.h (btf_enum64): Add new definition and new symbolic
>> 	constant to BTF_KIND_ENUM64 and BTF_KF_ENUM_{UN,}SIGNED.
> 
> Missing an * here for include/btf.h
> 

Fixed in v2.

>>
>> gcc/testsuite/ChangeLog:
>>
>> 	gcc.dg/debug/btf/btf-enum-1.c: Update testcase, with correct
>> 	info.kflags encoding.
>> 	gcc.dg/debug/btf/btf-enum64-1.c: New testcase.
> 
> Likewise for these ChangeLog entries.
> 

Fixed in v2.

> You can use contrib/gcc-changelog/git_check_commit.py to check the
> formatting of the entries.
> 

Oh. thanks for mention it, really useful.

>> ---
>>   gcc/btfout.cc                                 | 24 ++++++++---
>>   gcc/ctfc.cc                                   | 14 ++++---
>>   gcc/ctfc.h                                    |  9 +++-
>>   gcc/dwarf2ctf.cc                              |  9 +++-
>>   gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c   |  2 +-
>>   gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c | 41 +++++++++++++++++++
>>   include/btf.h                                 | 19 +++++++--
>>   7 files changed, 99 insertions(+), 19 deletions(-)
>>   create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c
>>
>> diff --git a/gcc/btfout.cc b/gcc/btfout.cc
>> index 997a33fa089..4b11c867c23 100644
>> --- a/gcc/btfout.cc
>>[...]

Regards,
guillermo

  reply	other threads:[~2022-09-28 21:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 21:11 Guillermo E. Martinez
2022-09-20 19:32 ` Guillermo E. Martinez
2022-09-28 18:45 ` David Faust
2022-09-28 21:07   ` Guillermo E. Martinez [this message]
2022-09-28 21:15 ` [PATCH v2] " Guillermo E. Martinez
2022-09-29 22:35   ` Indu Bhagat
2022-10-03 14:39     ` Guillermo E. Martinez
2022-10-11 18:55       ` Indu Bhagat
2022-10-15  3:45         ` Guillermo E. Martinez
2022-10-15  3:55   ` [PATCH v3] " Guillermo E. Martinez
2022-10-18 21:40     ` Indu Bhagat
2022-10-18 21:48       ` Guillermo E. Martinez
2022-10-20  2:05     ` [PATCH v4] " Guillermo E. Martinez
2022-10-21  9:28       ` Indu Bhagat
2022-10-31 18:26         ` Indu Bhagat

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=a8f2ba94-4daa-7a9e-dfa9-1806554e3cfa@oracle.com \
    --to=guillermo.e.martinez@oracle.com \
    --cc=david.faust@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=indu.bhagat@oracle.com \
    /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).