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);
#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;
}
It doesn't work for me. Here is my environment:
Name : Code::Blocks
Version : 20.03-r11983
SDK Version : 2.0.0
Scintilla Version: 3.7.5
Author : The Code::Blocks Team
E-mail : info@codeblocks.org
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)
Does any additional information can help?
here is the debug log: :P
[debug]Reading symbols from D:/git/codeblock/bin/Debug/codeblock.exe...done.
[debug](gdb)
[debug]> set prompt >>>>>>cb_gdb:
Setting breakpoints
[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 8.1
[debug]Copyright (C) 2018 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law. Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "x86_64-w64-mingw32".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off
Debugger name and version: GNU gdb (GDB) 8.1
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> directory D:/git/codeblock/
[debug]Source directories searched: D:/git/codeblock;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: D:\git\codeblock\bin\Debug\codeblock.exe
Child process PID: 14676
[debug][New Thread 14676.0x6bf8]
[debug][New Thread 14676.0x8b4c]
[debug][New Thread 14676.0x65ac]
[debug][New Thread 14676.0x8dfc]
[debug]Thread 1 hit Catchpoint 1 (exception thrown), 0x000000006fd41c08 in libstdc++-6!.cxa_throw () from D:\Program Files (x86)\scoop\apps\gcc\current\bin\libstdc++-6.dll
[debug]>>>>>>cb_gdb:
[debug]> info frame
Debugger finished with status 1
yes msys2 has python support. Nice!
$ gdb
GNU gdb (GDB) 9.2
Copyright (C) 2020 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-pc-msys".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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".
Traceback (most recent call last):
File "<string>", line 3, in <module>
ModuleNotFoundError: No module named 'libstdcxx'
/etc/gdbinit:6: Error in sourced command file:
Error while executing Python code.
(gdb) python
>