Can't debug in Code::Blocks (Program received signal SIGSEGV, Segmentation fault.)

I can't seem to debug in Code::Blocks. I'm using Mingw and it's supplied debugger. I'm on Win7 64bit. After starting the debugger and after a couple "continues" I always get "Program received signal SIGSEGV, Segmentation fault.". Here is the compile log:

Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\C++\CodeBlocks Projects\test\
Adding source dir: C:\C++\
Adding file: C:\C++\CodeBlocks Projects\test\bin\Debug\test.exe
Changing directory to: C:/C__~1/CODEBL~1/test/.
Set variable: PATH=.;C:\C++\mingw64\bin;C:\C++\mingw64;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Broadcom\Broadcom 802.11 Network Adapter\Driver;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn;c:\Program Files\Microsoft SQL Server\100\Tools\Binn;c:\Program Files\Microsoft SQL Server\100\DTS\Binn;C:\Program Files\Microsoft SQL Server\110\Tools\Binn
Starting debugger: C:\C++\mingw64\bin\gdb.exe -nx -fullname -quiet -args C:/C__~1/CODEBL~1/test/bin/Debug/test.exe
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.6
Child process PID: 6200
Program received signal SIGTRAP, Trace/breakpoint trap.
In ntdll!RtlIsDosDeviceName_U () (C:\Windows\system32\ntdll.dll)
Continuing...
Program received signal SIGTRAP, Trace/breakpoint trap.
In ntdll!RtlIsDosDeviceName_U () (C:\Windows\system32\ntdll.dll)
Continuing...
Program received signal SIGSEGV, Segmentation fault.
In ?? () ()


and the call stack:

#0 ?? ?? () (??:??)
#1 7771C21E ntdll!RtlIsDosDeviceName_U() (C:\Windows\system32\ntdll.dll:??)
#2 6FC40000 ?? () (??:??)
#3 ?? ?? () (??:??)


I've tried a few different programs, the error is always the same, so too is the call stack (with same addresses).

Any help?
Last edited on
The following are some typical causes of a segmentation fault:

Attempting to execute a program that does not compile correctly. Some compilers will output an executable file despite the presence of compile-time errors.
Dereferencing NULL pointers
Attempting to access memory the program does not have rights to (such as kernel structures in process context)
Attempting to access a nonexistent memory address (outside process's address space)
Attempting to write read-only memory (such as code segment)
A buffer overflow
Using uninitialized pointers

Wiki

Aceix.
Can we see some code? "RtlIsDosDeviceName_U()" isn't documented so you shouldn't be using it. It's probably being called internally by ntdll.dll but if that's the case then I would try updating "libntdll.a" in your mingw directory. SIGTRAP and SIGFAULT mean that something is writing where it isn't supposed to, this may or may not be you. We would need to see some code to be sure.
I have not used RtlIsDosDeviceName_U(). I get these errors in any project, and by that I mean with a single file, main.cpp, which is empty. For the sake of it, here it is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <string>
#include <cstring>  
#include <cstdlib>	
#include <cstdio>	
#include <algorithm>
#include <cmath>
#include <cassert>
#include <cctype>

// CONTAINERS
#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <array>

int main()
{



	// FINISHED PROGRAM
	std::cout << "\n\n\n=============================\n\nFinished Program...\n";
    return 0;
}


I can't see anything bad there. When I downloaded Code::Blocks, I had to get the compiler separately. The mingw zip was called x64-4.8.1-release-win32-sjlj-rev3, I used the debugger supplied with Mingw in the bin folder.
Last edited on
Anyone?

Under debugger settings Exec. path is C:\C++\mingw64\bin\gdb.exe, with debugger type set to GDB.

My toolchain execs look like this:

http://img826.imageshack.us/img826/3514/nn49.png

Debugger settings:

http://img196.imageshack.us/img196/8299/ego3.png
http://img89.imageshack.us/img89/2962/th03.png
Last edited on
Topic archived. No new replies allowed.