public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/25955] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)
@ 2020-05-09 10:20 vries at gcc dot gnu.org
2020-05-09 10:20 ` [Bug c++/25955] " vries at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-09 10:20 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=25955
Bug ID: 25955
Summary: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with
invalid regexp: run until breakpoint in main (unknown
output after running)
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: c++
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
When running test-case gdb.mi/mi-catch-cpp-exceptions.exp, I run into:
...
PASS: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: Setup
-catch-catch
-exec-continue^M
^running^M
*running,thread-id="all"^M
(gdb) ^M
=breakpoint-modified,bkpt={number="13",type="catchpoint",disp="keep",enabled="y",what="exception
throw",catch-type="throw",thread-groups=["i1"],regexp="blahblah",times="1"}^M
mi_expect_stop: expecting:
\*stopped,reason="breakpoint-hit",disp="keep",bkptno="[0-9]+",frame={addr="0x[0-9A-Fa-f]+",func="main",args=\[.*\],(?:file="[^
]*.*",fullname="(/[^\n]*/|\\\\[^\\]+\\[^\n]+\\|\\[^\\][^\n]*\\|[a-zA-Z]:[^\n]*\\).*",line="67",arch="[^
]*"|from=".*")}.*,thread-id="[0-9]+",stopped-threads=[^
]*^M
(=thread-selected,id="[0-9]+"^M
|=(?:breakpoint-created|breakpoint-deleted)[^
]+"^M
)*[(]gdb[)] ^M
$
~"\n"^M
~"Catchpoint 13 (exception thrown), 0x00007ffff7ab037e in __cxa_throw () from
/usr/lib64/libstdc++.so.6\n"^M
*stopped,bkptno="13",reason="breakpoint-hit",disp="keep",frame={addr="0x00007ffff7ab037e",func="__cxa_throw",args=[],from="/usr/lib64/libstdc++.so.6",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="0"^M
(gdb) ^M
got
=breakpoint-modified,bkpt={number="13",type="catchpoint",disp="keep",enabled="y",what="exception
throw",catch-type="throw",thread-groups=["i1"],regexp="blahblah",times="1"}^M
~"\n"^M
~"Catchpoint 13 (exception thrown), 0x00007ffff7ab037e in __cxa_throw () from
/usr/lib64/libstdc++.so.6\n"^M
*stopped,bkptno="13",reason="breakpoint-hit",disp="keep",frame={addr="0x00007ffff7ab037e",func="__cxa_throw",args=[],from="/usr/lib64/libstdc++.so.6",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="0"^M
(gdb) ^M
FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until
breakpoint in main (unknown output after running)
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25955] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)
2020-05-09 10:20 [Bug c++/25955] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running) vries at gcc dot gnu.org
@ 2020-05-09 10:20 ` vries at gcc dot gnu.org
2020-05-09 10:24 ` vries at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-09 10:20 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=25955
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Bisects to:
commit 596dc4adfff347b4d8dc1f7e4eb57b8f2f342281 (HEAD, refs/bisect/bad)
Author: Tom Tromey <tom@tromey.com>
Date: Fri May 8 14:14:05 2020 -0600
Speed up psymbol reading by removing a copy
I noticed that cp_canonicalize_string and friends copy a
unique_xmalloc_ptr to a std::string. However, this copy isn't
genuinely needed anywhere, and it serves to slow down DWARF psymbol
reading.
This patch removes the copy and updates the callers to adapt.
This speeds up the reader from 1.906 seconds (mean of 10 runs, of gdb
on a copy of itself) to 1.888 seconds (mean of 10 runs, on the same
copy as the first trial).
gdb/ChangeLog
2020-05-08 Tom Tromey <tom@tromey.com>
* symtab.h (class demangle_result_storage) <set_malloc_ptr>: New
overload.
<swap_string, m_string>: Remove.
* symtab.c (demangle_for_lookup, completion_list_add_symbol):
Update.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25955] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)
2020-05-09 10:20 [Bug c++/25955] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running) vries at gcc dot gnu.org
2020-05-09 10:20 ` [Bug c++/25955] " vries at gcc dot gnu.org
@ 2020-05-09 10:24 ` vries at gcc dot gnu.org
2020-05-09 11:31 ` vries at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-09 10:24 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=25955
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Before the offending commit, we have:
...
PASS: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: Setup
-catch-catch
-exec-continue
^running
*running,thread-id="all"
(gdb)
mi_expect_stop: expecting:
\*stopped,reason="breakpoint-hit",disp="keep",bkptno="[0-9]+",frame={addr="0x[0-9A-Fa-f]+",func="main",args=\[.*\],(?:file="[^
]*.*",fullname="(/[^\n]*/|\\\\[^\\]+\\[^\n]+\\|\\[^\\][^\n]*\\|[a-zA-Z]:[^\n]*\\).*",line="67",arch="[^
]*"|from=".*")}.*,thread-id="[0-9]+",stopped-threads=[^
]*
(=thread-selected,id="[0-9]+"
|=(?:breakpoint-created|breakpoint-deleted)[^
]+"
)*[(]gdb[)]
$
=breakpoint-modified,bkpt={number="12",type="breakpoint",disp="keep",enabled="y",addr="0x00000000004008e5",func="main()",file="/data/gdb_versions/devel/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc",fullname="/data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc",line="67",thread-groups=["i1"],times="1",original-location="mi-catch-cpp-exceptions.cc:67"}
~"\n"
~"Breakpoint 12, main () at
/data/gdb_versions/devel/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc:67\n"
~"67\t\t return 1;\t/* Stop here. */\n"
*stopped,reason="breakpoint-hit",disp="keep",bkptno="12",frame={addr="0x00000000004008e5",func="main",args=[],file="/data/gdb_versions/devel/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc",fullname="/data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc",line="67",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="3"
(gdb)
PASS: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until
breakpoint in main
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25955] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)
2020-05-09 10:20 [Bug c++/25955] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running) vries at gcc dot gnu.org
2020-05-09 10:20 ` [Bug c++/25955] " vries at gcc dot gnu.org
2020-05-09 10:24 ` vries at gcc dot gnu.org
@ 2020-05-09 11:31 ` vries at gcc dot gnu.org
2020-05-09 12:02 ` vries at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-09 11:31 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=25955
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Reproduce with command line:
...
$ gdb \
-batch \
./outputs/gdb.mi/mi-catch-cpp-exceptions/mi-catch-cpp-exceptions \
-ex "break 67" \
-ex "catch throw -r blahblah" \
-ex r
Breakpoint 1 at 0x4008e5: file mi-catch-cpp-exceptions.cc, line 67.
Catchpoint 2 (throw)
Catchpoint 2 (exception thrown), 0x00007ffff7ab037e in __cxa_throw () from
/usr/lib64/libstdc++.so.6
...
Before commit:
...
$ gdb \
-batch \
./outputs/gdb.mi/mi-catch-cpp-exceptions/mi-catch-cpp-exceptions \
-ex "break 67" \
-ex "catch throw -r blahblah" \
-ex r
Breakpoint 1 at 0x4008e5: file mi-catch-cpp-exceptions.cc, line 67.
Catchpoint 2 (throw)
Breakpoint 1, main () at mi-catch-cpp-exceptions.cc:67
67 return 1; /* Stop here. */
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25955] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)
2020-05-09 10:20 [Bug c++/25955] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running) vries at gcc dot gnu.org
` (2 preceding siblings ...)
2020-05-09 11:31 ` vries at gcc dot gnu.org
@ 2020-05-09 12:02 ` vries at gcc dot gnu.org
2020-05-09 12:08 ` vries at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-09 12:02 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=25955
--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Before the commit, we have in check_status_exception_catchpoint:
...
(gdb) n
150 std::string type_name;
(gdb)
152 bkpt_breakpoint_ops.check_status (bs);
(gdb)
153 if (bs->stop == 0)
(gdb)
156 if (self->pattern == NULL)
(gdb)
162 std::string canon;
(gdb)
164 fetch_probe_arguments (NULL, &typeinfo_arg);
(gdb)
165 type_name = cplus_typename_from_type_info (typeinfo_arg);
(gdb)
167 canon = cp_canonicalize_string (type_name.c_str ());
(gdb) p type_name
$1 = "my_exception"
(gdb) n
168 if (!canon.empty ())
(gdb) p canon
$2 = ""
(gdb) n
162 std::string canon;
(gdb)
176 if (!type_name.empty ())
(gdb)
178 if (self->pattern->exec (type_name.c_str (), 0, NULL, 0) != 0)
(gdb) p type_name.c_str ()
$3 = 0x7fffffffce10 "my_exception"
...
And after the commit, we have:
...
(gdb) n
150 std::string type_name;
(gdb)
152 bkpt_breakpoint_ops.check_status (bs);
(gdb)
153 if (bs->stop == 0)
(gdb)
156 if (self->pattern == NULL)
(gdb)
159 const char *name = nullptr;
(gdb)
160 gdb::unique_xmalloc_ptr<char> canon;
(gdb)
165 fetch_probe_arguments (NULL, &typeinfo_arg);
(gdb)
166 type_name = cplus_typename_from_type_info (typeinfo_arg);
(gdb)
168 canon = cp_canonicalize_string (type_name.c_str ());
(gdb) p type_name
$1 = "my_exception"
(gdb) n
169 name = (canon == nullptr
(gdb) p canon
$2 = std::unique_ptr<char> = {get() = 0x0}
(gdb) n
170 ? canon.get ()
(gdb)
169 name = (canon == nullptr
(gdb)
178 if (name != nullptr)
(gdb) p name
$3 = 0x0
(gdb) n
160 gdb::unique_xmalloc_ptr<char> canon;
(gdb) n
150 std::string type_name;
(gdb) n
183 }
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25955] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)
2020-05-09 10:20 [Bug c++/25955] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running) vries at gcc dot gnu.org
` (3 preceding siblings ...)
2020-05-09 12:02 ` vries at gcc dot gnu.org
@ 2020-05-09 12:08 ` vries at gcc dot gnu.org
2020-05-09 12:24 ` [Bug gdb/25955] " vries at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-09 12:08 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=25955
--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index 59293c4e57..7f4a9f955d 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -166,7 +166,7 @@ check_status_exception_catchpoint (struct bpstats *bs)
type_name = cplus_typename_from_type_info (typeinfo_arg);
canon = cp_canonicalize_string (type_name.c_str ());
- name = (canon == nullptr
+ name = (canon != nullptr
? canon.get ()
: type_name.c_str ());
}
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug gdb/25955] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)
2020-05-09 10:20 [Bug c++/25955] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running) vries at gcc dot gnu.org
` (4 preceding siblings ...)
2020-05-09 12:08 ` vries at gcc dot gnu.org
@ 2020-05-09 12:24 ` vries at gcc dot gnu.org
2020-05-09 18:17 ` cvs-commit at gcc dot gnu.org
2020-05-09 18:19 ` vries at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-09 12:24 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=25955
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |gdb
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug gdb/25955] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)
2020-05-09 10:20 [Bug c++/25955] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running) vries at gcc dot gnu.org
` (5 preceding siblings ...)
2020-05-09 12:24 ` [Bug gdb/25955] " vries at gcc dot gnu.org
@ 2020-05-09 18:17 ` cvs-commit at gcc dot gnu.org
2020-05-09 18:19 ` vries at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-09 18:17 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=25955
--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4343499695830fbd4bfe75058fc5570e280ba831
commit 4343499695830fbd4bfe75058fc5570e280ba831
Author: Tom de Vries <tdevries@suse.de>
Date: Sat May 9 20:17:10 2020 +0200
[gdb] Fix catch throw regexp matching
When running test-case gdb.mi/mi-catch-cpp-exceptions.exp, we have:
...
FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run
until \
breakpoint in main (unknown output after running)
...
This is a regression since commit 596dc4adff "Speed up psymbol reading by
removing a copy".
Before that commit, we have:
...
$ gdb \
-batch \
./outputs/gdb.mi/mi-catch-cpp-exceptions/mi-catch-cpp-exceptions \
-ex "break 67" \
-ex "catch throw -r blahblah" \
-ex r
Breakpoint 1 at 0x4008e5: file mi-catch-cpp-exceptions.cc, line 67.
Catchpoint 2 (throw)
Breakpoint 1, main () at mi-catch-cpp-exceptions.cc:67
67 return 1; /* Stop here. */
...
In other words:
- we set a breakpoint somewhere in main,
- we set a catchpoint with a regexp that is intended to not match any
exception, and
- run to the breakpoint, without the catchpoint triggering.
After the commit, we have:
...
$ gdb \
-batch \
./outputs/gdb.mi/mi-catch-cpp-exceptions/mi-catch-cpp-exceptions \
-ex "break 67" \
-ex "catch throw -r blahblah" \
-ex r
Breakpoint 1 at 0x4008e5: file mi-catch-cpp-exceptions.cc, line 67.
Catchpoint 2 (throw)
Catchpoint 2 (exception thrown), 0x00007ffff7ab037e in __cxa_throw () from
\
/usr/lib64/libstdc++.so.6
...
In other words, the catchpoint triggers.
This is caused by this bit of the commit:
...
type_name = cplus_typename_from_type_info (typeinfo_arg);
canon = cp_canonicalize_string (type_name.c_str ());
- if (!canon.empty ())
- std::swap (type_name, canon);
+ name = (canon == nullptr
+ ? canon.get ()
+ : type_name.c_str ());
}
catch (const gdb_exception_error &e)
{
exception_print (gdb_stderr, e);
}
- if (!type_name.empty ())
+ if (name != nullptr)
{
- if (self->pattern->exec (type_name.c_str (), 0, NULL, 0) != 0)
+ if (self->pattern->exec (name, 0, NULL, 0) != 0)
...
Before the commit, we have:
- type_name == "my_exception"
- canon = ""
and the !type_name.empty () test succeeds, and gdb executes the
self->pattern->exec call.
After the commit, we have:
- type_name == "my_exception"
- canon == NULL
- name == NULL
and the name != nullptr test fails, and gdb doesn't execute the
self->pattern->exec call.
Fix this by inverting the condition for the calculation of name:
...
- name = (canon == nullptr
+ name = (canon != nullptr
...
Build and tested on x86_64-linux.
gdb/ChangeLog:
2020-05-09 Tom de Vries <tdevries@suse.de>
PR gdb/25955
* break-catch-throw.c (check_status_exception_catchpoint): Fix name
calculation.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug gdb/25955] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)
2020-05-09 10:20 [Bug c++/25955] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running) vries at gcc dot gnu.org
` (6 preceding siblings ...)
2020-05-09 18:17 ` cvs-commit at gcc dot gnu.org
@ 2020-05-09 18:19 ` vries at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-09 18:19 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=25955
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch with fix committed, marking resolved-fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-05-09 18:19 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09 10:20 [Bug c++/25955] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running) vries at gcc dot gnu.org
2020-05-09 10:20 ` [Bug c++/25955] " vries at gcc dot gnu.org
2020-05-09 10:24 ` vries at gcc dot gnu.org
2020-05-09 11:31 ` vries at gcc dot gnu.org
2020-05-09 12:02 ` vries at gcc dot gnu.org
2020-05-09 12:08 ` vries at gcc dot gnu.org
2020-05-09 12:24 ` [Bug gdb/25955] " vries at gcc dot gnu.org
2020-05-09 18:17 ` cvs-commit at gcc dot gnu.org
2020-05-09 18:19 ` 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).