================ @@ -17,12 +17,24 @@ namespace lldb_dap { bool RunLLDBCommands(lldb::SBDebugger &debugger, llvm::StringRef prefix, const llvm::ArrayRef<std::string> &commands, - llvm::raw_ostream &strm, bool parse_command_directives) { + llvm::raw_ostream &strm, bool parse_command_directives, + bool echo_commands) { if (commands.empty()) return true; bool did_print_prefix = false; + // Get the default prompt from settings. + std::string prompt_string = "(lldb) "; + if (const lldb::SBStructuredData prompt = debugger.GetSetting("prompt")) { + const size_t prompt_length = prompt.GetStringValue(nullptr, 0); + + if (prompt_length != 0) { + prompt_string.resize(prompt_length + 1); + prompt.GetStringValue(prompt_string.data(), prompt_string.length()); + } + } ---------------- JDevlieghere wrote:
Let's avoid computing this if we don't need it. ```suggestion // We only need the prompt when echoing commands. std::string prompt_string; if (echo_commands) { prompt_string = "(lldb) "; // Get the current prompt from settings. if (const lldb::SBStructuredData prompt = debugger.GetSetting("prompt")) { const size_t prompt_length = prompt.GetStringValue(nullptr, 0); if (prompt_length != 0) { prompt_string.resize(prompt_length + 1); prompt.GetStringValue(prompt_string.data(), prompt_string.length()); } } } ``` https://github.com/llvm/llvm-project/pull/135008 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits