@@ -69,20 +69,20 @@ const char DEV_NULL[] = "/dev/null";
6969
7070namespace lldb_dap {
7171
72- DAP::DAP (llvm::StringRef path, Log *log, const ReplMode default_repl_mode,
72+ llvm::StringRef DAP::debug_adapter_path = " " ;
73+
74+ DAP::DAP (Log *log, const ReplMode default_repl_mode,
7375 std::vector<std::string> pre_init_commands, Transport &transport)
74- : debug_adapter_path(path), log(log), transport(transport),
75- broadcaster (" lldb-dap" ), exception_breakpoints(),
76- pre_init_commands(std::move(pre_init_commands)),
77- focus_tid(LLDB_INVALID_THREAD_ID), stop_at_entry(false ), is_attach(false ),
78- enable_auto_variable_summaries(false ),
79- enable_synthetic_child_debugging(false ),
80- display_extended_backtrace(false ),
76+ : log(log), transport(transport), broadcaster(" lldb-dap" ),
77+ exception_breakpoints (), focus_tid(LLDB_INVALID_THREAD_ID),
78+ stop_at_entry(false ), is_attach(false ),
8179 restarting_process_id(LLDB_INVALID_PROCESS_ID),
8280 configuration_done_sent(false ), waiting_for_run_in_terminal(false ),
8381 progress_event_reporter(
8482 [&](const ProgressEvent &event) { SendJSON (event.ToJSON ()); }),
85- reverse_request_seq (0 ), repl_mode(default_repl_mode) {}
83+ reverse_request_seq (0 ), repl_mode(default_repl_mode) {
84+ configuration.preInitCommands = std::move (pre_init_commands);
85+ }
8686
8787DAP::~DAP () = default ;
8888
@@ -505,8 +505,9 @@ ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression,
505505 bool partial_expression) {
506506 // Check for the escape hatch prefix.
507507 if (!expression.empty () &&
508- llvm::StringRef (expression).starts_with (command_escape_prefix)) {
509- expression = expression.substr (command_escape_prefix.size ());
508+ llvm::StringRef (expression)
509+ .starts_with (configuration.commandEscapePrefix )) {
510+ expression = expression.substr (configuration.commandEscapePrefix .size ());
510511 return ReplMode::Command;
511512 }
512513
@@ -546,7 +547,7 @@ ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression,
546547 << " Warning: Expression '" << term
547548 << " ' is both an LLDB command and variable. It will be evaluated as "
548549 " a variable. To evaluate the expression as an LLDB command, use '"
549- << command_escape_prefix << " ' as a prefix.\n " ;
550+ << configuration. commandEscapePrefix << " ' as a prefix.\n " ;
550551 }
551552
552553 // Variables take preference to commands in auto, since commands can always
@@ -593,36 +594,38 @@ DAP::RunLaunchCommands(llvm::ArrayRef<std::string> launch_commands) {
593594}
594595
595596llvm::Error DAP::RunInitCommands () {
596- if (!RunLLDBCommands (" Running initCommands:" , init_commands ))
597+ if (!RunLLDBCommands (" Running initCommands:" , configuration. initCommands ))
597598 return createRunLLDBCommandsErrorMessage (" initCommands" );
598599 return llvm::Error::success ();
599600}
600601
601602llvm::Error DAP::RunPreInitCommands () {
602- if (!RunLLDBCommands (" Running preInitCommands:" , pre_init_commands))
603+ if (!RunLLDBCommands (" Running preInitCommands:" ,
604+ configuration.preInitCommands ))
603605 return createRunLLDBCommandsErrorMessage (" preInitCommands" );
604606 return llvm::Error::success ();
605607}
606608
607609llvm::Error DAP::RunPreRunCommands () {
608- if (!RunLLDBCommands (" Running preRunCommands:" , pre_run_commands ))
610+ if (!RunLLDBCommands (" Running preRunCommands:" , configuration. preRunCommands ))
609611 return createRunLLDBCommandsErrorMessage (" preRunCommands" );
610612 return llvm::Error::success ();
611613}
612614
613615void DAP::RunPostRunCommands () {
614- RunLLDBCommands (" Running postRunCommands:" , post_run_commands );
616+ RunLLDBCommands (" Running postRunCommands:" , configuration. postRunCommands );
615617}
616618void DAP::RunStopCommands () {
617- RunLLDBCommands (" Running stopCommands:" , stop_commands );
619+ RunLLDBCommands (" Running stopCommands:" , configuration. stopCommands );
618620}
619621
620622void DAP::RunExitCommands () {
621- RunLLDBCommands (" Running exitCommands:" , exit_commands );
623+ RunLLDBCommands (" Running exitCommands:" , configuration. exitCommands );
622624}
623625
624626void DAP::RunTerminateCommands () {
625- RunLLDBCommands (" Running terminateCommands:" , terminate_commands);
627+ RunLLDBCommands (" Running terminateCommands:" ,
628+ configuration.terminateCommands );
626629}
627630
628631lldb::SBTarget
0 commit comments