PDA

View Full Version : Cannot run program.



shanshan
05-20-2012, 01:35 PM
I have a program can run normally previous, but can not run now.
I did not change the code, so the code is correct.
here is the out put information when i run the code.

$ gdb scooppic
GNU gdb (GDB) Fedora (7.3.50.20110722-13.fc16)
Copyright (C) 2011 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ssun/Documents/Mark/sphere/init/scooppic/scooppic...done.
(gdb) r exp001a sexp001a
Starting program: /home/ssun/Documents/Mark/sphere/init/scooppic/scooppic exp001a sexp001a
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Open Scoop File: sexp001a
Open soil File: exp001a
Read Scoop: 0
Zmax: 0.038360
Read soil: 0 6
SCF: 1.000000
CEN: 0.049123 0.054283 0.016597
POS: 0.049123 0.054283 0.016597
Read Ini Done

Program received signal SIGSEGV, Segmentation fault.
0x00bc4010 in time@plt () from /lib/libexpat.so.1
______________________
$ ./scooppic exp001a sexp001a
Open Scoop File: sexp001a
Open soil File: exp001a
Read Scoop: 0
Zmax: 0.038360
Read soil: 0 6
SCF: 1.000000
CEN: 0.049123 0.054283 0.016597
POS: 0.049123 0.054283 0.016597
Read Ini Done
Segmentation fault (core dumped)

Do you have any idea?

Dark Photon
05-20-2012, 06:02 PM
A quick google confirms the lib its core dumping in is an XML parsing lib. Maybe you changed an XML file? Or maybe you're corrupting memory. Run the app under valgrind to get more idea where mem is being corrupted, if it is.

shanshan
05-21-2012, 08:41 AM
Thank you Dark!
I try to use valgrind run the program, here is the output:
valgrind ./scooppic
valgrind: mmap(0x804f000, 1408000000) failed in UME with error 22 (Invalid argument).
valgrind: this can be caused by executables with very large text, data or bss segments.

it seems the program cannot run under valgrind.

I use gdb run the program step by step the program is stop at the file '/usr/src/debug/freeglut-2.6.0/src/freeglut_window.c' and the screen output is list below:
gdb scooppic
GNU gdb (GDB) Fedora (7.3.50.20110722-13.fc16)
Copyright (C) 2011 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ssun/Documents/Mark/sphere/init/scooppic/scooppic...done.
(gdb) r exp001a sexp001a
Starting program: /home/ssun/Documents/Mark/sphere/init/scooppic/scooppic exp001a sexp001a
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Open Scoop File: sexp001a
Open soil File: exp001a
Read Scoop: 0
Zmax: 0.038360
Read soil: 0 6
SCF: 1.000000
CEN: 0.049123 0.054283 0.016597
POS: 0.049123 0.054283 0.016597
Read Ini Done

Program received signal SIGSEGV, Segmentation fault.
0x00bc4010 in time@plt () from /lib/libexpat.so.1
(gdb) b scooppic.c :96
Breakpoint 1 at 0x8049aac: file scooppic.c, line 96.
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/ssun/Documents/Mark/sphere/init/scooppic/scooppic exp001a sexp001a
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Open Scoop File: sexp001a
Open soil File: exp001a
Read Scoop: 0
Zmax: 0.038360
Read soil: 0 6
SCF: 1.000000
CEN: 0.049123 0.054283 0.016597
POS: 0.049123 0.054283 0.016597
Read Ini Done

Breakpoint 1, main (argc=3, argv=0xbffff2a4) at scooppic.c:96
96 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
(gdb) n
97 glutCreateWindow(windowname);
(gdb) s
glutCreateWindow (title=0x804e3a0 "exp001a") at freeglut_window.c:1174
1174 {
(gdb) n
1181 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateWindow" );
(gdb)
1183 return fgCreateWindow( NULL, title, fgState.Position.Use,
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x00bc4010 in time@plt () from /lib/libexpat.so.1
(gdb) l
1178 * XXX Steve Baker, 12/16/04, 4:22 PM CST, "Re: [Freeglut-developer]
1179 * XXX Desired 'freeglut' behaviour when there is no current window"
1180 */
1181 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateWindow" );
1182
1183 return fgCreateWindow( NULL, title, fgState.Position.Use,
1184 fgState.Position.X, fgState.Position.Y,
1185 fgState.Size.Use, fgState.Size.X, fgState.Size.Y,
1186 GL_FALSE, GL_FALSE )->ID;
1187 }