From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2103) id 929043849AE1; Fri, 19 Apr 2024 15:52:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 929043849AE1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713541930; bh=DRRKX8ZuMUMITtVy+QQ14RRPYifW8kF07unEdE/vR7s=; h=From:To:Subject:Date:From; b=VTzEfNkbgDPysdt2lCiqpQinPvNFLwN6oGaHcwGYceUN/rqKL7RO34wq/zz+Cc0Hu prUY1Wq0dO04u/9BXC1aj8wMzL/SbGEK0eLP2lCUpQYMfInd9XWC9AMigu1qZbHNvs FTR+rLU2YthjNEcXu6/7om2Go8q7FwI21+vgGj+I= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Nick Alcock To: binutils-cvs@sourceware.org Subject: [binutils-gdb] libctf: improve handling of type dumping errors X-Act-Checkin: binutils-gdb X-Git-Author: Nick Alcock X-Git-Refname: refs/heads/master X-Git-Oldrev: eb244227d83c81fa17ec2f5ddc933945b14217fd X-Git-Newrev: 0ebf1bdeeda1612dbe8e092dca765527a741e462 Message-Id: <20240419155210.929043849AE1@sourceware.org> Date: Fri, 19 Apr 2024 15:52:10 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D0ebf1bdeeda1= 612dbe8e092dca765527a741e462 commit 0ebf1bdeeda1612dbe8e092dca765527a741e462 Author: Nick Alcock Date: Tue Apr 2 13:48:13 2024 +0100 libctf: improve handling of type dumping errors =20 When dumping a type fails with an error, we want to emit a warning noti= ng this: a warning because it's not fatal and we can continue. But warnin= gs don't automatically print out the ctf_errno (because not all cases caus= ing warnings set the errno at all), so we must do it at warning-emission ti= me or lose track of what's gone wrong. =20 libctf/ =20 * ctf-dump.c (ctf_dump_format_type): Dump the underlying error = on type dump failure. Diff: --- libctf/ctf-dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index 2213d09dc29..80a3b265297 100644 --- a/libctf/ctf-dump.c +++ b/libctf/ctf-dump.c @@ -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);