[Bug mi/24830] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug mi/24830] New: FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24830

            Bug ID: 24830
           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: mi
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

...
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
&"not stopped at a C++ exception catchpoint\n"^M
=breakpoint-modified,bkpt={number="12",type="catchpoint",disp="keep",enabled="y",what="exception
throw",catch-type="throw",thread-groups=["i1"],regexp="blahblah",times="1"}^M
~"\n"^M
~"Catchpoint 12 (exception thrown), 0x00007ffff7ae7010 in __cxa_throw () from
/usr/lib64/libstdc++.so.6\n"^M
*stopped,bkptno="12",reason="breakpoint-hit",disp="keep",frame={addr="0x00007ffff7ae7010",func="__cxa_throw",args=[],from="/usr/lib64/libstdc++.so.6",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="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
$
(gdb) ^M
got &"not stopped at a C++ exception catchpoint\n"^M
=breakpoint-modified,bkpt={number="12",type="catchpoint",disp="keep",enabled="y",what="exception
throw",catch-type="throw",thread-groups=["i1"],regexp="blahblah",times="1"}^M
~"\n"^M
~"Catchpoint 12 (exception thrown), 0x00007ffff7ae7010 in __cxa_throw () from
/usr/lib64/libstdc++.so.6\n"^M
*stopped,bkptno="12",reason="breakpoint-hit",disp="keep",frame={addr="0x00007ffff7ae7010",func="__cxa_throw",args=[],from="/usr/lib64/libstdc++.so.6",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="1"^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.
Reply | Threaded
Open this post in threaded view
|

[Bug mi/24830] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24830

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 11915
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11915&action=edit
gdb.log

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug mi/24830] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24830

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
I've rewritten the problem into a command line (not using mi):
...
$ ./gdb -nw -nx -data-directory
/data/gdb_versions/devel/build/gdb/testsuite/../data-directory -q -batch
./build/gdb/testsuite/outputs/gdb.mi/mi-catch-cpp-exceptions/mi-catch-cpp-exceptions
-ex "tb main" -ex run -ex "b 67" -ex "catch throw -r blahblah" -ex continue
Temporary breakpoint 1 at 0x4008a4: file
/data/gdb_versions/devel/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc,
line 58.

Temporary breakpoint 1, main () at
/data/gdb_versions/devel/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc:58
58        for (int i = 0; i < 2; ++i)
Breakpoint 2 at 0x4008e5: file
/data/gdb_versions/devel/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc,
line 67.
Catchpoint 3 (throw)
not stopped at a C++ exception catchpoint

Catchpoint 3 (exception thrown), 0x00007ffff7ae7010 in __cxa_throw () from
/usr/lib64/libstdc++.so.6
...

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug mi/24830] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24830

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
And on ubuntu 18.04 I get:
...
$ ./gdb -nw -nx -q -batch
./build/gdb/testsuite/outputs/gdb.mi/mi-catch-cpp-exceptions/mi-catch-cpp-exceptions
-ex "tb main" -ex run -ex "b 67" -ex "catch throw -r blahblah" -ex continue
Temporary breakpoint 1 at 0x9d9: file
/home/vries/gdb/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc, line 58.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Temporary breakpoint 1, main () at
/home/vries/gdb/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc:58
58        for (int i = 0; i < 2; ++i)
Breakpoint 2 at 0x555555554a1a: file
/home/vries/gdb/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc, line 67.
Catchpoint 3 (throw)

Breakpoint 2, main () at
/home/vries/gdb/src/gdb/testsuite/gdb.mi/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.
Reply | Threaded
Open this post in threaded view
|

[Bug mi/24830] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24830

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)

> I've rewritten the problem into a command line (not using mi):
> ...
> $ ./gdb -nw -nx -data-directory
> /data/gdb_versions/devel/build/gdb/testsuite/../data-directory -q -batch
> ./build/gdb/testsuite/outputs/gdb.mi/mi-catch-cpp-exceptions/mi-catch-cpp-
> exceptions -ex "tb main" -ex run -ex "b 67" -ex "catch throw -r blahblah"
> -ex continue
> Temporary breakpoint 1 at 0x4008a4: file
> /data/gdb_versions/devel/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc,
> line 58.
>
> Temporary breakpoint 1, main () at
> /data/gdb_versions/devel/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc:
> 58
> 58        for (int i = 0; i < 2; ++i)
> Breakpoint 2 at 0x4008e5: file
> /data/gdb_versions/devel/src/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc,
> line 67.
> Catchpoint 3 (throw)
> not stopped at a C++ exception catchpoint
>
> Catchpoint 3 (exception thrown), 0x00007ffff7ae7010 in __cxa_throw () from
> /usr/lib64/libstdc++.so.6
> ...


So, we end up in check_status_exception_catchpoint, where we go into the "if
(self->pattern != NULL)" case (due to the -r blahblah), and call
fetch_probe_arguments.  There we get a pc using get_frame_pc, but when doing:
...
  pc_probe = find_probe_by_pc (pc);
...
we end up with a NULL pc_probe, and run into the error:
...
  if (pc_probe.prob == NULL
      || pc_probe.prob->get_provider () != "libstdcxx"
      || (pc_probe.prob->get_name () != "catch"
          && pc_probe.prob->get_name () != "throw"
          && pc_probe.prob->get_name () != "rethrow"))
    error (_("not stopped at a C++ exception catchpoint"));
...
which is caught in check_status_exception_catchpoint, where we fail to set
bs->stop to 0, and consequently, we hit the catchpoint.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug mi/24830] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24830

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
This fails because on libstdc++.so.6 on openSUSE leap 15.0 does not contain
systemtap probe descriptors, while libstdc++.so.6 on ubuntu 18.04 does contains
those (visible with readelf -n).


