mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 21:11:27 +01:00
Document and configure running lldb from the command line (#5324)
The docs explain that you must use `--local-lldbinit` in the command line, and include an example of how to run a file_test under lldb from the command line. This PR includes `.lldbinit` file and `lldbinit.py` file which set up our default options, copied from the VSCode launcher. The instructions include settin the `max-string-summary-length`, and we include this in the vscode launcher for lldb, as printing `Dump()` output can easily get truncated otherwise when printing an InstBlockId.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""Initialization for lldb."""
|
||||
|
||||
__copyright__ = """
|
||||
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
Exceptions. See /LICENSE for license information.
|
||||
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
"""
|
||||
|
||||
# This script is only meant to be used from LLDB.
|
||||
import lldb # type: ignore
|
||||
import os
|
||||
|
||||
project_root = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
ci = lldb.debugger.GetCommandInterpreter()
|
||||
result = lldb.SBCommandReturnObject()
|
||||
|
||||
|
||||
def RunCommand(cmd: str) -> None:
|
||||
"""Runs a command and prints it to the console to show that it ran."""
|
||||
print("(lldb) %s" % cmd)
|
||||
ci.HandleCommand(cmd, result)
|
||||
|
||||
|
||||
RunCommand(f"settings append target.source-map . {project_root}")
|
||||
RunCommand(f"settings append target.source-map /proc/self/cwd {project_root}")
|
||||
Reference in New Issue
Block a user