安装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
-
手动下载install.sh和x86_64-ubuntu22.04.tar.gz,相关的重要代码如下:
-
下载函数
# 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
点击可查看变量值和相关代码