]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
btf: print string offset in comment
authorCupertino Miranda <cupertino.miranda@oracle.com>
Thu, 30 Nov 2023 18:13:34 +0000 (18:13 +0000)
committerCupertino Miranda <cupertino.miranda@oracle.com>
Mon, 8 Jan 2024 18:35:25 +0000 (18:35 +0000)
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.

gcc/btfout.cc

index bf3183d0911809c85e5a0b3812c0058484673428..669d357dfd6707eca3e048b7662425cc1dfe16c5 100644 (file)
@@ -1105,17 +1105,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;
     }
 }