@@ -69,20 +69,20 @@ const char DEV_NULL[] = "/dev/null";
69
69
70
70
namespace lldb_dap {
71
71
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,
73
75
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 ),
81
79
restarting_process_id(LLDB_INVALID_PROCESS_ID),
82
80
configuration_done_sent(false ), waiting_for_run_in_terminal(false ),
83
81
progress_event_reporter(
84
82
[&](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
+ }
86
86
87
87
DAP::~DAP () = default ;
88
88
@@ -505,8 +505,9 @@ ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression,
505
505
bool partial_expression) {
506
506
// Check for the escape hatch prefix.
507
507
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 ());
510
511
return ReplMode::Command;
511
512
}
512
513
@@ -546,7 +547,7 @@ ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression,
546
547
<< " Warning: Expression '" << term
547
548
<< " ' is both an LLDB command and variable. It will be evaluated as "
548
549
" 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 " ;
550
551
}
551
552
552
553
// Variables take preference to commands in auto, since commands can always
@@ -593,36 +594,38 @@ DAP::RunLaunchCommands(llvm::ArrayRef<std::string> launch_commands) {
593
594
}
594
595
595
596
llvm::Error DAP::RunInitCommands () {
596
- if (!RunLLDBCommands (" Running initCommands:" , init_commands ))
597
+ if (!RunLLDBCommands (" Running initCommands:" , configuration. initCommands ))
597
598
return createRunLLDBCommandsErrorMessage (" initCommands" );
598
599
return llvm::Error::success ();
599
600
}
600
601
601
602
llvm::Error DAP::RunPreInitCommands () {
602
- if (!RunLLDBCommands (" Running preInitCommands:" , pre_init_commands))
603
+ if (!RunLLDBCommands (" Running preInitCommands:" ,
604
+ configuration.preInitCommands ))
603
605
return createRunLLDBCommandsErrorMessage (" preInitCommands" );
604
606
return llvm::Error::success ();
605
607
}
606
608
607
609
llvm::Error DAP::RunPreRunCommands () {
608
- if (!RunLLDBCommands (" Running preRunCommands:" , pre_run_commands ))
610
+ if (!RunLLDBCommands (" Running preRunCommands:" , configuration. preRunCommands ))
609
611
return createRunLLDBCommandsErrorMessage (" preRunCommands" );
610
612
return llvm::Error::success ();
611
613
}
612
614
613
615
void DAP::RunPostRunCommands () {
614
- RunLLDBCommands (" Running postRunCommands:" , post_run_commands );
616
+ RunLLDBCommands (" Running postRunCommands:" , configuration. postRunCommands );
615
617
}
616
618
void DAP::RunStopCommands () {
617
- RunLLDBCommands (" Running stopCommands:" , stop_commands );
619
+ RunLLDBCommands (" Running stopCommands:" , configuration. stopCommands );
618
620
}
619
621
620
622
void DAP::RunExitCommands () {
621
- RunLLDBCommands (" Running exitCommands:" , exit_commands );
623
+ RunLLDBCommands (" Running exitCommands:" , configuration. exitCommands );
622
624
}
623
625
624
626
void DAP::RunTerminateCommands () {
625
- RunLLDBCommands (" Running terminateCommands:" , terminate_commands);
627
+ RunLLDBCommands (" Running terminateCommands:" ,
628
+ configuration.terminateCommands );
626
629
}
627
630
628
631
lldb::SBTarget
0 commit comments