Today finally solved a big bug, cool!
My program crash, with the Coredump file, on a Linux PC with arm-linux-gdb debug it. The result is:
#0 0x4022b178 in?? ()
(GDB) bt
#0 0x4022b178 in?? ()
#1 0x4022b134 in?? ()
#2 0x4022b134 in?? ()
BackTrace stopped:previous frame identical to this frame (corrupt stack?)
(GDB)
Why? I can ' t locate the correct location, find the really reason.
See what's Loaded
GNU gdb 6.6
Copyright (C) 2006 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.
Type "Show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "Show warranty" for details.
This GDB is configured as "--host=i686-pc-linux-gnu--target=arm-linux" ...
Warning:core file may not match specified executable file.
Warning:. Dynamic section for "/lib/libdl.so.2" isn't at the expected address (wrong library or version mismatch?)
Warning:. Dynamic section for "/lib/libpthread.so.0" isn't at the expected address (wrong library or version mismatch?)
Error While mapping shared library sections:
/lib/libstdc++.so.6:no such file or directory.
Warning:. Dynamic section for "/lib/libm.so.6" isn't at the expected address (wrong library or version mismatch?)
Warning:. Dynamic section for "/lib/libgcc_s.so.1" isn't at the expected address (wrong library or version mismatch?)
Warning:. Dynamic section for "/lib/libc.so.6" isn't at the expected address (wrong library or version mismatch?)
Warning:. Dynamic section for "/lib/ld-linux.so.2" isn't at the expected address (wrong library or version mismatch?)
Warning:. Dynamic section for "/lib/libnss_files.so.2" isn't at the expected address (wrong library or version mismatch?)
Reading symbols From/lib/libdl.so.2...done.
Loaded symbols for/lib/libdl.so.2
Reading symbols From/lib/libpthread.so.0...done.
Loaded symbols for/lib/libpthread.so.0
Symbol File not found for/lib/libstdc++.so.6
Reading symbols From/lib/libm.so.6...done.
Loaded symbols for/lib/libm.so.6
Reading symbols From/lib/libgcc_s.so.1...done.
Loaded symbols For/lib/libgcc_s.so.1
Reading symbols From/lib/libc.so.6...done.
Loaded symbols for/lib/libc.so.6
Reading symbols From/lib/ld-linux.so.2...done.
Loaded symbols for/lib/ld-linux.so.2
Reading symbols From/lib/libnss_files.so.2...done.
Loaded symbols for/lib/libnss_files.so.2
Core is generated by './6800pluseth.bin '.
Program terminated with signal one, segmentation fault.
Some libraries cannot be found (/lib/libstdc++.so.6), or the version does not match. I should not load/LIB/LIBDL. So .... These files, which are for X86.
So two commands are important:
Set Solib-absolute-prefix--set prefix for loading absolute shared library symbol files
Set Solib-search-path-Set the search path for loading Non-absolute shared library symbol files
For example: Set Solib-.../usr/local/arm-linux/arm-linux/lib/, the value of two parameters can be the same.
After starting ARM-LINUX-GDB, set the variable, via core-file load core dump file to analyze it.
#gdb
#set solib-absolute-prefix "Library Path"
#set Solib-search-path "Library Path"
#file File.debug
#core-file core.1234
However, it is still not accurate to locate, query embedded Linux version:
Uname-a
Ls-l/usr/arm-linux/gcc-3.4.1-glibc-2.3.3/arm-linux/lib/libc-2.3.3.so
On a Linux PC:
Ll/usr/local/arm/3.4.1/arm-linux/lib/libc-2.3.2.so
The original library file is not correct, one is 2.3.3, the other is 2.3.2, this time found that version matching is the important AH!!
In exchange for a Linux PC, its cross-compilation environment is 2.3.3
Ha ha! Immediately locate the cause of the error!!
///
I. About GDB debugging a core file is always a question of a bunch of question marks
Problem Description: You have added-G to the compilation option, but when you view the core file, it is a bunch of question marks, using the command: Gdb-c core
Solution: Since the use of gdb-c core is not very well supported in some systems, the following two methods are recommended:
1) gdb exe
(GDB) Core-file core
2) Gdb-c Core
(gdb) file exe
And the second method is not good for some systems, so use the first one.
GDB debugging encountered?? The problem