RUST笔记 FireDBG| Rust 代码调试器

安装https://firedbg.sea-ql.org/blog/2023-12-12-introducing-firedbg/

在这里插入图片描述

更新VSCODE

在这里插入图片描述

在这里插入图片描述

  • sudo dpkg -i code_1.85.2-1705561292_amd64.deb
    在这里插入图片描述在这里插入图片描述

在这里插入图片描述

安装FireDBG binaries

在这里插入图片描述在这里插入图片描述

(base) pdd@pdd-Dell-G15-5511:~$ curl https://raw.githubusercontent.com/SeaQL/FireDBG.for.Rust/main/install.sh -sSf | sh

error: timeout

# This wraps curl or wget. Try curl first, if not installed,
# use wget instead. 
downloader() {
    if check_cmd curl # 检查是否存在 curl 命令
    then _dld=curl
    elif check_cmd wget # 检查是否存在 wget 命令
    then _dld=wget
    else _dld='curl or wget' # to be used in error message of need_cmd
    fi

    #要使用这个函数下载一个文件,可以这样调用:downloader "https://example.com/file.zip" "downloaded_file.zip"
    # 如果传递的第一个参数是 --check,则检查是否存在 _dld(curl 或 wget)命令
    if [ "$1" = --check ]
    then need_cmd "$_dld"
    # 如果 _dld 是 curl,则使用 curl 下载文件
    elif [ "$_dld" = curl ]
    then curl -sSfL "$1" -o "$2"
    # 如果 _dld 是 wget,则使用 wget 下载文件
    elif [ "$_dld" = wget ]
    then wget "$1" -O "$2"
    # 如果 _dld 不是 curl 也不是 wget,输出错误消息
    else err "Unknown downloader"   # should not reach here
    fi
}
  • 函数在代码中的调用downloader "$_url" "$_file"
  • 需要修改的配置
    local _url="https://github.com/SeaQL/FireDBG.for.Rust/releases/download/$_firedbg_version/$_arch.tar.gz"
    local _dir="$(mktemp -d 2>/dev/null || ensure mktemp -d -t FireDBG)" # $(...):这是 Bash 中的命令替换语法,表示将命令的输出结果嵌入到字符串中
    local _file="$_dir/$_arch.tar.gz"
  • 修改成如下
    local _url="https://github.com/SeaQL/FireDBG.for.Rust/releases/download/$_firedbg_version/$_arch.tar.gz"
    local _dir="/home/pdd/myrust/mytemp"  
    # local _file="$_dir/$_arch.tar.gz"
    # downloader "$_url" "$_file
  • 结构如下:
    在这里插入图片描述

安装成功:

  • FireDBG binaries will be installed in ~/.cargo/bin and a debugger self test will be conducted to verify the installation.
$ bash install.sh 
info: downloading FireDBG from `https://github.com/SeaQL/FireDBG.for.Rust/releases/download/1.75.1/x86_64-ubuntu22.04.tar.gz`
info: installing FireDBG binaries to `/home/pdd/.cargo/bin`
info: performing FireDBG self tests
    Updating crates.io index
  Downloaded firedbg-lib v0.1.2
  Downloaded 1 crate (2.2 KB) in 1.35s
     Tracing `firedbg.toml` config file not found, default settings will be applied
     Tracing debugger_self_test = { trace = "full" }
      Parsed 2 source files; re-cached 2 source files
   Compiling firedbg-lib v0.1.2
   Compiling debugger_self_test v1.75.1 (/home/pdd/.cargo/bin/firedbg-lib/debugger-self-test)
    Finished dev [unoptimized + debuginfo] target(s) in 1.02s
     Running `LD_LIBRARY_PATH="/home/pdd/.cargo/bin/firedbg-lib/lib" "/home/pdd/.cargo/bin/firedbg-debugger" "run" "/home/pdd/.cargo/bin/firedbg-lib/debugger-self-test/target/debug/debugger_self_test" "--workspace-root" "/home/pdd/.cargo/bin/firedbg-lib/debugger-self-test" "--output" "/home/pdd/.cargo/bin/firedbg-lib/debugger-self-test/output.firedbg.ss" "--package-name" "debugger_self_test" "--package" "./full"`
Testing call_chain
Testing for_range
Testing hash_map
Testing return_char
Testing return_enum
Testing return_value
Testing return_object
Testing return_option
Testing return_result
Testing return_struct
Testing return_pointer
Testing return_ref_mut
Testing fn_return
info: completed FireDBG self tests

基础使用

  • git clone https://github.com/SeaQL/FireDBG.Rust.Testbench.git

在这里插入图片描述

FireDBG,启动!

在这里插入图片描述在这里插入图片描述

运行Target

在这里插入图片描述

生成调用树Call Tree

在这里插入图片描述

点击可查看变量值和相关代码

在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值