在Raspberry Pi上,使用本机gdb在x86中交叉编译helloworld不会显示源信息

时间:2015-11-16 19:15:39

标签: gdb raspberry-pi

当我在x86目标覆盆子pi上交叉编译helloworld代码时,pi的本机gdb不显示符号信息。原生pi的gcc工作得很好。

交叉编译器:

gcc version 4.8.3 20140106 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11) 

原生编译器:

gcc version 4.6.3 (Debian 4.6.3-14+rpi1) 

ls -al hellow *

-rw-rw-r-- 1 pi pi   81 Nov 16 18:54 hellow.c
-rwxrwxr-x 1 pi pi 7080 Nov 16 18:54 hellow_cross_compile
-rwxr-xr-x 1 pi pi 6529 Nov 16 18:57 hellow_native_compile

tlee @ raspberrypi~ / mnt / u1404 / k_pi / hellow $ gdb hellow_cross_compile

    GNU gdb (GDB) 7.4.1-debian
    Copyright (C) 2012 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/>...
    Reading symbols from /home/tlee/mnt/u1404/k_pi/hellow/hellow_cross_compile...done.
    (gdb) b main
    Breakpoint 1 at 0x8414
    (gdb) r
    Starting program: /home/tlee/mnt/u1404/k_pi/hellow/hellow_cross_compile 

    Breakpoint 1, 0x00008414 in main ()
    (gdb) quit

A debugging session is active.

    Inferior 1 [process 21284] will be killed.

Quit anyway? (y or n) y 

tlee @ raspberrypi~ / mnt / u1404 / k_pi / hellow $ gdb ./hellow_native_compile

GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 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/>...
Reading symbols from /home/tlee/mnt/u1404/k_pi/hellow/hellow_native_compile...done.
(gdb) b main
Breakpoint 1 at 0x83dc: file hellow.c, line 6.
(gdb) r
Starting program: /home/tlee/mnt/u1404/k_pi/hellow/hellow_native_compile 

Breakpoint 1, main (argc=1, argv=0x7efff7e4) at hellow.c:6
6       printf("hellow\n");
(gdb) quit
A debugging session is active.

    Inferior 1 [process 21307] will be killed.

Quit anyway? (y or n) y

有没有人遇到这个?知道为什么以及如何解决它?

0 个答案:

没有答案