From 4a5bb8bc1c562ba4d6e97f1979de6b8ac566f04f Mon Sep 17 00:00:00 2001 From: Cupertino Miranda Date: Thu, 30 Nov 2023 18:13:34 +0000 Subject: [PATCH] btf: print string offset in comment 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/btfout.cc b/gcc/btfout.cc index bf3183d09118..669d357dfd67 100644 --- a/gcc/btfout.cc +++ b/gcc/btfout.cc @@ -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; } } -- 2.47.2