当前位置: 首页 > article >正文

Android15之解决gdb:Remote register badly formatted问题(二百三十六)

简介: CSDN博客专家、《Android系统多媒体进阶实战》一书作者

新书发布:《Android系统多媒体进阶实战》🚀
优质专栏: Audio工程师进阶系列原创干货持续更新中……】🚀
优质专栏: 多媒体系统工程师系列原创干货持续更新中……】🚀
优质视频课程:AAOS车载系统+AOSP14系统攻城狮入门视频实战课 🚀

人生格言: 人生从来没有捷径,只有行动才是治疗恐惧和懒惰的唯一良药.

更多原创,欢迎关注:Android系统攻城狮

欢迎关注Android系统攻城狮

🍉🍉🍉文章目录🍉🍉🍉

    • 🌻1.前言
    • 🌻2.gdb介绍
    • 🌻3.解决方案
      • 🐓3.1 查看cpu架构
      • 🐓3.2 gdb设置cpu架构

🌻1.前言

本篇目的:Android15之解决gdb:Remote register badly formatted问题

  • 详细报错:
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
warning: while parsing target description (at line 4): Target description specified unknown architecture "aarch64"
warning: Could not load XML target description; ignoring
Reading /system/bin/cameraserver from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /system/bin/cameraserver from remote target...
Reading symbols from target:/system/bin/cameraserver...
Reading /usr/lib/debug/.build-id/a2/71360f43b374f7c470860ddb073a9f.debug from remote target...
Reading symbols from .gnu_debugdata for target:/system/bin/cameraserver...
warning: section .interp not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .note.android.ident not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .note.gnu.build-id not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .dynsym not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .gnu.version not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .gnu.version_r not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .gnu.hash not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .dynstr not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .rela.dyn not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .relr.dyn not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .rela.plt not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .rodata not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .eh_frame_hdr not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .eh_frame not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .plt not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .tdata not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .preinit_array not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .init_array not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .fini_array not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .dynamic not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .got not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .got.plt not found in .gnu_debugdata for target:/system/bin/cameraserver
warning: section .bss not found in .gnu_debugdata for target:/system/bin/cameraserver
(No debugging symbols found in .gnu_debugdata for target:/system/bin/cameraserver)
Remote register badly formatted: T001d:602f7dc77f000000;1f:802e7dc77f000000;20:98460e667d000000;thread:p1363.1363;core:0;
here: 7f000000;1f:802e7dc77f000000;20:98460e667d000000;thread:p1363.1363;core:0;

🌻2.gdb介绍

  • GDB(GNU Debugger)是一款功能强大的程序调试工具,由GNU项目开发,主要用于C、C++、Ada、Fortran等编程语言的调试。GDB可以帮助开发者查找程序中的错误,分析程序运行时的状态,以及了解程序崩溃的原因。作为开源软件,GDB广泛应用于Linux、Unix、macOS等操作系统,成为了许多程序员日常开发不可或缺的工具。
    GDB的主要特点如下:
  1. 断点设置:GDB允许在代码的特定位置设置断点,当程序运行到这些位置时,会暂停执行,便于开发者观察程序状态。
  2. 单步执行:通过单步执行,开发者可以观察程序在每一条指令执行后的状态变化,从而找到问题所在。
  3. 变量查看:GDB可以查看程序中各种变量的值,包括局部变量、全局变量以及静态变量,帮助开发者分析程序逻辑。
  4. 调用栈分析:GDB提供了查看调用栈的功能,可以显示函数调用顺序及各个函数的参数值,便于定位错误所在的函数。
  5. 动态修改:在调试过程中,GDB允许动态修改程序中的变量值,甚至可以直接修改代码,从而快速测试不同场景下的程序表现。
  6. 信号处理:GDB可以捕获程序运行时收到的信号,并显示信号处理函数的调用栈,帮助开发者分析信号处理相关的问题。
  7. 多线程调试:GDB支持多线程程序的调试,可以分别查看和控制各个线程的执行状态。
  8. 调试核心文件:GDB能够分析程序崩溃时生成的核心文件,找出导致程序崩溃的原因。
    GDB的基本使用流程如下:
  9. 编译程序:在编译程序时,需要添加调试信息选项(如GCC的"-g"选项),以便GDB能够获取到程序的源代码信息。
  10. 启动GDB:在命令行中输入"gdb"命令,启动GDB调试器。
  11. 加载程序:使用"gdb"命令启动GDB后,通过"file"命令加载要调试的程序。
  12. 设置断点:使用"break"命令在程序的特定位置设置断点。
  13. 运行程序:使用"run"命令开始执行程序,程序会在断点处暂停。
  14. 查看状态:在断点处,可以使用各种GDB命令查看程序状态,如"print"查看变量值,"next"单步执行等。
  15. 继续执行:使用"continue"命令让程序继续执行,直到遇到下一个断点或程序结束。
  16. 退出GDB:调试完成后,使用"quit"命令退出GDB。
  • GDB作为一款强大的调试工具,其功能丰富且灵活,能够有效提高开发者查找和解决问题的效率。熟练掌握GDB的使用,对于程序员来说具有重要的实际意义。

🌻3.解决方案

🐓3.1 查看cpu架构

# lscpu
架构:                   x86_64
  CPU 运行模式:         32-bit, 64-bit
  Address sizes:         39 bits physical, 48 bits virtual
  字节序:               Little Endian
  • cpu架构为: x86_64

🐓3.2 gdb设置cpu架构

(gdb) set architecture i386:x86-64
The target architecture is set to "i386:x86-64".
  • 设置成功以后,再来执行gdb命令操作即可。

http://www.kler.cn/news/357762.html

相关文章:

  • 架构设计笔记-21-案例分析
  • unity 音频和文字转换工具分享
  • RAII - 安卓中的智能指针
  • CTF(五)
  • 闯关leetcode——136. Single Number
  • 软件开发的项目管理的风险有哪些?
  • 深度学习的全面解析
  • 数学考研高分突破:解题思维与速度的双重修炼
  • 38岁老Mac“复工”,被改造上网!
  • Qt第十三天:网络编程:TCP和UDP的使用
  • 高效图书管理:基于Spring Boot的进销存系统
  • 洛谷 AT_abc373_d [ABC373D] Hidden Weights 题解
  • 019_基于python+django食品销售数据分析系统2024_4032ydxt
  • cpp详解:string
  • 基于单片机的 16 键多功能电子琴硬件设计
  • 人工智能公司未达到欧盟人工智能法案标准
  • Sentinel 快速入门
  • 网络安全有关法律法规
  • SpringBoot民宿预订系统设计与实现
  • LeetCode714:买卖股票的最佳时机含手续费