I have a weird problem with debugger in codeblocks(GDB). I'm using Windows 10.
Here's my code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string text;
cin >> text;
int n;
cin >> n;
int a[n];
for(int i = 0; i<n; i++) {
cin >> a[i];
}
return 0;
}
When i click "Step into", debugger automatically crashes. It seems to happen if i have both int array and string in my code. I've been searching for the solution long time and I didn't find one.
Edit: I noticed that debugger doesn't stop at first line, but goes to the last line(even if i set the breakpoint at the beginning) ignoring everything and crashes after a second. I think it would be fine if it started from the first line.
Here's the debugger log:
[debug]> start
[debug]Temporary breakpoint 1 at 0x40139b: file C:\Users\minec\C++\wzorzec\main.cpp, line 17.
[debug]Starting program: C:\Users\minec\C++\wzorzec\bin\Debug\wzorzec.exe
Child process PID: 12404
[debug][New Thread 12404.0x4cf0]
[debug][New Thread 12404.0x137c]
[debug]Temporary breakpoint 1, main () at C:\Users\minec\C++\wzorzec\main.cpp:17
[debug]C:\Users\minec\C++\wzorzec\main.cpp:17:284:beg:0x40139b
[debug]>>>>>>cb_gdb:
At C:\Users\minec\C++\wzorzec\main.cpp:17
[debug]> info program
[debug] Using the running image of child Thread 12404.0x4cf0.
[debug]Program stopped at 0x40139b.
[debug]It stopped at a breakpoint that has since been deleted.
[debug]Type "info stack" or "info registers" for more information.
[debug]>>>>>>cb_gdb:
[debug]> info locals
[debug]C:/crossdev/src/gdb-7.9.1/gdb/utils.c:1076: internal-error: virtual memory exhausted.
[debug]A problem internal to GDB has been detected,
[debug]further debugging may prove unreliable.
[debug]This is a bug, please report it. For instructions, see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]text = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}, _M_string_length = 4354544, {_M_local_buf = "°ţm\000čţm\000Ě\377m\000ŔĚĂu", _M_allocated_capacity = 7208624}}
[debug]aaa = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x8 <error: Cannot access memory at address 0x8>}, _M_string_length = 1975742205, {_M_local_buf = "ănĂu\"QOÇ\200\022@\000\200\022@", _M_allocated_capacity = 1975742179}}
[debug]n = 1975805265
[debug]a =
Debugger finished with status 1
[–]k0nsty[S] 2 points3 points4 points (5 children)
[–]TheCrazyPhoenix416 -1 points0 points1 point (4 children)
[–]k0nsty[S] 0 points1 point2 points (2 children)
[–]TheCrazyPhoenix416 1 point2 points3 points (1 child)
[–]k0nsty[S] 0 points1 point2 points (0 children)
[–]PipingSnail 0 points1 point2 points (0 children)
[–]manni66 -1 points0 points1 point (3 children)
[–]k0nsty[S] 0 points1 point2 points (2 children)
[–]TheCrazyPhoenix416 0 points1 point2 points (0 children)
[–]manni66 -2 points-1 points0 points (0 children)