[C] Debugging Segment Error with gdb in Linux
1. Compile the source with -g option.
2. run gdb
(gdb) file exefile
(gdb) run [arg is optional]
After segment error occurs, type ‘up’ until you see the proper source file & line where the segment occurs.
(gdb) up
[root@editracker from_edisvr]# gdb
GNU gdb Red Hat Linux (6.1post-1.20040607.41rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for details.
This GDB was configured as “i386-redhat-linux-gnu”.
(gdb) file ezftp
Reading symbols from ezftp…done.
Using host libthread_db library “/lib/tls/libthread_db.so.1″.
(gdb) run test.cfg
Starting program: ezftp test.cfg
Program received signal SIGSEGV, Segmentation fault.
0×0072a9a3 in _int_malloc () from /lib/tls/libc.so.6
(gdb) up
#1 0×0072c1e1 in malloc () from /lib/tls/libc.so.6
(gdb) up
#2 0×00766460 in re_compile_internal () from /lib/tls/libc.so.6
(gdb) up
#3 0×0076876c in regcomp () from /lib/tls/libc.so.6
(gdb) up
#4 0×0804acc3 in mput (filearg=0xfeedadb4, argc=1, list=0xfeedada8) at ezftp.c:1106
1106 if( regcomp(®obj[i],regfile,0)!=0){

Garmin nüvi 760 4.3-Inch Widescreen Bluetooth Portable GPS Automobile Navigator
Garmin Portable Friction Dashboard Mount for nüvi Series and StreetPilot C5XX Series GPS Navigators (C530, C550, and C580)
Nikon Coolpix L18 8MP Digital Camera with 3x Optical Zoom (Navy)
Mario Kart Wii with Wii Wheel
Apple iPod nano 4 GB Silver (3rd Generation)