]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
libctf: improve handling of type dumping errors
authorNick Alcock <nick.alcock@oracle.com>
Tue, 2 Apr 2024 12:48:13 +0000 (13:48 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 19 Apr 2024 15:14:47 +0000 (16:14 +0100)
When dumping a type fails with an error, we want to emit a warning noting
this: a warning because it's not fatal and we can continue.  But warnings
don't automatically print out the ctf_errno (because not all cases causing
warnings set the errno at all), so we must do it at warning-emission time or
lose track of what's gone wrong.

libctf/

* ctf-dump.c (ctf_dump_format_type): Dump the underlying error on
type dump failure.

libctf/ctf-dump.c

index 2213d09dc29261e26fbff21d09ca18bb10de5684..80a3b2652971b75df096a25ecfacfceb44f0e9b2 100644 (file)
@@ -239,7 +239,8 @@ ctf_dump_format_type (ctf_dict_t *fp, ctf_id_t id, int flag)
  oom:
   ctf_set_errno (fp, errno);
  err:
-  ctf_err_warn (fp, 1, 0, _("cannot format name dumping type 0x%lx"), id);
+  ctf_err_warn (fp, 1, ctf_errno (fp), _("cannot format name dumping type 0x%lx"),
+               id);
   free (buf);
   free (str);
   free (bit);