gdbserver on Windows does not catch thrown exceptions

Bug #1969379 reported by Claude
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gdb-mingw-w64 (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

Base information:

Ubuntu 20.04.4 LTS (but likely to be the case with 22.04 too)
Affected package: gdb-mingw-w64-target

When the code being debugged on Windows using gdbserver is throwing exceptions, we expect the appropriate catch statements to be executed properly. Instead, the exception propagates all the way up to language library, which terminates the process.

Running the same program but outside gdbserver yield the correct behaviour (exception catched).

The version of gdbserver in Ubuntu 20.04 is 9.1.

The same bad behaviour was seen with gdb version upto and including 11.2.

The good behaviour occurs with gdbserver 12 (which is not release yet :-( ).
Please consider using gdb 12 as soon as possible.

Tags: gdb mingw-w64
Revision history for this message
Ethan Lin (mainsystemadmin) wrote :

IS there any logs to go with that?

Changed in gdb-mingw-w64 (Ubuntu):
status: New → Incomplete
Revision history for this message
Claude (clauder) wrote :

Sample source code:

#include<iostream>
#include <stdexcept>
int main()
{
    std::cout<<"Before the try block" << std::endl;

    try {
      throw std::runtime_error("Test exception");
    } catch (...) {
      std::cout << "Catched the exception" << std::endl;
    }

    std::cout<<"After the try block" << std::endl;
    return 0;
}

This is what get output when running gdbserver after an exception is thrown in the code being debugged.

Listening on port 2345
Remote debugging from host 192.168.70.8, port 44782
Before the try block
terminate called after throwing an instance of 'std::runtime_error'

Expected output (which is what is output when not running under gdbserver)

Before the try block
Catched the exception
After the try block

Revision history for this message
Claude (clauder) wrote :

The status is still incomplete but I added some information. In fact I added a minimal reproducible use case. Not sure if anything else is needed.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for gdb-mingw-w64 (Ubuntu) because there has been no activity for 60 days.]

Changed in gdb-mingw-w64 (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Claude (clauder) wrote :

Not sure why there was no activity on this bug. I answered to Ethan but there was no followup by him. What more is needed?

Changed in gdb-mingw-w64 (Ubuntu):
status: Expired → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for gdb-mingw-w64 (Ubuntu) because there has been no activity for 60 days.]

Changed in gdb-mingw-w64 (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.