本文主要是介绍GDB 调试出现:Couldn't find general-purpose registers in core file,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
现在平台基本都是64位的,用平台默认的gdb工具来加载vmlinux和ramdump会出现:
warning: Couldn't find general-purpose registers in core file.warning: Couldn't find general-purpose registers in core file.
#0 <unavailable> in ?? ()
这是因为该gdb版本比较落后,并不能支持当前ARM平台的寄存器设置,无法识别;
解决方法:官网下载最新的gdb版本:http://www.gnu.org/software/gdb/download/
我下载的是最新的版本gdb 8.0,下载下来解压:
~$ cd gdb-8.0~/gdb-8.0$ ./configure --host=x86_64-linux-gnu --target=aarch64-elf-linux
configure: WARNING: If you wanted to set the --build type, don't use --host.If a cross compiler is detected then cross compile mode will be used.
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... aarch64-elf-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
需要根据平台config,如果不知道也可以打开平台自带的老版本gdb查看:
$ ./aarch64-linux-android-gdb -version
Python Exception <type 'exceptions.ImportError'> No module named gdb: warning:
Could not load the Python gdb module from `/tmp/ndk-mtk04092/build/toolchain/prefix/share/gdb/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.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 "--host=x86_64-linux-gnu --target=aarch64-elf-linux".
For bug reporting instructions, please see:
<http://source.android.com/source/report-bugs.html>.
最后make一下,在gdb目录下就可以找到运行的gdb bin文件了:
~/gdb-8.0$ ./gdb/gdb --version
GNU gdb (GDB) 8.0
Copyright (C) 2017 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 "--host=x86_64-linux-gnu --target=aarch64-elf-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
用gdb 加载vmlinux和rumdump:
$ ./gdb vmlinux rumdump
GNU gdb (GDB) 8.0
Copyright (C) 2017 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 "--host=x86_64-linux-gnu --target=aarch64-elf-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from vmlinux...done.
[New LWP 107]
[New LWP 1]
[New LWP 2]
[New LWP 3]
[New LWP 4]
[New LWP 5]
[New LWP 6]
[New LWP 7]
[New LWP 8]
Core was generated by `console=tty0 console=ttyMT0,921600n1 root=/dev/ram vmalloc=496M slub_max_order='.
#0 0xffffffc0006bd034 in capture (image_window=<optimized out>, sensor_config_data=<optimized out>)at xxx.c:1252
1252 BUG();(gdb) bt
#0 0xffffffc0006bd034 in capture (image_window=<optimized out>, sensor_config_data=<optimized out>)at xxx.c:1252
#1 control (scenario_id=<optimized out>, image_window=<optimized out>, sensor_config_data=<optimized out>)at xxx.c:1461
这篇关于GDB 调试出现:Couldn't find general-purpose registers in core file的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!