Sonya Blade wrote:
> Thank you all for your suggestions and sorry for the tardy response,
> John Brown wrote:
>> Hello Sonya,
>> I do not know what that message means. However, is it that:
>> a) You still have not managed to get Dr Mingw to work, or
>> b) It is working, but it does not provide more information than
>> you managed to obtain before?
> Yes, I downloaded and installed it. It is not working at all, double
> clicking, trying to execute it during program run or debug, Dr MinGW
> never pops up, I have the Win7, probably its been targeted for to the
> different OS.
I do not think so. It worked for me on Windows XP. Your problem motivated
me to install it on Windows 8 and it works for me also. I do not think
that it will give you better information than gdb (it may even be too much),
but let us try one more time to make it work.
1) Edit the Windows Registry (but be careful, of course):
a) Locate the registry key
b) Set the values:
Auto = 1
Debugger = \full\path\to\drmingw.exe -p %ld -e %ld
C:\Users\John\Downloads\Open_Source\drmingw-0.4.4\drmingw.exe -p %ld -e %ld
2) Make sure that you disable Windows Error Reporting. Instructions are
in my previous message
Test your installation by running samples\test.exe in the folder where
you extracted the Dr Mingw archive. You should see a dialog box saying
"A problem caused the program to stop working correctly ..."
If you choose the option to debug the program, the Dr MinGW window will
appear. You can then close the original dialog box.
Let us consider your gdb output:
> Program received signal SIGSEGV, Segmentation fault.
> In ntdll!LdrLoadAlternateResourceModuleEx () (C:\Windows\system32\ntdll.dll)
> 145 ../mingw/dllcrt1.c: No such file or directory.
> #17 0x6f601026 in __dll_exit () at ../mingw/dllcrt1.c:145
> Debugger finished with status 0
Is it the entire output, or did you trim it? Are you running gdb in
an IDE of some kind, or did you run it yourself at the command prompt?
Using samples\test.exe in gdb, my gdb session looks like this:
GNU gdb (GDB) 7.5
/* copyright notice */
(gdb) file test.exe
Reading symbols from C:\Users\John\Downloads\Open_Source\drmingw-0.4.4\samples\
Starting program: C:\Users\John\Downloads\Open_Source\drmingw-0.4.4\samples\tes
[New Thread 4244.0x14f4]
Program received signal SIGSEGV, Segmentation fault.
0x769fb10b in msvcrt!_atoflt_l () from C:\Windows\SysWOW64\msvcrt.dll
We see that the error is *detected* in a system DLL as in your case, but
if we ask for a back trace we see:
#0 0x769fb10b in msvcrt!_atoflt_l () from C:\Windows\SysWOW64\msvcrt.dll
#1 0x769fad9e in sscanf () from C:\Windows\SysWOW64\msvcrt.dll
#2 0x769fad3e in sscanf () from C:\Windows\SysWOW64\msvcrt.dll
#3 0x004013c2 in YetAnotherFunction (i=8) at samples/test.c:21
#4 0x004013e3 in MyWonderfulFunction (AnInteger=4,
AString=0x403039 <_Jv_RegisterClasses+4206649> "Hello", AnEnum=b,
AStruct=..., AFunction=0x4013e8 <ASimpleFunction>) at samples/test.c:33
#5 0x00401459 in main (argc=2686820, argv=0x4010a7 <__mingw_CRTStartup+135>)
The real problem is *caused* by the incorrect call to sscanf in
samples/test.c at line 21
static void YetAnotherFunction(int i)
/* Other ways to cause a GPF */
*(int *)i = 5;
__asm ("int $3");
(*((void (*)(void)) 0x12345678))();
sscanf("12345", "%i", (int *) (k=i)); /* line 21 */
So the problem is detected in in the C Runtime DLL, but it is
caused by a bad function call in the source code. Nothing is wrong
with the system.
What does your full gdb back trace look like?