From 7d2d573b360003f69751228387ba98f2b77dc4a2 Mon Sep 17 00:00:00 2001 From: Gerald Pinder Date: Sat, 16 Sep 2023 00:15:38 -0400 Subject: [PATCH] Add primer for rust debugging --- usr-jp/local/etc/lldb_vscode_rustc_primer.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 usr-jp/local/etc/lldb_vscode_rustc_primer.py diff --git a/usr-jp/local/etc/lldb_vscode_rustc_primer.py b/usr-jp/local/etc/lldb_vscode_rustc_primer.py new file mode 100644 index 0000000..b808b84 --- /dev/null +++ b/usr-jp/local/etc/lldb_vscode_rustc_primer.py @@ -0,0 +1,12 @@ +import subprocess +import pathlib +import lldb + +# determine the sysroot for the active rust interpreter +rustlib_etc = pathlib.Path(subprocess.getoutput('rustc --print sysroot')) / 'lib' / 'rustlib' / 'etc' +if not rustlib_etc.exists(): + raise RuntimeError('Unable to determine rustc sysroot') + +# load lldb_lookup.py and execute lldb_commands with the correct path +lldb.debugger.HandleCommand(f"""command script import "{rustlib_etc / 'lldb_lookup.py'}" """) +lldb.debugger.HandleCommand(f"""command source -s 0 "{rustlib_etc / 'lldb_commands'}" """) \ No newline at end of file