title: Using vscode debug console with rust
body: <p>I'm a little uncertain who's console I'm using. But let's say I have following debug configuration:</p>
  <pre><code>{
      &quot;version&quot;: &quot;0.2.0&quot;,
      &quot;inputs&quot;: [
          ...
      ],
      &quot;configurations&quot;: [
          {
              &quot;type&quot;: &quot;lldb&quot;,
              &quot;request&quot;: &quot;attach&quot;,
              &quot;name&quot;: &quot;Attach to...&quot;,
              &quot;program&quot;: &quot;${workspaceFolder}/src/lib/${input:pickPackage}/target/debug/${input:pickPackage}&quot;
          }
      ]
  }
  </code></pre>
  <p>my program is running in macos terminal with <code>cargo run -p ...</code></p>
  <p>vscode's debugger provides me with debug console to lldb</p>
  <p>say, I'm in a breakpoint and want to try things out...</p>
  <p>I so far tried rust</p>
  <pre><code>script println!(&quot;{:?}&quot;, &amp;t[op_end_index..])
    File &quot;&lt;input&gt;&quot;, line 1
      println!(&quot;{:?}&quot;, &amp;t[op_end_index..])
             ^
  SyntaxError: invalid syntax
  script &amp;t[op_end_index..]
    File &quot;&lt;input&gt;&quot;, line 1
      &amp;t[op_end_index..]
      ^
  SyntaxError: invalid syntax
  script fn main () {println!(&quot;{:?}&quot;, &amp;t[op_end_index..])}
    File &quot;&lt;input&gt;&quot;, line 1
      fn main () {println!(&quot;{:?}&quot;, &amp;t[op_end_index..])}
         ^
  SyntaxError: invalid syntax
  </code></pre>
  <p><a href="https://kapeli.com/cheat_sheets/LLDB_Commands.docset/Contents/Resources/Documents/index#//dash_ref/Category/Miscellaneous/1" rel="nofollow noreferrer">What I found in the lldb dos</a></p>
  <pre><code>script print &quot;Here is some text&quot;
    File &quot;&lt;input&gt;&quot;, line 1
      print &quot;Here is some text&quot;
            ^
  SyntaxError: Missing parentheses in call to 'print'. Did you mean print(&quot;Here is some text&quot;)?
  </code></pre>
  <p>and finally what it suggest from the error:</p>
  <pre><code>script print (&quot;Here is some text&quot;)
  Here is some text
  </code></pre>
  <p>Hello word is nice but how do I get to my actual scope?</p>
  <p>Am I supposed to use lldb's <code>script</code> command for that?</p>
  <p>What's my syntax there?</p>
  <h1>Update</h1>
  <p>@ForceBru thanks for the hint about python.</p>
  <p>What I'm interacting with is <a href="https://kapeli.com/cheat_sheets/LLDB_Commands.docset/Contents/Resources/Documents/index#//dash_ref/Category/Miscellaneous/1" rel="nofollow noreferrer">vscode-lldb debugger api</a></p>
  <p>It seems I should be able to do something like <code>script debugger.evaluate(&quot;/se t[0]&quot;)</code> after adding <code>&quot;sourceLanguages&quot;: [&quot;rust&quot;]</code> from <a href="https://github.com/vadimcn/vscode-lldb/blob/v1.6.0/MANUAL.md#rust-language-support" rel="nofollow noreferrer">https://github.com/vadimcn/vscode-lldb/blob/v1.6.0/MANUAL.md#rust-language-support</a> to my configuration</p>
  <p>but no luck</p>
  <pre><code>script debugger.evaluate(&quot;/se t[0]&quot;)
  Traceback (most recent call last):
    File &quot;&lt;input&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/Users/anvlkv/.vscode/extensions/vadimcn.vscode-lldb-1.6.0/adapter/debugger.py&quot;, line 8, in evaluate
      value = codelldb.evaluate_in_context(expr, True, exec_context)
    File &quot;/Users/anvlkv/.vscode/extensions/vadimcn.vscode-lldb-1.6.0/adapter/codelldb.py&quot;, line 276, in evaluate_in_context
      return eval(code, eval_globals, eval_locals)
    File &quot;&lt;string&gt;&quot;, line 1
      /se t[0]
      ^
  SyntaxError: invalid syntax
  
  </code></pre>
  <p>I'm still in python</p>
  <pre><code>script debugger.evaluate(&quot;locals().keys()&quot;)
  dict_keys([])
  </code></pre>