If dumping of a single type fails, we obviously can't dump it; but just
as obviously this doesn't make the other types in the types section
invalid or undumpable. So we should not propagate errors seen when
type-dumping, but rather ignore them and carry on, so we dump as many
types as we can (leaving out the ones we can't grok).
libctf/ChangeLog
2021-10-25 Nick Alcock <nick.alcock@oracle.com>
* ctf-dump.c (ctf_dump_type): Do not abort on error.
+2021-10-25 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-dump.c (ctf_dump_type): Do not abort on error.
+
2021-09-27 Nick Alcock <nick.alcock@oracle.com>
* ctf-lookup.c (ctf_lookup_by_name_internal): Fix pptrtab bounds.
{
char *str;
char *indent;
- int err = 0;
ctf_dump_state_t *state = arg;
ctf_dump_membstate_t membstate = { &str, state->cds_fp, NULL };
if (asprintf (&bit, "%s: %i\n", enumerand, value) < 0)
{
- err = ENOMEM;
ctf_next_destroy (it);
- goto err;
+ goto oom;
}
str = str_append (str, bit);
free (bit);
err:
free (indent);
free (str);
- return ctf_set_errno (state->cds_fp, err);
+
+ /* Swallow the error: don't cause an error in one type to abort all
+ type dumping. */
+ return 0;
+
+ oom:
+ free (indent);
+ free (str);
+ return ctf_set_errno (state->cds_fp, ENOMEM);
}
/* Dump the string table into the cds_items. */