Program received signal SIGTRAP, Trace/breakpoint trap.
In ntdll!DbgUiConnectToDbg () (ntdll.dll)
Invalid Address specified to RtlFreeHeap
2. "Invalid Address specified to RtlFreeHeap" is sometimes encountered in otherwise correct code, if there is an executable and a DLL, one of which was built in debug mode and the other one in release mode. That will create two different heaps managed by two heap managers, which will cause heap corruption whenever pointers are handed from one to the other (so basically, all the time in most programs). This may generate an error which the debugger catches, or may go silently otherwise, or may crash at a random later time.
I had the same problem. I solved it, when export my project in m$ vs, and vs's debugger show me where i did mistake- it was then i use "delete" statment. i hope in future mingw32, and gdb will have a more(maybe most) powerful dev tools :).
Sorry to bring this old topic up, but I have a similar issue. When starting an app in debugger, or any app in debug mode, first I get TWO (always) error messages in a row:Hi, I have no idea about your problem, but at least you should tell us
(http://eigen.pri.ee/images/debug_error.jpg)
and then the debugger tells me
#0 7C964ED1 ntdll!RtlReAllocateHeap() (C:\WINDOWS\system32\ntdll.dll:??)
#1 7C93F8FB ntdll!RtlInsertElementGenericTableAvl() (C:\WINDOWS\system32\ntdll.dll:??)
#2 7C90EAC7 ntdll!LdrCreateOutOfProcessImage() (C:\WINDOWS\system32\ntdll.dll:??)
If I put gdb.exe in the app folder and drag the exe onto it, I get the RtlReAllocateHeap error. But when I do the same in my gf's computer, all works as expected. So, something must be totally messed up in mine.
The thing is, a simple console "Hello world" works fine in the debugger, but as soon as the app has to get ANYTHING from an external dll, it crashes in debug mode. Even an additional line of SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER); is enough to throw the RtlReAllocateHeap error when starting the debugger.
Everything is working in release mode, as well in the debug mode a few days ago. I don't think I have changed anything in the system lately .. So, have you guys got any ideas what it could be? As a last resort, I'm thinking of re-installing Windows, in case there's something messed up internally. Maybe the ntdll.dll is somehow broken, though the file size is exactly as it should be, so I don't think it's been modified.
Thanks in advance,
Eigen
#include <windows.h>
#include "SDL.h"
int WINAPI WinMain(HINSTANCE d1, HINSTANCE d2, LPSTR d3, int d4)
{
SDL_Init(SDL_INIT_VIDEO);
printf("Hello World!");
SDL_Quit();
return 0;
}
#include <windows.h>
#include "SDL.h"
int WINAPI WinMain(HINSTANCE d1, HINSTANCE d2, LPSTR d3, int d4)
{
//SDL_Init(SDL_INIT_VIDEO);
printf("Hello World!");
//SDL_Quit();
return 0;
}
SDL_Init(SDL_INIT_VIDEO);
That function should not have any problems. It was just a quick sample without even creating a real window, but yes, every program works on my and everyone elses computer. Also, the debugging works everywhere else but mine. I guess I have to reinstall Windows when I get the time and see if it helps.that weird. I don't think the debug symbols files were necessary. :D
I tried WinDbg, a tool I got from Microsoft site and attached it to my running project process and immediately it threw erros related to ntdll and also said symbols for that file could not be found. I'll try downloading and reinstalling the symbol files package for XP SP2 from here http://www.microsoft.com/whdc/devtools/debugging/symbolpkg.mspx#f .. maybe it helps.