I've been trying to get a working program running via Eclipse (for easier debugging) but I can't seem to get it done.
I have a simple command that compiles the program via the terminal:
gcc -m32 *.c -lm
I can then execute ./a.out
properly.
To make use of the user-friendly gdb
plugins in Eclipse I'd like to compile and run it in Eclipse as well.
So far I have added -lm -m32 -w
to the "Miscellaneous" field in the project settings under "Cross GCC Compiler" as well as in the "Miscellaneous" field under the "Cross GCC Linker".
The program seems to compile fine (see below). However, when I select the libslip
binary file and try to execute it it crashes promptly.
When I run the libslip
executable via terminal I get the following output:
Debug$ ./libslip
Killed
When I run it via Eclipse I get this:
<terminated> libslip [C/C++ Application] <path>
The gdb libslip
output is the following:
Reading symbols from libslip...done.
(gdb) b 1
Breakpoint 1 at 0xb4d3: file ../SlipTest.c, line 1.
(gdb) run
Starting program: /home/christophe/School/Semester 2/Programming Language Engineering/Section 5/eclipse-workspace/slip/Debug/libslip
Program received signal SIGSEGV, Segmentation fault.
0x00000001 in ?? ()
(gdb)
The console output for compilation process in Eclipse:
19:10:24 **** Build of configuration Debug for project slip ****
make all
Building file: ../SlipDictionary.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -lm -m32 -w -MMD -MP -MF"SlipDictionary.d" -MT"SlipDictionary.d" -o "SlipDictionary.o" "../SlipDictionary.c"
Finished building: ../SlipDictionary.c
Building file: ../SlipEvaluate.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -lm -m32 -w -MMD -MP -MF"SlipEvaluate.d" -MT"SlipEvaluate.d" -o "SlipEvaluate.o" "../SlipEvaluate.c"
Finished building: ../SlipEvaluate.c
Building file: ../SlipGrammar.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -lm -m32 -w -MMD -MP -MF"SlipGrammar.d" -MT"SlipGrammar.d" -o "SlipGrammar.o" "../SlipGrammar.c"
Finished building: ../SlipGrammar.c
Building file: ../SlipMain.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -lm -m32 -w -MMD -MP -MF"SlipMain.d" -MT"SlipMain.d" -o "SlipMain.o" "../SlipMain.c"
Finished building: ../SlipMain.c
Building file: ../SlipMemory.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -lm -m32 -w -MMD -MP -MF"SlipMemory.d" -MT"SlipMemory.d" -o "SlipMemory.o" "../SlipMemory.c"
Finished building: ../SlipMemory.c
Building file: ../SlipNative.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -lm -m32 -w -MMD -MP -MF"SlipNative.d" -MT"SlipNative.d" -o "SlipNative.o" "../SlipNative.c"
Finished building: ../SlipNative.c
Building file: ../SlipPool.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -lm -m32 -w -MMD -MP -MF"SlipPool.d" -MT"SlipPool.d" -o "SlipPool.o" "../SlipPool.c"
Finished building: ../SlipPool.c
Building file: ../SlipPrint.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -lm -m32 -w -MMD -MP -MF"SlipPrint.d" -MT"SlipPrint.d" -o "SlipPrint.o" "../SlipPrint.c"
Finished building: ../SlipPrint.c
Building file: ../SlipRead.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -lm -m32 -w -MMD -MP -MF"SlipRead.d" -MT"SlipRead.d" -o "SlipRead.o" "../SlipRead.c"
Finished building: ../SlipRead.c
Building file: ../SlipScan.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -lm -m32 -w -MMD -MP -MF"SlipScan.d" -MT"SlipScan.d" -o "SlipScan.o" "../SlipScan.c"
Finished building: ../SlipScan.c
Building file: ../SlipTest.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -lm -m32 -w -MMD -MP -MF"SlipTest.d" -MT"SlipTest.d" -o "SlipTest.o" "../SlipTest.c"
Finished building: ../SlipTest.c
Building target: libslip
Invoking: Cross GCC Linker
gcc -m32 -lm -w -shared -o "libslip" ./SlipDictionary.o ./SlipEvaluate.o ./SlipGrammar.o ./SlipMain.o ./SlipMemory.o ./SlipNative.o ./SlipPool.o ./SlipPrint.o ./SlipRead.o ./SlipScan.o ./SlipTest.o
Finished building target: libslip
19:10:24 Build Finished (took 560ms)
CodeBlocks build log
-------------- Clean: Debug in Slip1 (compiler: GNU GCC Compiler)---------------
Cleaned "Slip1 - Debug"
-------------- Build: Debug in Slip1 (compiler: GNU GCC Compiler)---------------
gcc -Wall -g -w -c /home/christophe/Desktop/CodeBlocks/Slip1/Slip1/SlipDictionary.c -o obj/Debug/SlipDictionary.o
gcc -Wall -g -w -c /home/christophe/Desktop/CodeBlocks/Slip1/Slip1/SlipEvaluate.c -o obj/Debug/SlipEvaluate.o
gcc -Wall -g -w -c /home/christophe/Desktop/CodeBlocks/Slip1/Slip1/SlipGrammar.c -o obj/Debug/SlipGrammar.o
gcc -Wall -g -w -c /home/christophe/Desktop/CodeBlocks/Slip1/Slip1/SlipMain.c -o obj/Debug/SlipMain.o
gcc -Wall -g -w -c /home/christophe/Desktop/CodeBlocks/Slip1/Slip1/SlipMemory.c -o obj/Debug/SlipMemory.o
gcc -Wall -g -w -c /home/christophe/Desktop/CodeBlocks/Slip1/Slip1/SlipNative.c -o obj/Debug/SlipNative.o
gcc -Wall -g -w -c /home/christophe/Desktop/CodeBlocks/Slip1/Slip1/SlipPool.c -o obj/Debug/SlipPool.o
gcc -Wall -g -w -c /home/christophe/Desktop/CodeBlocks/Slip1/Slip1/SlipPrint.c -o obj/Debug/SlipPrint.o
gcc -Wall -g -w -c /home/christophe/Desktop/CodeBlocks/Slip1/Slip1/SlipRead.c -o obj/Debug/SlipRead.o
gcc -Wall -g -w -c /home/christophe/Desktop/CodeBlocks/Slip1/Slip1/SlipScan.c -o obj/Debug/SlipScan.o
gcc -Wall -g -w -c /home/christophe/Desktop/CodeBlocks/Slip1/Slip1/SlipTest.c -o obj/Debug/SlipTest.o
g++ -o bin/Debug/Slip1 obj/Debug/SlipDictionary.o obj/Debug/SlipEvaluate.o obj/Debug/SlipGrammar.o obj/Debug/SlipMain.o obj/Debug/SlipMemory.o obj/Debug/SlipNative.o obj/Debug/SlipPool.o obj/Debug/SlipPrint.o obj/Debug/SlipRead.o obj/Debug/SlipScan.o obj/Debug/SlipTest.o
Output file is bin/Debug/Slip1 with size 136,52 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))