public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "denis.zinin at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug breakpoints/29548] New: Can't breakpoint __cxa_throw with Qt5Core.dll
Date: Mon, 05 Sep 2022 16:36:22 +0000	[thread overview]
Message-ID: <bug-29548-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 29548
           Summary: Can't breakpoint __cxa_throw with Qt5Core.dll
           Product: gdb
           Version: 12.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: denis.zinin at gmail dot com
  Target Milestone: ---

Windows 10. Debugged binary compiled with C++ 12.2.0 under MSYS2/Mingw64.

I can't set breakpoint on throwing exception (__cxa_throw) in Clion bundled gdb
12.1. The same problem with Mingw64 GDB 12.1 and Mingw64 GDB 11.1.

But all work with Mingw64 GDB 10.1.

On starting gdb:
---------------
GNU gdb (GDB; JetBrains IDE bundle; build 152) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Function "swift_willThrow" not defined.
Function "_CxxThrowException" not defined.
Function "swift_errorRetain" not defined.
unset env HOME
---------------

I see suspicious "not defined".

But the real problem in the following.

In non working bundled gdb 12.1:
--------------------------------
(gdb) info symbol __cxa_throw
__cxa_throw in section .text of
C:\Users\Veter\Desktop\Dev\_src\robo_003\cmake-build-debug\robo_001.exe
(gdb) info functions __cxa_throw
All functions matching regular expression "__cxa_throw":
Non-debugging symbols:
0x00007ff76b112108 __cxa_throw
0x00007ffe67a75f68 __cxa_throw_bad_array_new_length
0x00007ffe67a75f70 __cxa_throw
(gdb) info symbol 0x00007ff76b112108
__cxa_throw in section .text of
C:\Users\Veter\Desktop\Dev\_src\robo_003\cmake-build-debug\robo_001.exe
(gdb) info symbol 0x00007ffe67a75f70
__cxa_throw in section .text of C:\Users\Veter\Desktop\Dev\robo\Qt5Core.dll
(gdb) break __cxa_throw
Function "__cxa_throw" not defined.
Make breakpoint pending on future shared library load? (y or [n]) [answered N;
input not from terminal]
Breakpoint is not set.
-------------------------------

In working external Mingw64 gdb 10.1. Same exe and libraries:
-------------------------------
(gdb) info symbol __cxa_throw
__cxa_throw in section .text of
C:\Users\Veter\Desktop\Dev\_src\robo_003\cmake-build-debug\robo_001.exe
(gdb) info functions __cxa_throw
All functions matching regular expression "__cxa_throw":
Non-debugging symbols:
0x00007ffe670e5f68 __cxa_throw_bad_array_new_length
0x00007ffe670e5f70 __cxa_throw
(gdb) info symbol 0x00007ffe670e5f70
__cxa_throw in section .text of C:\Users\Veter\Desktop\Dev\robo\Qt5Core.dll
(gdb) break __cxa_throw
Note: breakpoint 2 also set at pc 0x7ffe670e5f70.
Note: breakpoint 2 also set at pc 0x7ff76b112108.
Breakpoint 7 at 0x7ff76b112108 (2 locations)
(gdb) info symbol 0x7ff76b112108
__cxa_throw in section .text of
C:\Users\Veter\Desktop\Dev\_src\robo_003\cmake-build-debug\robo_001.exe
Breakpoint is set successfully.
--------------------------------

Simple project to reproduce the problem.

CMakeLists.txt:
-----------------------------------
cmake_minimum_required(VERSION 3.23)
project(untitled1)

set(CMAKE_CXX_STANDARD 20)

set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Widgets REQUIRED)
include_directories(${Qt5Widgets_INCLUDES})
add_definitions(${Qt5Widgets_DEFINITIONS})
set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")

add_executable(untitled1 main.cpp)

target_link_libraries (untitled1 ${Qt5Widgets_LIBRARIES})
---------------------------------------

main.cpp:
------------------
#include <iostream>
#include <QtCore/QString>
#include <QApplication>
#include <QtWidgets>
#include <QObject>
class MainWindow : public QMainWindow {
    Q_OBJECT

    public:
        explicit MainWindow() {};
        ~MainWindow() override {};


    };
#include "main.moc"

int main(int argc, char *argv[]) {
    std::cout << "Hello, World!" << std::endl;

    QApplication app(argc, argv);
    QCoreApplication::setApplicationName("robot");
    QCoreApplication::setOrganizationName("Figvam");

    MainWindow mainWin{};
    mainWin.show();

    throw std::exception();

    return QApplication::exec();

}
-------------------------

Without Qt5 all work well.

It seems the problem that "(gdb)info functions __cxa_throw" return twice
__cxa_throw.

One from main binary, another from Qt5Core.dll.
-----------------------------------
(gdb) info functions __cxa_throw
All functions matching regular expression "__cxa_throw":
Non-debugging symbols:
0x00007ff76b112108 __cxa_throw
0x00007ffe67a75f68 __cxa_throw_bad_array_new_length
0x00007ffe67a75f70 __cxa_throw
------------------------------------

But in old gdb it return only one __cxa_throw.

"catch throw" is not resolve the problem. It's output: "Catchpoint 7 (throw)"
But on real throw program exited (not pause) with: [Thread 42504.0x7adc exited
with code 3] [Inferior 1 (process 42504) exited with code 03]".

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

             reply	other threads:[~2022-09-05 16:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05 16:36 denis.zinin at gmail dot com [this message]
2022-09-11 15:07 ` [Bug breakpoints/29548] " ssbssa at sourceware dot org
2023-12-05 17:47 ` cvs-commit at gcc dot gnu.org
2023-12-05 17:49 ` ssbssa at sourceware dot org

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