[Lldb-commits] [lldb] [lldb-dap] Implement command directives (PR #74808)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 8 20:42:54 PST 2023


https://github.com/clayborg requested changes to this pull request.

I would rather not terminate the debug session if we get erorrs on `!`. It would be nice if  the `RunLLDBCommands` function could take an extra `bool &fatal_error` that clients could check after running when needed to decide what to do if this is set to true due to any `!` prefixed commands failing. Then for `"launchCommands"` in lldb-dap.cpp's `lldb::SBError LaunchProcess(const llvm::json::Object &request)` could use this bool variable to return an error when needed:
```
    g_dap.target.SetLaunchInfo(launch_info);
    bool fatal_error = false;
    g_dap.RunLLDBCommands("Running launchCommands:", launchCommands, fatal_error);
    if (fatal_error)
      error.SetErrorWithString("some required 'launchComands' failed, see debug console for details");
```
So each call site that calls RunLLDBCommands(...) would need to watch for this variable being set to true and do what is needed to return an error for the current command

https://github.com/llvm/llvm-project/pull/74808


More information about the lldb-commits mailing list