catchorg / catchorg/Catch2

Could not break into gdb debugger when facing unexpected exception

Open
#1,030 16 comments 24 reactions 0 assignees View on GitHub
Feature Request
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

## Description
It's in fact the same issue as #586, where unexpected exceptions in the tests don't break into the gdb debugger with arguments `-b --break`. According to @horenmar at #418, it should have been implemented in commits b634e59, 25d0177, e1c4a4b. However it still does not work as expected.

### Steps to reproduce
Follow the same steps in #586, the test reproducing this is as follows:
```
#define CATCH_CONFIG_MAIN
#include "catch.hpp"

TEST_CASE("exception") { throw "nobody expects the Spanish inquisition"; }
```

By compiling and running it under gdb:
```
g++ -g -std=c++0x tst.cpp && gdb --args ./a.out -b
Reading symbols from ./a.out...done.
(gdb) r
Starting program: a.out -b

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.out is a Catch v2.0.0-develop.4 host application.
Run with -? for options

-------------------------------------------------------------------------------
exception
-------------------------------------------------------------------------------
tst.cpp:4
...............................................................................

tst.cpp:4: FAILED:
due to unexpected exception with message:
nobody expects the Spanish inquisition

===============================================================================
test cases: 1 | 1 failed
assertions: 1 | 1 failed
```
the expected `SIGTRAP` doesn't happen.

### Extra information

* Catch version: **v2.0.0-develop.4** (also tried the single-header version on `master`)
* Operating System: **Ubuntu 16.04**
* Compiler+version: **gcc version 5.4.0** (also tried clang version 3.8.0-2ubuntu4)

Contributor guide

Open the contributing guide

Research direction

Start with the minimal test case and run it under gdb using the documented -b argument, then trace how Catch2 handles unexpected exceptions and the -b/--break option. Compare the behavior with the expected SIGTRAP and the implementation history referenced from issues #586 and #418; done means the reproducer breaks into gdb as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.