当前位置: 技术问答>linux和unix
gdb查看嵌入式core文件的问题
来源: 互联网 发布时间:2017-05-25
本文导语: Hi,板上的大牛们,本人目前由于一个偶发的bug(可能十多天才出一次)需要对嵌入式进程进行调试,因此用到了core dump功能,但是在使用过程中遇到了下列问题,网上查了好多方法还是无法解决,因此在版上请教一...
Hi,板上的大牛们,本人目前由于一个偶发的bug(可能十多天才出一次)需要对嵌入式进程进行调试,因此用到了core dump功能,但是在使用过程中遇到了下列问题,网上查了好多方法还是无法解决,因此在版上请教一下。
为了使用core文件,本人首先在主机linux做了测试(特意做了一个崩溃的进程例子),具体如下:
源代码:
在主机上进行编译:
gcc -g main.c -o main
运行结果:
this is a test
Floating point exception (core dumped)
执行gdb ./main core后:
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
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 "i486-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/wangwei/dm365/MyDoc/test/main...done.
[New Thread 4048]
warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/tls/i686/cmov/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `./main'.
Program terminated with signal 8, Arithmetic exception.
#0 0x0804840b in main () at main.c:4
4 int i= 10/0;
红色部分可以看出通过gdb将core文件正常读出,下面进行嵌入式版本测试,源代码同上。
交叉编译:
arm-none-linux-gnueabi-gcc -g main.c -o main
在嵌入式上运行:
root@dm365-evm:/home/test# ./main
this is a test
Floating point exception (core dumped)
将./main和core拷贝到主机上,执行gdb ./main core查看
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
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 "i486-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/wangwei/dm365/MyDoc/test/main...done.
warning: Couldn't find general-purpose registers in core file.
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?)
Error while mapping shared library sections:
/lib/ld-linux.so.3: No such file or directory.
Reading symbols from /lib/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Symbol file not found for /lib/ld-linux.so.3
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Core was generated by `./main'.
warning: Couldn't find general-purpose registers in core file.
#0 0x00000000 in ?? ()
如上红色部分,查看core文件失败;
根据上面的提示,我的理解是否是gdb需要用到嵌入式下的库文件?或者需要嵌入式版的gdb来查看?请大神们指点,万分感激。
为了使用core文件,本人首先在主机linux做了测试(特意做了一个崩溃的进程例子),具体如下:
源代码:
#include
int main(){
printf("this is a testn");
int i= 10/0;
return 0;
}
在主机上进行编译:
gcc -g main.c -o main
运行结果:
this is a test
Floating point exception (core dumped)
执行gdb ./main core后:
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
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 "i486-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/wangwei/dm365/MyDoc/test/main...done.
[New Thread 4048]
warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/tls/i686/cmov/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `./main'.
Program terminated with signal 8, Arithmetic exception.
#0 0x0804840b in main () at main.c:4
4 int i= 10/0;
红色部分可以看出通过gdb将core文件正常读出,下面进行嵌入式版本测试,源代码同上。
交叉编译:
arm-none-linux-gnueabi-gcc -g main.c -o main
在嵌入式上运行:
root@dm365-evm:/home/test# ./main
this is a test
Floating point exception (core dumped)
将./main和core拷贝到主机上,执行gdb ./main core查看
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
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 "i486-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/wangwei/dm365/MyDoc/test/main...done.
warning: Couldn't find general-purpose registers in core file.
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?)
Error while mapping shared library sections:
/lib/ld-linux.so.3: No such file or directory.
Reading symbols from /lib/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Symbol file not found for /lib/ld-linux.so.3
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Core was generated by `./main'.
warning: Couldn't find general-purpose registers in core file.
#0 0x00000000 in ?? ()
如上红色部分,查看core文件失败;
根据上面的提示,我的理解是否是gdb需要用到嵌入式下的库文件?或者需要嵌入式版的gdb来查看?请大神们指点,万分感激。
|
gdb不对,如果是arm的需要arm-linux-gdb
|
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。