ctf_dump_objts output string
Nick Alcock
nick.alcock@oracle.com
Tue Feb 3 16:29:57 GMT 2026
On 3 Feb 2026, Nick Alcock spake thusly:
> On 30 Jan 2026, Alan Modra uttered the following:
>
>> diff --git a/ld/testsuite/ld-ctf/data-func-conflicted-vars.d b/ld/testsuite/ld-ctf/data-func-conflicted-vars.d
>> index 4e570c6a61a..e2bd077cf9e 100644
>> --- a/ld/testsuite/ld-ctf/data-func-conflicted-vars.d
>> +++ b/ld/testsuite/ld-ctf/data-func-conflicted-vars.d
>> @@ -22,6 +22,7 @@ Contents of CTF section \.ctf:
>> String section: .*
>> #...
>> Data objects:
>> + Section is indexed.
>> bar -> 0x[0-9a-f]*: \(kind 6\) struct var_3 \(size 0x[0-9a-f]*\) \(aligned at 0x[0-9a-f]*\)
>> var_1 -> 0x[0-9a-f]*: \(kind 10\) foo_t \(size 0x[0-9a-f]*\) \(aligned at 0x[0-9a-f]*\) -> .*
>> var_666 -> 0x[0-9a-f]*: \(kind 3\) foo_t \* \(size 0x[0-9a-f]*\) \(aligned at 0x[0-9a-f]*\) -> .*
>
> That doesn't really *look* very nice. Maybe we could indent it a bit:
>
>> Data objects:
>> (Section is indexed.)
>> bar -> 0x[0-9a-f]*: \(kind 6\) struct var_3 \(size 0x[0-9a-f]*\) \(aligned at 0x[0-9a-f]*\)
>
> perhaps? (Putting the indexed stuff on the same line as the Data objects
> is a bit hard.)
Patch adjustment for that is obvious:
diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c
index 3fd8cb87f9f..410b6f67cc1 100644
--- a/libctf/ctf-dump.c
+++ b/libctf/ctf-dump.c
@@ -445,11 +445,12 @@ ctf_dump_objts (ctf_dict_t *fp, ctf_dump_state_t *state, int functions)
ctf_next_t *i = NULL;
char *str = NULL;
- if ((functions && fp->ctf_funcidx_names)
- || (!functions && fp->ctf_objtidx_names))
+ if (functions ? fp->ctf_funcidx_names : fp->ctf_objtidx_names)
str = str_append (str, _(" (Section is indexed.)\n"));
else if (fp->ctf_ext_symtab.cts_data == NULL)
str = str_append (str, _(" (No symbol table.)\n"));
+ if (str)
+ ctf_dump_append (state, str);
while ((id = ctf_symbol_next (fp, &i, &name, functions)) != CTF_ERR)
{
(I suspect the "no symbol table" can't actually appear.)
> This has implications for a whole bunch of the testcases too, since many
... which you already adjusted. Sorry, my brain is clearly not turned on.
--
NULL && (void)
More information about the Binutils
mailing list