This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

gdb调试时libc库的debug信息问题

Hi,

        使用ti-processor-sdk-linux-am437x-evm-01.00.00.03开发包,在开发板上使用交叉编译的gdb7.6进行调试时,加载libc.so.6 库时没有调试信息。请问toolchain中是否有提供调试信息的libc库版本。这样调试时会方便些。

root@am437x-evm:~# gdb
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <gnu.org/.../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 "arm-linux-gnueabihf".
For bug reporting instructions, please see:
<www.gnu.org/.../>.
(gdb) set verbose on
(gdb) file test
(gdb) r
Starting program: /home/root/test
...
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6

         谢谢!

roy

  • 没有

    只能自己编译libc了。

  • Hi, Yang

    1.  如果自己编译libc,有参考的操作步骤吗?
        这样的话busybox需要重新编译,再更新根文件系统。busybox的编译方法在哪里可找到呢? 


    2.  尝试找现有的linaro的libc库,但不成功:


    在linaro的网站

    http://releases.linaro.org/archive/13.03/components/toolchain/binaries/

    下载了

    gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2


    对比了这个版本的toolchain与跟我们使用的ti-sdk中的arm-linux-gnueabihf-gcc文件,是一样的。 

    linaro其上有两个libc-2.15.so的文件,一个是stripted的,另一个没有


    ./arm-linux-gnueabihf/libc/lib/arm-linux-gnueabihf/libc-2.15.so:               ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked (uses shared libs), BuildID[sha1]=0x324229267b9759bf93ae2f73d0b8cf886eccb9ff, for GNU/Linux 2.6.31, stripped
     ./arm-linux-gnueabihf/libc/usr/lib/debug/lib/arm-linux-gnueabihf/libc-2.15.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked (uses shared libs), BuildID[sha1]=0x324229267b9759bf93ae2f73d0b8cf886eccb9ff, for GNU/Linux 2.6.31, not stripped


    我尝试将linaro toolchain上的没有调试信息的lib库放到板上,运行正常。
    但将not stripped的libc库放板上,busybox等程序就会出现segmentation  fault。


    其实这个在debug目录下的libc-2.15.so能使用吗?


    祝好!

    Roy 

  • Hi, all
          测试了linaro的具有debug信息的libc库,成功读取到debug symbols。
    •    将linaro中没stripped的lib拷贝到target的lib目录下。
                     toolchain中库的路径: ./arm-linux-gnueabihf/libc/lib/arm-linux-gnueabihf/                  
    •    将not stripped库拷贝到target上,例如/debug/lib/ 目录
                      toolchain中库的路径: ./arm-linux-gnueabihf/libc/usr/lib/debug/lib/arm-linux-gnueabihf/ 
    •    然后gdb启动时使用命令
                     (gdb) set debug-file-directory /debug/
          
    root@am437x-evm:/# ls debug/lib/
    ld-2.15.so               libm-2.15.so             libnss_nisplus-2.15.so
    libBrokenLocale-2.15.so  libmemusage.so           libpcprofile.so
    libSegFault.so           libnsl-2.15.so           libpthread-2.15.so
    libanl-2.15.so           libnss_compat-2.15.so    libresolv-2.15.so
    libc-2.15.so             libnss_dns-2.15.so       librt-2.15.so
    libcidn-2.15.so          libnss_files-2.15.so     libthread_db-1.0.so
    libcrypt-2.15.so         libnss_hesiod-2.15.so    libutil-2.15.so
    libdl-2.15.so            libnss_nis-2.15.so
    root@am437x-evm:~# gdb
    GNU gdb (GDB) 7.6
    Copyright (C) 2013 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 "arm-linux-gnueabihf".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    (gdb) set verbose on
    (gdb) set debug-file-directory /debug/
    (gdb) file test 
    Reading symbols from /home/root/test...sdone.
    (gdb) b main
    Reading in symbols for test.c...done.
    Breakpoint 1 at 0x123dc: file test.c, line 1585.
    (gdb) r
    Starting program: /home/root/test
    Reading symbols from /lib/ld-linux-armhf.so.3...Reading symbols from /debug/lib/ld-2.15.so...done.
    done.
    Loaded symbols for /lib/ld-linux-armhf.so.3
    Reading symbols from /lib/libdl.so.2...Reading symbols from /debug/lib/libdl-2.15.so...done.
    done.
    Loaded symbols for /lib/libdl.so.2
    Reading symbols from /lib/libpthread.so.0...Reading symbols from /debug/lib/libpthread-2.15.so...done.
    done.
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/libthread_db.so.1".
    Reading in symbols for events.c...done.
    Loaded symbols for /lib/libpthread.so.0
    Reading symbols from /lib/libtinfo.so.5...(no debugging symbols found)...done.
    Loaded symbols for /lib/libtinfo.so.5
    Reading symbols from /lib/libm.so.6...Reading symbols from /debug/lib/libm-2.15.so...done.
    done.
    Loaded symbols for /lib/libm.so.6
    Reading symbols from /lib/libresolv.so.2...Reading symbols from /debug/lib/libresolv-2.15.so...done.
    done.
    Loaded symbols for /lib/libresolv.so.2
    Reading symbols from /lib/libc.so.6...Reading symbols from /debug/lib/libc-2.15.so...done.
    done.
    Loaded symbols for /lib/libc.so.6
    Reading in symbols for ../nptl/sysdeps/pthread/pt-longjmp.c...done.
    
    Breakpoint 1, Reading in symbols for libc-start.c...done.
    main (argc=2, argv=0xbefffdc4) at test.c:1585
    1585 test.c: No such file or directory.
    (gdb) c
    Continuing.
    Reading in symbols for ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S...done.
    
    Program received signal SIGINT, Interrupt.
    Reading in symbols for ../sysdeps/unix/sysv/linux/poll.c...done.
    __libc_do_syscall ()
        at ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S:46
    46 ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S: No such file or directory.
    Current language:  auto
    The current source language is "auto; currently asm".
    (gdb) bt
    ......
    Reading in symbols for ../ports/sysdeps/unix/sysv/linux/arm/nptl/../clone.S...done.
    #0  __libc_do_syscall ()
        at ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S:46
    #1  0xb6eb24a8 in __GI___poll (fds=0xb6e2ac18, nfds=1, timeout=-1)
        at ../sysdeps/unix/sysv/linux/poll.c:87
    (gdb) 

    Cheer!
    Roy