public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug cli/30735] New: [gdb/cli] demangler warnings missing until later command
Date: Tue, 08 Aug 2023 10:04:58 +0000	[thread overview]
Message-ID: <bug-30735-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 30735
           Summary: [gdb/cli] demangler warnings missing until later
                    command
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: cli
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I wanted to test this patch (
https://sourceware.org/pipermail/gdb-patches/attachments/20230808/90334ae3/attachment.bin
) in more detail so I added this code:
...
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 0300727434d..18addf936ac 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1666,6 +1666,7 @@ gdb_demangle (const char *name, int options)
            {
              report_failed_demangle (copy.c_str (), core_dump_allowed,
                                      crash_signal);
+             gdb_assert (false);
            });

          result = NULL;
...
and ran the testsuite.

That didn't trigger anything, so some unit test would probably be a good idea.

Then I decided to force it, by doing:
...
diff --git a/bfd/bfd.c b/bfd/bfd.c
index e43a388ac72..4ec4d09c972 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -2635,6 +2635,11 @@ bfd_demangle (bfd *abfd, const char *name, int options)
   size_t pre_len;
   bool skip_lead;

+  char *p = NULL;
+  *p = 0;
+
   skip_lead = (abfd != NULL
               && *name != '\0'
               && bfd_get_symbol_leading_char (abfd) == *name);
...

That indeed did the trick:
...
$ gdb -q -batch a.out -ex start
Temporary breakpoint 1 at 0x40051b
/data/vries/gdb/src/gdb/cp-support.c:1584: demangler-warning: unable to
demangle '_init' (demangler failed with signal 11)
Attempting to dump core.
/data/vries/gdb/src/gdb/cp-support.c:1598: demangler-warning: unable to
demangle '_init' (demangler failed with signal 11)
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]

This is a bug, please report it.  For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>.
...

However, we have:
...
$ gdb.sh -q -batch a.out
$
...

What happened here is that:
- demangling was triggered,
- the sigsegv was triggered,
- the warning was scheduled using run_on_main_thread, but
- it was never printed.

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

                 reply	other threads:[~2023-08-08 10:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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-30735-4717@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).