deathhex
May 5th, 2010, 22:39
Hello people,
Well, I am using Cygwin GDB to debug a program, which is main.exe
As we could see that there is a Segmentation fault at 0x00401277 in main (). Therefore, how do we pin point or find out what causing it?
I have tried several ways:
But it seems to be not working or unable to pin point the problem....
So, anyone mind teach me how to pin point or find the cause of the problem?
Thank you.
Well, I am using Cygwin GDB to debug a program, which is main.exe
Code:
$ gdb main.exe
GNU gdb 6.8.0.20080328-cvs (cygwin-special)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) break main
Breakpoint 1 at 0x401141
(gdb) run
Starting program: /cygdrive/c/C_CPP_ASM/Test3/main.exe
[New thread 2336.0xa7c]
[New thread 2336.0xf9c]
Breakpoint 1, 0x00401141 in main ()
(gdb) s
Single stepping until exit from function main,
which has no line number information.
a = 1
d = a = 1
b = 2
c = 4
!!!Hello World!!!
a = 1
d = a = 4202691
b = 6920660
c = 4198803
a = 1
d = a = 4202656
b = 6920660
c = 11123316
a = 5
d = a = 5
b = 6
c = 7
a = 5
d = a = 4202656
b = 6920660
c = 4198975
Program received signal SIGSEGV, Segmentation fault.
0x00401277 in main ()
(gdb)
As we could see that there is a Segmentation fault at 0x00401277 in main (). Therefore, how do we pin point or find out what causing it?
I have tried several ways:
Code:
(gdb) where
#0 0x00401277 in main ()
(gdb) bt
#0 0x00401277 in main ()
(gdb) frame
#0 0x00401277 in main ()
(gdb) list
1 /gnu/gcc/releases/packaging/4.3.4-3/gcc4-4.3.4-3/src/gcc-4.3.4/libgcc/..
/gcc/libgcc2.c: No such file or directory.
in /gnu/gcc/releases/packaging/4.3.4-3/gcc4-4.3.4-3/src/gcc-4.3.4/libgcc
/../gcc/libgcc2.c
(gdb)
But it seems to be not working or unable to pin point the problem....
So, anyone mind teach me how to pin point or find the cause of the problem?
Thank you.