Hi Cupertino,

On 1/8/24 02:55, Cupertino Miranda wrote:
> Hi everyone,
> 
> This patch adds a comment to the BTF strings regarding their position
> within the section. This is useful for assembly inspection purposes.
> 
> Regards,
> Cupertino
> 
> When using -dA, this function was only printing as comment btf_string or
> btf_aux_string.
> This patch changes the comment to also include the position of the
> string within the section in hexadecimal format.
> 
> gcc/ChangeLog:
>       * btfout.cc (output_btf_strs): Changed.

Please be a little bit more expressive in the ChangeLog.
Something along the lines of "print string offset in comment" will be
much more useful.

LGTM with that change, please apply.
Thanks!

> ---
>  gcc/btfout.cc | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/btfout.cc b/gcc/btfout.cc
> index db4f1084f85c..04218adc9e66 100644
> --- a/gcc/btfout.cc
> +++ b/gcc/btfout.cc
> @@ -1081,17 +1081,20 @@ static void
>  output_btf_strs (ctf_container_ref ctfc)
>  {
>    ctf_string_t * ctf_string = ctfc->ctfc_strtable.ctstab_head;
> +  static int str_pos = 0;
>  
>    while (ctf_string)
>      {
> -      dw2_asm_output_nstring (ctf_string->cts_str, -1, "btf_string");
> +      dw2_asm_output_nstring (ctf_string->cts_str, -1, "btf_string, str_pos 
> = 0x%x", str_pos);
> +      str_pos += strlen(ctf_string->cts_str) + 1;
>        ctf_string = ctf_string->cts_next;
>      }
>  
>    ctf_string = ctfc->ctfc_aux_strtable.ctstab_head;
>    while (ctf_string)
>      {
> -      dw2_asm_output_nstring (ctf_string->cts_str, -1, "btf_aux_string");
> +      dw2_asm_output_nstring (ctf_string->cts_str, -1, "btf_aux_string, 
> str_pos = 0x%x", str_pos);
> +      str_pos += strlen(ctf_string->cts_str) + 1;
>        ctf_string = ctf_string->cts_next;
>      }
>  }

Reply via email to