Doc confirms (
https://sourceware.org/gdb/current/onlinedocs/gdb/Set-Catchpoints.html#Set-Catchpoints
):
...
The regular expression feature and the $_exception convenience variable rely on
the presence of some SDT probes in libstdc++. If these probes are not present,
then these features cannot be used. These probes were first available in the
GCC 4.8 release, but whether or not they are available in your GCC also depends
on how it was built.
...

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug mi/24830] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24830

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
It would be good to test whether catch points with regexps are supported at the
point that we set them, rather than giving this "not stopped at a C++ exception
catchpoint" error when encountering pc_probe.prob == NULL.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug mi/24830] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24830

--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/ml/gdb-patches/2019-07/msg00557.html

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug mi/24830] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24830

--- Comment #8 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #6)
> It would be good to test whether catch points with regexps are supported at
> the point that we set them, rather than giving this "not stopped at a C++
> exception catchpoint" error when encountering pc_probe.prob == NULL.

Filed PR24852 - "Improve error message for catch catch/rethow/catch command
when using libstdc++ without SDT probes", which looks easier to implement.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug mi/24830] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24830

--- Comment #9 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 <[hidden email]>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=297989a10c56aec56eab0ee63f1e61c33ab20905

commit 297989a10c56aec56eab0ee63f1e61c33ab20905
Author: Tom de Vries <[hidden email]>
Date:   Thu Jul 25 18:39:31 2019 +0200

    [gdb/testsuite] Test skip_libstdcxx_probe_tests in
mi-catch-cpp-exceptions.exp

    On a system without SDT probes in libstdc++, we run into:
    ...
    FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run
until \
      breakpoint in main (unknown output after running)
    ...

    The test-case uses a regexp argument for the catch throw/rethrow/catch
    command, which is only supported on systems with SDT probes in libstdc++.

    Fix this by marking the portions of the test-case that use a regexp
argument
    as unsupported on a system without SDT probes.

    Tested on x86_64-linux.

    gdb/testsuite/ChangeLog:

    2019-07-25  Tom de Vries  <[hidden email]>

        PR testsuite/24830
        * gdb.mi/mi-catch-cpp-exceptions.exp: Call
        mi_skip_libstdcxx_probe_tests, and skip unsupported tests.
        * lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Factor out of ...
        (skip_libstdcxx_probe_tests): ... here.
        * lib/mi-support.exp (mi_skip_libstdcxx_probe_tests): New proc.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug mi/24830] FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until breakpoint in main (unknown output after running)

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24830

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch committed, marking resolved-fixed.

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