public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: "Alexandra Hájková" <ahajkova@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: defer warnings when loading separate debug files
Date: Thu, 15 Dec 2022 11:35:48 -0500	[thread overview]
Message-ID: <a581d641-8c49-3ce3-37e9-b55c6d03de04@simark.ca> (raw)
In-Reply-To: <20221212121535.4013497-1-ahajkova@redhat.com>

On 12/12/22 07:15, AlexandraH á jkov á ahajkova--- via Gdb-patches wrote:
> From: Alexandra Hájková <ahajkova@redhat.com>
> 
> Currently, when GDB loads debug information from a separate debug file,
> there are a couple of warnings that could be produced if things go
> wrong.
> 
> In find_separate_debug_file_by_buildid (build-id.c) GDB can give a
> warning if the separate debug file doesn't include any actual debug
> information, and in separate_debug_file_exists (symfile.c) we can warn
> if the CRC checksum in the separate debug file doesn't match the
> checksum in the original executable.
> 
> The problem here is that, when looking up debug information, GDB will
> try several different approaches, lookup by build-id, lookup by
> debug-link, and then a lookup from debuginfod.  GDB can potentially give
> a warning from an earlier attempt, and then succeed with a later
> attempt.  In the cases I have run into this is primarily a warning about
> some out of date debug information on my machine, but then GDB finds the
> correct information using debuginfod.  This can be confusing to a user,
> they will see warnings from GDB when really everything is working just
> fine.
> 
> For example:
> warning: the debug information found in "/usr/lib/debug//lib64/ld-2.32.so.debug"
> does not match "/lib64/ld-linux-x86-64.so.2" (CRC mismatch).
> 
> This diagnostic was printed on Fedora 33 even when the correct debuginfo
> was downloaded.
> 
> In this patch I propose that we defer any warnings related to looking up
> debug information from a separate debug file.  If any of the approaches
> are successful then GDB will not print any of the warnings.  As far as
> the user is concerned, everything "just worked".  Only if GDB completely
> fails to find any suitable debug information will the warnings be
> printed.

I don't really like this behavior change.  The situations you described:

 - a separate debug file without any actual debug information
 - CRC checksum that doesn't match

... are abnormal situations which still deserve being warned about, I
think.  If the files are there, it's because they are meant to be used,
so if something prevents GDB from using them, I want to know.  Silencing
the warning just makes investigating "why doesn't GDB read my separate
debug file" harder.

I can understand why this can be a bit confusing to the user, but
the warning is still factually correct.  For instance, the one you
quoted:

    warning: the debug information found in "/usr/lib/debug//lib64/ld-2.32.so.debug"
    does not match "/lib64/ld-linux-x86-64.so.2" (CRC mismatch).

This doesn't say that GDB didn't end up finding *some* debug info for
the shared object, just that this particular one is broken.  Maybe it's
an old one I installed by hand, that I should delete, maybe the package
from the distro is broken.  In any case it's good for the user to know
so they can fix the situation.

Simon

  parent reply	other threads:[~2022-12-15 16:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 12:15 AlexandraH=?UTF-8?B?w6E=?=jkov=?UTF-8?B?w6E=?=ahajkova
2022-12-15 15:57 ` Bruno Larsen
2022-12-15 16:35 ` Simon Marchi [this message]
     [not found]   ` <CAJVr-EOShPVS_ZBvfHqKkbPK1O3d+92DDbpEoeBVr1_s7_XWYA@mail.gmail.com>
2022-12-19 12:28     ` Fwd: " Alexandra Petlanova Hajkova
2022-12-19 13:04   ` Frank Ch. Eigler
2022-12-19 14:43   ` Andrew Burgess
2022-12-20  2:29     ` Simon Marchi

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=a581d641-8c49-3ce3-37e9-b55c6d03de04@simark.ca \
    --to=simark@simark.ca \
    --cc=ahajkova@redhat.com \
    --cc=gdb-patches@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).