@@ -122,7 +122,7 @@ static std::string capitalize(llvm::StringRef str) {
122122
123123llvm::StringRef DAP::debug_adapter_path = " " ;
124124
125- DAP::DAP (Log * log, const ReplMode default_repl_mode,
125+ DAP::DAP (Log & log, const ReplMode default_repl_mode,
126126 std::vector<std::string> pre_init_commands, bool no_lldbinit,
127127 llvm::StringRef client_name, DAPTransport &transport, MainLoop &loop)
128128 : log(log), transport(transport), broadcaster(" lldb-dap" ),
@@ -134,8 +134,6 @@ DAP::DAP(Log *log, const ReplMode default_repl_mode,
134134 RegisterRequests ();
135135}
136136
137- DAP::~DAP () = default ;
138-
139137void DAP::PopulateExceptionBreakpoints () {
140138 if (lldb::SBDebugger::SupportsLanguage (lldb::eLanguageTypeC_plus_plus)) {
141139 exception_breakpoints.emplace_back (*this , " cpp_catch" , " C++ Catch" ,
@@ -263,8 +261,7 @@ void DAP::SendJSON(const llvm::json::Value &json) {
263261 Message message;
264262 llvm::json::Path::Root root;
265263 if (!fromJSON (json, message, root)) {
266- DAP_LOG_ERROR (log, root.getError (), " ({1}) encoding failed: {0}" ,
267- m_client_name);
264+ DAP_LOG_ERROR (log, root.getError (), " encoding failed: {0}" );
268265 return ;
269266 }
270267 Send (message);
@@ -285,15 +282,13 @@ Id DAP::Send(const Message &message) {
285282
286283 if (const protocol::Event *event = std::get_if<protocol::Event>(&msg)) {
287284 if (llvm::Error err = transport.Send (*event))
288- DAP_LOG_ERROR (log, std::move (err), " ({0}) sending event failed" ,
289- m_client_name);
285+ DAP_LOG_ERROR (log, std::move (err), " sending event failed: {0}" );
290286 return event->seq ;
291287 }
292288
293289 if (const Request *req = std::get_if<Request>(&msg)) {
294290 if (llvm::Error err = transport.Send (*req))
295- DAP_LOG_ERROR (log, std::move (err), " ({0}) sending request failed" ,
296- m_client_name);
291+ DAP_LOG_ERROR (log, std::move (err), " sending request failed: {0}" );
297292 return req->seq ;
298293 }
299294
@@ -313,8 +308,7 @@ Id DAP::Send(const Message &message) {
313308 })
314309 : transport.Send (*resp);
315310 if (err)
316- DAP_LOG_ERROR (log, std::move (err), " ({0}) sending response failed" ,
317- m_client_name);
311+ DAP_LOG_ERROR (log, std::move (err), " sending response failed: {0}" );
318312 return resp->seq ;
319313 }
320314
@@ -857,8 +851,7 @@ bool DAP::HandleObject(const Message &M) {
857851
858852 dispatcher.Set (" error" ,
859853 llvm::Twine (" unhandled-command:" + req->command ).str ());
860- DAP_LOG (log, " ({0}) error: unhandled command '{1}'" , m_client_name,
861- req->command );
854+ DAP_LOG (log, " error: unhandled command '{0}'" , req->command );
862855 return false ; // Fail
863856 }
864857
@@ -1004,35 +997,33 @@ void DAP::Received(const protocol::Request &request) {
1004997 // effort attempt to interrupt.
1005998 std::lock_guard<std::mutex> guard (m_active_request_mutex);
1006999 if (m_active_request && cancel_args->requestId == m_active_request->seq ) {
1007- DAP_LOG (log, " ({0}) interrupting inflight request (command={1 } seq={2 })" ,
1008- m_client_name, m_active_request->command , m_active_request->seq );
1000+ DAP_LOG (log, " interrupting inflight request (command={0 } seq={1 })" ,
1001+ m_active_request->command , m_active_request->seq );
10091002 debugger.RequestInterrupt ();
10101003 }
10111004 }
10121005
10131006 std::lock_guard<std::mutex> guard (m_queue_mutex);
1014- DAP_LOG (log, " ({0}) queued (command={1} seq={2})" , m_client_name,
1015- request.command , request.seq );
1007+ DAP_LOG (log, " queued (command={0} seq={1})" , request.command , request.seq );
10161008 m_queue.push_back (request);
10171009 m_queue_cv.notify_one ();
10181010}
10191011
10201012void DAP::Received (const protocol::Response &response) {
10211013 std::lock_guard<std::mutex> guard (m_queue_mutex);
1022- DAP_LOG (log, " ({0}) queued (command={1 } seq={2 })" , m_client_name ,
1023- response.command , response. request_seq );
1014+ DAP_LOG (log, " queued (command={0 } seq={1 })" , response. command ,
1015+ response.request_seq );
10241016 m_queue.push_back (response);
10251017 m_queue_cv.notify_one ();
10261018}
10271019
10281020void DAP::OnError (llvm::Error error) {
1029- DAP_LOG_ERROR (log, std::move (error), " ({1}) received error: {0}" ,
1030- m_client_name);
1021+ DAP_LOG_ERROR (log, std::move (error), " transport error: {0}" );
10311022 TerminateLoop (/* failed=*/ true );
10321023}
10331024
10341025void DAP::OnClosed () {
1035- DAP_LOG (log, " ({0}) received EOF " , m_client_name );
1026+ DAP_LOG (log, " transport closed " );
10361027 TerminateLoop ();
10371028}
10381029
@@ -1058,16 +1049,14 @@ void DAP::TransportHandler() {
10581049 auto handle = transport.RegisterMessageHandler (m_loop, *this );
10591050 if (!handle) {
10601051 DAP_LOG_ERROR (log, handle.takeError (),
1061- " ({1}) registering message handler failed: {0}" ,
1062- m_client_name);
1052+ " registering message handler failed: {0}" );
10631053 std::lock_guard<std::mutex> guard (m_queue_mutex);
10641054 m_error_occurred = true ;
10651055 return ;
10661056 }
10671057
10681058 if (Status status = m_loop.Run (); status.Fail ()) {
1069- DAP_LOG_ERROR (log, status.takeError (), " ({1}) MainLoop run failed: {0}" ,
1070- m_client_name);
1059+ DAP_LOG_ERROR (log, status.takeError (), " MainLoop run failed: {0}" );
10711060 std::lock_guard<std::mutex> guard (m_queue_mutex);
10721061 m_error_occurred = true ;
10731062 return ;
0 commit comments