vadimcn / codelldb

A native debugger extension for VSCode based on LLDB
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
MIT License
2.42k stars 237 forks source link

lldb settings have no effect on the executed process #1061

Open leonid-s-usov opened 5 months ago

leonid-s-usov commented 5 months ago

OS: macOs 14.2.1 (23C71) VSCode version:

Version: 1.85.2 (Universal)
Commit: 8b3775030ed1a69b13e4f4c628c612102e30a681

CodeLLDB version: v1.10.0

Compiler:

Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.2.0

Debuggee: arch=arm64-apple-macosx14.0.0

I am debugging an application that uses the newer OpenSSL libraries with a known M1/M2 problem and solution. The solution involves requesting that EXC_BAD_INSTRUCTION be added to the darwin ignore list.

When running the debugger via the run configuration, I'm able to execute the commands in the DEBUG CONSOLE, but they don't seem to have an effect:

settings set platform.plugin.darwin.ignored-exceptions EXC_BAD_INSTRUCTION
settings show platform.plugin.darwin.ignored-exceptions
platform.plugin.darwin.ignored-exceptions (string) = "EXC_BAD_INSTRUCTION"

continue
Process 26585 resuming
Stop reason: EXC_BAD_INSTRUCTION (code=1, subcode=0x4a03000)

However, when I run lldb manually with the same executable and run the required lldb commands, I can avoid the exception and debug my application.

I also tried including the commands in the initCommands list. They appear to get executed, but still have no effect when running via the codeLLDB extension.

In the LLDB output section I only see this error repeating multiple times:

ERROR(Python) 14:38:09 codelldb: Traceback (most recent call last):
  File "/Users/me/.vscode/extensions/vadimcn.vscode-lldb-1.10.0/adapter/scripts/codelldb/codelldb.py", line 175, in evaluate
    value = evaluate_in_context(pycode, is_simple_expr, context)
  File "/Users/me/.vscode/extensions/vadimcn.vscode-lldb-1.10.0/adapter/scripts/codelldb/codelldb.py", line 320, in evaluate_in_context
    return eval(code, eval_globals, eval_locals)
  File "<input>", line 1, in <module>
  File "/Users/me/.vscode/extensions/vadimcn.vscode-lldb-1.10.0/adapter/scripts/codelldb/codelldb.py", line 309, in <lambda>
    eval_globals['__eval'] = lambda expr: nat_eval(frame, expr)
  File "/Users/me/.vscode/extensions/vadimcn.vscode-lldb-1.10.0/adapter/scripts/codelldb/codelldb.py", line 300, in nat_eval
    raise Exception(err.GetCString())
Exception: error: <user expression 20>:1:1: use of undeclared identifier 'payload'
    1 | payload
      | ^

[ERROR codelldb::debug_session] error: <user expression 20>:1:1: use of undeclared identifier 'payload'
        1 | payload
          | ^