aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libctf/ChangeLog9
-rw-r--r--libctf/ctf-dump.c20
2 files changed, 19 insertions, 10 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index d840bc4..b13c51c 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,5 +1,14 @@
2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+ * ctf-dump.c (ctf_dump_format_type): Emit a warning.
+ (ctf_dump_label): Swallow errors from ctf_dump_format_type.
+ (ctf_dump_objts): Likewise.
+ (ctf_dump_var): Likewise.
+ (ctf_dump_type): Do not emit a duplicate message. Move to
+ ctf_err_warning, and swallow all errors.
+
+2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+
* ctf-decl.c (ctf_decl_fini): Free the cd_buf.
(ctf_decl_buf): Once it escapes, don't try to free it later.
diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c
index 08d79f3..55aa496 100644
--- a/libctf/ctf-dump.c
+++ b/libctf/ctf-dump.c
@@ -169,6 +169,8 @@ ctf_dump_format_type (ctf_file_t *fp, ctf_id_t id, int flag)
oom:
ctf_set_errno (fp, errno);
err:
+ ctf_err_warn (fp, 1, "Cannot format name dumping type 0x%lx: %s", id,
+ ctf_errmsg (ctf_errno (fp)));
free (buf);
free (str);
free (bit);
@@ -318,7 +320,7 @@ ctf_dump_label (const char *name, const ctf_lblinfo_t *info,
CTF_ADD_ROOT)) == NULL)
{
free (str);
- return -1; /* errno is set for us. */
+ return 0; /* Swallow the error. */
}
str = str_append (str, typestr);
@@ -375,7 +377,7 @@ ctf_dump_objts (ctf_file_t *fp, ctf_dump_state_t *state)
CTF_ADD_ROOT)) == NULL)
{
free (str);
- return -1; /* errno is set for us. */
+ return 0; /* Swallow the error. */
}
str = str_append (str, typestr);
@@ -495,7 +497,7 @@ ctf_dump_var (const char *name, ctf_id_t type, void *arg)
CTF_ADD_ROOT)) == NULL)
{
free (str);
- return -1; /* errno is set for us. */
+ return 0; /* Swallow the error. */
}
str = str_append (str, typestr);
@@ -579,10 +581,7 @@ ctf_dump_type (ctf_id_t id, int flag, void *arg)
size_t len;
if ((str = ctf_dump_format_type (state->cds_fp, id, flag)) == NULL)
- {
- err = "format type";
- goto err;
- }
+ goto err_nomsg; /* Error already logged for us. */
str = str_append (str, "\n");
if ((ctf_type_visit (state->cds_fp, id, ctf_dump_member, &membstate)) < 0)
@@ -605,10 +604,11 @@ ctf_dump_type (ctf_id_t id, int flag, void *arg)
return 0;
err:
- ctf_dprintf ("Cannot %s dumping type 0x%lx: %s\n", err, id,
- ctf_errmsg (ctf_errno (state->cds_fp)));
+ ctf_err_warn (state->cds_fp, 1, "Cannot %s dumping type 0x%lx: %s",
+ err, id, ctf_errmsg (ctf_errno (state->cds_fp)));
+ err_nomsg:
free (str);
- return -1; /* errno is set for us. */
+ return 0; /* Swallow the error. */
}
/* Dump the string table into the cds_items. */