日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

使用 rr 进行debug

發布時間:2023/12/20 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用 rr 进行debug 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

使用 rr 進行debug

  • 簡介
    • 關鍵詞
  • 安裝
    • 編譯源文件方法
    • Fedora:
    • ubuntu
    • arch
  • 使用
    • 開始
    • 回放剛才的運行過程
    • 反向debug
    • 記錄觀察點

簡介

關鍵詞

  • 保留某一次的運行錯誤
  • 對錯誤可以反復執行
  • 可以反向執行(這個猛)
  • 操作和gdb沒啥區別

rr aspires to be your primary C/C++ debugging tool for Linux, replacing — well, enhancing — gdb. You record a failure once, then debug the recording, deterministically, as many times as you want. The same execution is replayed every time.
rr also provides efficient reverse execution under gdb. Set breakpoints and data watchpoints and quickly reverse-execute to where they were hit.
rr works on real applications and is used by many developers to fix real bugs. It makes debugging hard bugs much easier, but also speeds up debugging of easy bugs.

rr 渴望成為 Linux 的主要 C/C++ 調試工具,取代——嗯,增強——gdb。您記錄一次失敗,然后確定性地根據需要多次調試記錄。每次都重播相同的執行
rr 還提供了 gdb 下的高效反向執行。設置斷點和數據觀察點并快速反向執行到它們被擊中的地方。
rr 適用于實際應用程序,許多開發人員使用它來修復實際錯誤。它使調試困難的錯誤變得更加容易,但也加快了對簡單錯誤的調試。

翻譯自官網

安裝

不同系統有不同安裝方式,參見:

編譯源文件方法

github指南

Fedora:

cd /tmp wget https://github.com/rr-debugger/rr/releases/download/5.5.0/rr-5.5.0-Linux-$(uname -m).rpm sudo dnf install rr-5.5.0-Linux-$(uname -m).rpm

ubuntu

cd /tmp wget https://github.com/rr-debugger/rr/releases/download/5.5.0/rr-5.5.0-Linux-$(uname -m).deb sudo dpkg -i rr-5.5.0-Linux-$(uname -m).deb

arch

yay 搜索一下安裝即可,這個最簡單。

使用

開始

對于某個程序,只需要輸入

rr record /your/application --args

對于rosrun這種運行方式,可以通過

rosrun --prefix 'rr record' your/node

來進行。

回放剛才的運行過程

rr replay

進入回放。replay后的調試操作和debug一樣。

反向debug

設置斷點后,運行到斷點后的某處,使用rc,即reverse continue,即可反向運行到之前的斷點處。
‘rn’ 即reverse next, 即可逆向gdb的next進行反向回退。

記錄觀察點

watch -l 變量
可以實時觀察這一變量是否發生變化,有變化立刻停止,十分便于觀察各種隱含錯誤。

總結

以上是生活随笔為你收集整理的使用 rr 进行debug的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。