public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "amerey at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/29999] Bogus error message printed when debuginfod doesn't find source file
Date: Sat, 14 Jan 2023 01:07:15 +0000	[thread overview]
Message-ID: <bug-29999-4717-Pw5tKLRk6y@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29999-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29999

--- Comment #1 from Aaron Merey <amerey at redhat dot com> ---
Created attachment 14592
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14592&action=edit
patch

(In reply to Simon Marchi from comment #0)
> I think this use of errno, in print_source_lines_base, is incorrect:
> 
> https://gitlab.com/gnutools/binutils-gdb/-/blob/
> 6f9f448118eaeaf006f867a25699aef7d8c72770/gdb/source.c#L1357
> 
> The last thing we did before this was to call into debuginfod_find_source,
> which returned -2 (meaning ENOENT, which makes sense).  But the errno value
> after calling debuginfod_find_source is not defined, and I think this
> results in an error message that does not make sense.

It looks like errno gets set in find_and_open_source (in the case of ENOENT at
least) before the call to debuginfod_find_source:

https://gitlab.com/gnutools/binutils-gdb/-/blob/6f9f448118eaeaf006f867a25699aef7d8c72770/gdb/source.c#L1179

However function calls within debuginfod_find_source may end up reassigning
errno to a value unrelated to the status of the download, even if the download
is successful. debuginfod_find_source returns a negative errno indicating the
actual reason for a failed download. This is the errno that should be reported
to the user, not one related to routine cache creation, for example.

We also don't want to hide an errno set in find_and_open_source. debuginfod
errors are already reported in the debuginfod progress output, so I think we
should save errno before calling debuginfod_find_source and revert errno to the
saved value afterwards. This way both debuginfod errors and
find_and_open_source errors are correctly reported to the user.

I've attached a patch for this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-01-14  1:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13 14:49 [Bug gdb/29999] New: " simark at simark dot ca
2023-01-13 14:49 ` [Bug gdb/29999] " simark at simark dot ca
2023-01-14  1:07 ` amerey at redhat dot com [this message]
2023-01-14  1:14 ` simark at simark dot ca
2023-02-11  2:12 ` cvs-commit at gcc dot gnu.org
2023-02-11  2:16 ` amerey at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29999-4717-Pw5tKLRk6y@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).