public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug cli/30735] New: [gdb/cli] demangler warnings missing until later command
@ 2023-08-08 10:04 vries at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: vries at gcc dot gnu.org @ 2023-08-08 10:04 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-08 10:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08 10:04 [Bug cli/30735] New: [gdb/cli] demangler warnings missing until later command vries at gcc dot gnu.org

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).