Debug the coredump file using GDB. The function name is a question mark.

Source: Internet
Author: User

Today, we finally solved a big bug!

My program crash, with the coredump file, uses arm-Linux-GDB debug it on Linux PC. 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 (upt stack ?)
(GDB)
Why? I can't locate the correct location, find the really reason.

Check the loaded content.

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 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 "-- 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" is not at the expected address (wrong library or version mismatch ?)

Warning:. Dynamic section for "/lib/libpthread. so.0" is not 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" is not at the expected address (wrong library or version mismatch ?)

Warning:. Dynamic section for "/lib/libgcc_s.so.1" is not at the expected address (wrong library or version mismatch ?)

Warning:. Dynamic section for "/lib/libc. so.6" is not at the expected address (wrong library or version mismatch ?)

Warning:. Dynamic section for "/lib/ld-linux.so.2" is not at the expected address (wrong library or version mismatch ?)

Warning:. Dynamic section for "/lib/libnss_files.so.2" is not 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 was generated by './6800pluseth. bin '.
Program terminated with signal 11, segmentation fault.

Some libraries cannot be found (/lib/libstdc ++. so.6), or the version does not match. I should not load the/lib/libdl... so... files. This is for x86.

Therefore, the two commands are crucial:

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/lib/. The values of the two parameters are the same.

Start arm-Linux-GDB first. After setting the variable, use the via core-File Load core dump file to analyze it.

# GDB

# Set solib-absolute-prefix "library path"

# Set solib-search-path "library path"

# File. Debug

# Core-file core.1234

But it still cannot be accurately located. query the embedded Linux version:

Uname-

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 incorrect. One is 2.3.3 and the other is 2.3.2. Version matching is crucial !!

For a Linux PC, its cross-compiling environment is 2.3.3.

Haha! Locate the cause of the error now !!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.