lldbinit.py 815 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python3
  2. """Initialization for lldb."""
  3. __copyright__ = """
  4. Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  5. Exceptions. See /LICENSE for license information.
  6. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. """
  8. # This script is only meant to be used from LLDB.
  9. import lldb # type: ignore
  10. import os
  11. project_root = os.path.dirname(os.path.realpath(__file__))
  12. ci = lldb.debugger.GetCommandInterpreter()
  13. result = lldb.SBCommandReturnObject()
  14. def RunCommand(cmd: str) -> None:
  15. """Runs a command and prints it to the console to show that it ran."""
  16. print("(lldb) %s" % cmd)
  17. ci.HandleCommand(cmd, result)
  18. RunCommand(f"settings append target.source-map . {project_root}")
  19. RunCommand(f"settings append target.source-map /proc/self/cwd {project_root}")