0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

rr : アプリケーションの実行の記録と再生するツール

Last updated at Posted at 2021-09-03

はじめに

デバッグツールとして非常に役に立ちそうな rr だが、意外と情報が少ない
特に、たまにしか発生しない不具合の解析に特に有意義だと考えられるので rr の情報をまとめる

ソフトウェアの不具合の発生原因を調査するため便利ツール rr
このツールの凄いところは、、、

  1. 不具合発生するまでの一連の流れをすべて記録して
  2. それを再生することが出来ること
  3. 巻き戻し再生も可能
  4. 同等のマシンであれば記録と再生を別のマシンで行うことも可能

つまり、起きた不具合を確実に再現することが可能であり、その不具合の根本原因を探るために記録を巻き戻して変数の内容が確認できる。
また、テスターが不具合発生を記録しておき、エンジニアが再生して不具合を調査する、というような不具合解析も可能となる。

rr とは?

rr公式ページでの rr の紹介

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 の基本機能

  • アプリケーションの実行を記録する
  • 記録内容を再生する
  • 記録内容をパッケージにしてどこでも再生可能にする

rr の利用方法

アプリの実行
$ rr record ./a.out args
実行記録の再生
$ rr replay
実行記録のパッケージ
$ rr pack

rr を実際に使ってみる

Instant replay: Debugging C and C++ programs with rr

rr の欠点

  • 複数スレッドの同時実行記録はできない
  • 記録していないプロセスとの共有メモリの競合
  • 記録するため実行に時間がかかる(再生は早い)

Ubuntu での rr のインストール方法

x64向けのUbuntu向けは rr パッケージ が用意されている

rrのインストール
sudo apt-get update
sudo apt-get install rr

参考資料

小ネタ

  • rr という固有名詞とは思えない名前のため、 Google で検索する際には "rr"" で囲っておかないと rr 関連の検索がうまくいかないことに注意
  • 5.4.0からAArch64も実験的にサポート開始

関連記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?