Files
sunnypilot/DEBUGGING_SAFETY/index.html
T

189 lines
8.5 KiB
HTML

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><link rel="canonical" href="https://docs.comma.ai/DEBUGGING_SAFETY/" />
<link rel="shortcut icon" href="../img/favicon.ico" />
<title>Debugging Panda Safety with Replay Drive + LLDB - openpilot docs</title>
<link rel="stylesheet" href="../css/theme.css" />
<link rel="stylesheet" href="../css/theme_extra.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css" />
<link href="../css/tooltip.css" rel="stylesheet" />
<script>
// Current page data
var mkdocs_page_name = "Debugging Panda Safety with Replay Drive + LLDB";
var mkdocs_page_input_path = "DEBUGGING_SAFETY.md";
var mkdocs_page_url = "/DEBUGGING_SAFETY/";
</script>
<!--[if lt IE 9]>
<script src="../js/html5shiv.min.js"></script>
<![endif]-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href=".." class="icon icon-home"> openpilot docs
</a><div role="search">
<form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" title="Type search term here" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption"><span class="caption-text">Getting Started</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../getting-started/what-is-openpilot/">What is openpilot?</a>
</li>
</ul>
<p class="caption"><span class="caption-text">How-to</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../how-to/turn-the-speed-blue/">Turn the speed blue</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../how-to/connect-to-comma/">Connect to a comma 3X</a>
</li>
</ul>
<p class="caption"><span class="caption-text">Concepts</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../concepts/logs/">Logs</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../concepts/safety/">Safety</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../concepts/glossary/">Glossary</a>
</li>
</ul>
<p class="caption"><span class="caption-text">Car Porting</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../car-porting/what-is-a-car-port/">What is a car port?</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../car-porting/brand-port/">Porting a car brand</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../car-porting/model-port/">Porting a car model</a>
</li>
</ul>
<p class="caption"><span class="caption-text">Contributing</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../contributing/roadmap/">Roadmap</a>
</li>
<li class="toctree-l1"><a class="" href="https://github.com/commaai/openpilot/blob/master/docs/CONTRIBUTING.md">Contributing Guide →</a>
</li>
</ul>
<p class="caption"><span class="caption-text">Links</span></p>
<ul>
<li class="toctree-l1"><a class="" href="https://blog.comma.ai">Blog →</a>
</li>
<li class="toctree-l1"><a class="" href="https://comma.ai/bounties">Bounties →</a>
</li>
<li class="toctree-l1"><a class="" href="https://github.com/commaai">GitHub →</a>
</li>
<li class="toctree-l1"><a class="" href="https://discord.comma.ai">Discord →</a>
</li>
<li class="toctree-l1"><a class="" href="https://x.com/comma_ai">X →</a>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="Mobile navigation menu">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="..">openpilot docs</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content"><div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href=".." class="icon icon-home" aria-label="Docs"></a></li>
<li class="breadcrumb-item active">Debugging Panda Safety with Replay Drive + LLDB</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/commaai/openpilot/edit/master/docs/DEBUGGING_SAFETY.md" class="icon icon-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div class="section" itemprop="articleBody">
<h1 id="debugging-panda-safety-with-replay-drive-lldb">Debugging Panda Safety with Replay Drive + LLDB</h1>
<h2 id="1-start-the-debugger-in-vs-code">1. Start the debugger in VS Code</h2>
<ul>
<li>Select <strong>Replay drive + Safety LLDB</strong>.</li>
<li>Enter the route or segment when prompted.
<a href="https://github.com/user-attachments/assets/b0cc320a-083e-46a7-a9f8-ca775bbe5604"><img src="https://github.com/user-attachments/assets/b0cc320a-083e-46a7-a9f8-ca775bbe5604"></a></li>
</ul>
<h2 id="2-attach-lldb">2. Attach LLDB</h2>
<ul>
<li>When prompted, pick the running <strong><code>replay_drive</code> process</strong>.</li>
<li>⚠️ Attach quickly, or <code>replay_drive</code> will start consuming messages.</li>
</ul>
<blockquote>
<p>[!TIP]
Add a Python breakpoint at the start of <code>replay_drive.py</code> to pause execution and give yourself time to attach LLDB.</p>
</blockquote>
<h2 id="3-set-breakpoints-in-vs-code">3. Set breakpoints in VS Code</h2>
<p>Breakpoints can be set directly in <code>modes/xxx.h</code> (or any C file).
No extra LLDB commands are required — just place breakpoints in the editor.</p>
<h2 id="4-resume-execution">4. Resume execution</h2>
<p>Once attached, you can step through both Python (on the replay) and C safety code as CAN logs are replayed.</p>
<blockquote>
<p>[!NOTE]
* Use short routes for quicker iteration.
* Pause <code>replay_drive</code> early to avoid wasting log messages.</p>
</blockquote>
<h2 id="video">Video</h2>
<p>View a demo of this workflow on the PR that added it: https://github.com/commaai/openpilot/pull/36055#issue-3352911578</p>
</div>
</div><footer>
<hr/>
<div role="contentinfo">
<!-- Copyright etc -->
</div>
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" role="note" aria-label="Versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span>
<a href="https://github.com/commaai/openpilot/" class="fa fa-github" style="color: #fcfcfc"> GitHub</a>
</span>
</span>
</div>
<script src="../js/jquery-3.6.0.min.js"></script>
<script>var base_url = "..";</script>
<script src="../js/theme_extra.js"></script>
<script src="../js/theme.js"></script>
<script src="../search/main.js"></script>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>