#include <iostream>
#include <thread>
void ThreadProc()
{
std::cout << "I`m a thread!\n";
*(char*)NULL = 42; // Good bye, cruel world.
}
int main()
{
std::cout << "Hello!\n";
std::thread Thrd(ThreadProc);
Thrd.join();
std::cout << "Good bye\n";
}
Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: D:\Denis\Projects\TEST\GdbTest\
Adding source dir: D:\Denis\Projects\TEST\GdbTest\
Adding file: D:\Denis\Projects\TEST\GdbTest\bin\Debug\GdbTest.exe
Changing directory to: D:/Denis/Projects/TEST/GdbTest/.
Set variable: PATH=.;D:\gcc\TDM-GCC-64\bin;D:\gcc\TDM-GCC-64;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;E:\altera\13.0sp1\quartus\bin;C:\Program Files (x86)\CMake\bin;D:\MICRO\Linux;C:\Program Files\TortoiseHg;C:\Program Files\Git\cmd;D:\Denis\MyTools
[debug]Command-line: D:\gcc\TDM-GCC-64\gdb64\bin\gdb.exe -nx -fullname -quiet -args D:/Denis/Projects/TEST/GdbTest/bin/Debug/GdbTest.exe
[debug]Working dir : D:\Denis\Projects\TEST\GdbTest
Starting debugger: D:\gcc\TDM-GCC-64\gdb64\bin\gdb.exe -nx -fullname -quiet -args D:/Denis/Projects/TEST/GdbTest/bin/Debug/GdbTest.exe
done
[debug]> set prompt >>>>>>cb_gdb:
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
[debug]Reading symbols from D:/Denis/Projects/TEST/GdbTest/bin/Debug/GdbTest.exe...
[debug]done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.9.1
[debug]Copyright (C) 2015 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) 7.9.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 0
[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]> source C:\Program Files (x86)\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory D:\Denis\AlienSVN\SDL2\src
directory D:\Denis\AlienSVN\SDL2_image
directory D:\Denis\AlienSVN\SDL2_mixer
directory D:\Denis\AlienSVN\SDL2_net
directory D:\Denis\AlienSVN\SDL2_ttf
[debug]Source directories searched: D:DenisAlienSVNSDL2src;$cdir;$cwd
[debug]>>>>>>cb_gdb:Source directories searched: D:DenisAlienSVNSDL2_image;D:DenisAlienSVNSDL2src;$cdir;$cwd
[debug]> directory D:/Denis/Projects/TEST/GdbTest/
[debug]>>>>>>cb_gdb:Source directories searched: D:DenisAlienSVNSDL2_mixer;D:DenisAlienSVNSDL2_image;D:DenisAlienSVNSDL2src;$cdir;$cwd
[debug]>>>>>>cb_gdb:Source directories searched: D:DenisAlienSVNSDL2_net;D:DenisAlienSVNSDL2_mixer;D:DenisAlienSVNSDL2_image;D:DenisAlienSVNSDL2src;$cdir;$cwd
[debug]>>>>>>cb_gdb:Source directories searched: D:DenisAlienSVNSDL2_ttf;D:DenisAlienSVNSDL2_net;D:DenisAlienSVNSDL2_mixer;D:DenisAlienSVNSDL2_image;D:DenisAlienSVNSDL2src;$cdir;$cwd
[debug]>>>>>>cb_gdb:Source directories searched: D:/Denis/Projects/TEST/GdbTest;D:DenisAlienSVNSDL2_ttf;D:DenisAlienSVNSDL2_net;D:DenisAlienSVNSDL2_mixer;D:DenisAlienSVNSDL2_image;D:DenisAlienSVNSDL2src;$cdir;$cwd
[debug]>>>>>>cb_gdb:
Continuing...
[debug]> run
[debug]Starting program: D:\Denis\Projects\TEST\GdbTest\bin\Debug\GdbTest.exe
Child process PID: 2884
[debug][New Thread 2884.0xb78]
[debug][New Thread 2884.0xe88]
[debug]Program received signal SIGSEGV, Segmentation fault.
[debug][Switching to Thread 2884.0xe88]
[debug]0x000000000040168e in ThreadProc () at D:\Denis\Projects\TEST\GdbTest\main.cpp:8
[debug]D:\Denis\Projects\TEST\GdbTest\main.cpp:8:118:beg:0x40168e
[debug]>>>>>>cb_gdb:
Program received signal SIGSEGV, Segmentation fault.
At D:\Denis\Projects\TEST\GdbTest\main.cpp:8
[debug]> info locals
[debug]No locals.
[debug]>>>>>>cb_gdb:
[debug]> info args
[debug]No arguments.
[debug]>>>>>>cb_gdb:
[debug]> bt 30
[debug]#0 0x000000000040168e in ThreadProc () at D:\Denis\Projects\TEST\GdbTest\main.cpp:8
[debug]#1 0x0000000000471668 in std::_Bind_simple<void (*())()>::_M_invoke<>(std::_Index_tuple<>) (this=0x2d2368) at D:/gcc/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/functional:1531
[debug]#2 0x00000000004716f7 in std::_Bind_simple<void (*())()>::operator()() (this=0x2d2368) at D:/gcc/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/functional:1520
[debug]#3 0x0000000000492a2c in std::thread::_Impl<std::_Bind_simple<void (*())()> >::_M_run() (this=0x2d2350) at D:/gcc/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/thread:115
[debug]#4 0x00000000004a8300 in execute_native_thread_routine ()
[debug]#5 0x000000000041d9f7 in pthread_create_wrapper ()
[debug]#6 0x000007fefe4d42bf in sqrt () from C:\Windows\system32\msvcrt.dll
[debug]#7 0x000007fefe4d7459 in msvcrt!_beginthreadex () from C:\Windows\system32\msvcrt.dll
[debug]#8 0x000000007765f56d in KERNEL32!BaseThreadInitThunk () from C:\Windows\system32\kernel32.dll
[debug]#9 0x0000000077793281 in ntdll!RtlUserThreadStart () from C:\Windows\SYSTEM32\ntdll.dll
[debug]#10 0x0000000000000000 in ?? ()
[debug]Backtrace stopped: previous frame inner to this frame (corrupt stack?)
[debug]>>>>>>cb_gdb:
[debug]> info threads
[debug] Id Target Id Frame
[debug]* 2 Thread 2884.0xe88 0x000000000040168e in ThreadProc () at D:\Denis\Projects\TEST\GdbTest\main.cpp:8
[debug] 1 Thread 2884.0xb78 0x00000000777afefa in ntdll!ZwWaitForSingleObject () from C:\Windows\SYSTEM32\ntdll.dll
[debug]>>>>>>cb_gdb:
===========================================================================
[debug]> thread 1
[debug][Switching to thread 1 (Thread 2884.0xb78)]
[debug]#0 0x00000000777afefa in ntdll!ZwWaitForSingleObject () from C:\Windows\SYSTEM32\ntdll.dll
[debug]>>>>>>cb_gdb:
[debug]> bt 30
[debug]#0 0x00000000777afefa in ntdll!ZwWaitForSingleObject () from C:\Windows\SYSTEM32\ntdll.dll
[debug]#1 0x000007fefd9810ac in WaitForSingleObjectEx () from C:\Windows\system32\KernelBase.dll
[debug]#2 0x000000000041f73d in pthread_join ()
[debug]#3 0x00000000004929fa in std::thread::join() ()
[debug]#4 0x00000000004016dd in main () at D:\Denis\Projects\TEST\GdbTest\main.cpp:15
[debug]>>>>>>cb_gdb:
[debug]> frame 4
[debug]#4 0x00000000004016dd in main () at D:\Denis\Projects\TEST\GdbTest\main.cpp:15
[debug]D:\Denis\Projects\TEST\GdbTest\main.cpp:15:248:beg:0x4016dd
[debug]>>>>>>cb_gdb:
#4 0x00000000004016dd in main () at D:\Denis\Projects\TEST\GdbTest\main.cpp:15
D:\Denis\Projects\TEST\GdbTest\main.cpp:15:248:beg:0x4016dd
===========================================================================
[debug]> thread 1
[debug][Switching to thread 1 (Thread 3952.0x758)]
[debug]#4 0x00000000004016dd in main () at D:\Denis\Projects\TEST\GdbTest\main.cpp:15
[debug]D:\Denis\Projects\TEST\GdbTest\main.cpp:15:248:beg:0x4016dd
[debug]>>>>>>cb_gdb:
[debug]> bt 30
At D:\Denis\Projects\TEST\GdbTest\main.cpp:15
[debug]> bt 30
[debug]#0 0x00000000777afefa in ntdll!ZwWaitForSingleObject () from C:\Windows\SYSTEM32\ntdll.dll
[debug]#1 0x000007fefd9810ac in WaitForSingleObjectEx () from C:\Windows\system32\KernelBase.dll
[debug]#2 0x000000000041f73d in pthread_join ()
[debug]#3 0x00000000004929fa in std::thread::join() ()
[debug]#4 0x00000000004016dd in main () at D:\Denis\Projects\TEST\GdbTest\main.cpp:15
[debug]>>>>>>cb_gdb:#0 0x00000000777afefa in ntdll!ZwWaitForSingleObject () from C:\Windows\SYSTEM32\ntdll.dll
[debug]> info locals
[debug]#1 0x000007fefd9810ac in WaitForSingleObjectEx () from C:\Windows\system32\KernelBase.dll
[debug]#2 0x000000000041f73d in pthread_join ()
[debug]#3 0x00000000004929fa in std::thread::join() ()
[debug]#4 0x00000000004016dd in main () at D:\Denis\Projects\TEST\GdbTest\main.cpp:15
[debug]>>>>>>cb_gdb:Thrd = {
[debug]> info args
[debug] _M_id = {
[debug] _M_thread = 2
[debug] }
[debug]}
[debug]>>>>>>cb_gdb:
[debug]> bt 30
[debug]No arguments.
[debug]>>>>>>cb_gdb:
[debug]> if 1
disassemble 0x4016dd
info frame
end
[debug]#0 0x00000000777afefa in ntdll!ZwWaitForSingleObject () from C:\Windows\SYSTEM32\ntdll.dll
[debug]#1 0x000007fefd9810ac in WaitForSingleObjectEx () from C:\Windows\system32\KernelBase.dll
[debug]#2 0x000000000041f73d in pthread_join ()
[debug]#3 0x00000000004929fa in std::thread::join() ()
[debug]#4 0x00000000004016dd in main () at D:\Denis\Projects\TEST\GdbTest\main.cpp:15
[debug]>>>>>>cb_gdb: > > >Dump of assembler code for function main():
Failure finding "Stack level "
Failure matching reg_output
[debug]> info threads
[debug] 0x0000000000401698 <+0>: push %rbp
[debug] 0x0000000000401699 <+1>: push %rbx
[debug] 0x000000000040169a <+2>: sub $0x38,%rsp
[debug] 0x000000000040169e <+6>: lea 0x80(%rsp),%rbp
[debug] 0x00000000004016a6 <+14>: callq 0x40d920 <__main>
[debug] 0x00000000004016ab <+19>: lea 0xaa995(%rip),%rdx # 0x4ac047 <__gnu_cxx::__default_lock_policy+19>
[debug] 0x00000000004016b2 <+26>: mov 0xafc17(%rip),%rcx # 0x4b12d0 <.refptr._ZSt4cout>
[debug] 0x00000000004016b9 <+33>: callq 0x4a4e60 <std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)>
[debug] 0x00000000004016be <+38>: lea -0x60(%rbp),%rax
[debug] 0x00000000004016c2 <+42>: lea -0x5b(%rip),%rdx # 0x40166e <ThreadProc()>
[debug] 0x00000000004016c9 <+49>: mov %rax,%rcx
[debug] 0x00000000004016cc <+52>: callq 0x492b40 <std::thread::thread<void (&)()>(void (&)())>
[debug] 0x00000000004016d1 <+57>: lea -0x60(%rbp),%rax
[debug] 0x00000000004016d5 <+61>: mov %rax,%rcx
[debug] 0x00000000004016d8 <+64>: callq 0x4929d0 <std::thread::join()>
[debug]=> 0x00000000004016dd <+69>: lea 0xaa96b(%rip),%rdx # 0x4ac04f <__gnu_cxx::__default_lock_policy+27>
[debug] 0x00000000004016e4 <+76>: mov 0xafbe5(%rip),%rcx # 0x4b12d0 <.refptr._ZSt4cout>
[debug] 0x00000000004016eb <+83>: callq 0x4a4e60 <std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)>
[debug] 0x00000000004016f0 <+88>: lea -0x60(%rbp),%rax
[debug] 0x00000000004016f4 <+92>: mov %rax,%rcx
[debug] 0x00000000004016f7 <+95>: callq 0x492c00 <std::thread::~thread()>
[debug] 0x00000000004016fc <+100>: mov $0x0,%eax
[debug] 0x0000000000401701 <+105>: jmp 0x40171d <main()+133>
[debug] 0x0000000000401703 <+107>: mov %rax,%rbx
[debug] 0x0000000000401706 <+110>: lea -0x60(%rbp),%rax
[debug] 0x000000000040170a <+114>: mov %rax,%rcx
[debug] 0x000000000040170d <+117>: callq 0x492c00 <std::thread::~thread()>
[debug] 0x0000000000401712 <+122>: mov %rbx,%rax
[debug] 0x0000000000401715 <+125>: mov %rax,%rcx
[debug] 0x0000000000401718 <+128>: callq 0x40f0d0 <_Unwind_Resume>
[debug] 0x000000000040171d <+133>: add $0x38,%rsp
[debug] 0x0000000000401721 <+137>: pop %rbx
[debug] 0x0000000000401722 <+138>: pop %rbp
[debug] 0x0000000000401723 <+139>: retq
[debug]End of assembler dump.
[debug]Stack level 4, frame at 0x22fe60:
[debug] rip = 0x4016dd in main (D:\Denis\Projects\TEST\GdbTest\main.cpp:15); saved rip = 0x4013e8
[debug] caller of frame at 0x22fe10
[debug] source language c++.
[debug] Arglist at 0x22fe10, args:
[debug] Locals at 0x22fe10, Previous frame's sp is 0x22fe60
[debug] Saved registers:
[debug] rbx at 0x22fe48, rbp at 0x22fe50, rip at 0x22fe58, xmm15 at 0x22fe58
[debug]>>>>>>cb_gdb: Id Target Id Frame
[debug]> frame 4
[debug] 2 Thread 3952.0xb98 0x000000000040168e in ThreadProc () at D:\Denis\Projects\TEST\GdbTest\main.cpp:8
[debug]* 1 Thread 3952.0x758 0x00000000777afefa in ntdll!ZwWaitForSingleObject () from C:\Windows\SYSTEM32\ntdll.dll
[debug]>>>>>>cb_gdb:
2 Thread 3952.0xb98 0x000000000040168e in ThreadProc () at D:\Denis\Projects\TEST\GdbTest\main.cpp:8
* 1 Thread 3952.0x758 0x00000000777afefa in ntdll!ZwWaitForSingleObject () from C:\Windows\SYSTEM32\ntdll.dll
[debug]#4 0x00000000004016dd in main () at D:\Denis\Projects\TEST\GdbTest\main.cpp:15
[debug]D:\Denis\Projects\TEST\GdbTest\main.cpp:15:248:beg:0x4016dd
[debug]>>>>>>cb_gdb: