User forums > Using Code::Blocks

Debug will not stop when exception 'std::out_of_range' appears

(1/2) > >>

syheliel:
I have the following code. After executing, a message terminate called after throwing an instance of 'std::out_of_range' will appear. But in debug mode, this exception will not be caught.
My expectation result is that debug mode can stop on the corresponding line on s.substr(2,33);


--- Code: ---#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<iostream>
#include<cmath>
typedef long long ll;
using namespace std;

int main() {
string s = "2" ;
s.substr(2,33);
    return 0;
}

--- End code ---

oBFusCATed:
Settings -> Debugger -> Your config -> Catch C++ exceptions

syheliel:
It doesn't work for me. Here is my environment:


--- Code: ---Name             : Code::Blocks
Version          : 20.03-r11983
SDK Version      : 2.0.0
Scintilla Version: 3.7.5
Author           : The Code::Blocks Team
E-mail           : [email protected]
Website          : http://www.codeblocks.org

wxWidgets Library (wxMSW port)
Version 3.1.3 (Unicode: wchar_t, debug level: 1),
compiled at Nov  1 2019 18:53:26

Runtime version of toolkit used is 10.0.

wx3.1.3 - gcc 8.1.0 (Windows,unicode)
--- End code ---

Does any additional information can help?

oBFusCATed:
Yes, enable full debugger log and post a session.

BlueHazzard:

--- Quote from: oBFusCATed on May 04, 2021, 10:16:22 am ---Yes, enable full debugger log and post a session.

--- End quote ---
To do this:
Settings->Debugger->Common->Full debug log
Start debugger
post the content of the "Debugger" tab from the log view at the bottom

Navigation

[0] Message Index

[#] Next page

Go to full version