From 29f5ccde380afe683fd02ea426487aacd2d6bf05 Mon Sep 17 00:00:00 2001 From: Andrey Bezborodov Date: Wed, 18 Dec 2024 15:05:05 +0300 Subject: [PATCH] * Fix for review --- LiteEditor/manager.cpp | 24 +++++++---------- Plugin/FileSystemWorkspace/FSConfigPage.cpp | 10 +++---- .../clFileSystemWorkspace.cpp | 27 +++++++++---------- 3 files changed, 27 insertions(+), 34 deletions(-) diff --git a/LiteEditor/manager.cpp b/LiteEditor/manager.cpp index 4cbd3f43e3..5dbfeffd5f 100644 --- a/LiteEditor/manager.cpp +++ b/LiteEditor/manager.cpp @@ -2071,22 +2071,18 @@ void Manager::DbgStart(long attachPid) DebugMessage(_("Debug session started successfully!\n")); if (dbgr->GetIsRemoteDebugging()) { - // debugging remote target - wxString comm; - wxString port = bldConf->GetDbgHostPort(); - wxString host = bldConf->GetDbgHostName(); - - comm << host; + wxString remote_address; + wxString port = bldConf->GetDbgHostPort().Trim(false).Trim(); + wxString host = bldConf->GetDbgHostName().Trim(false).Trim(); - host = host.Trim().Trim(false); - port = port.Trim().Trim(false); + remote_address << host; - if (port.IsEmpty() == false) { - comm << wxT(":") << port; + if (!port.IsEmpty()) { + remote_address << wxT(":") << port; } - dbgr->Run(args, comm); + dbgr->Run(args, remote_address); } else if (attachPid == wxNOT_FOUND) { @@ -2502,7 +2498,7 @@ void Manager::UpdateAsciiViewer(const wxString& expression, const wxString& tip) void Manager::UpdateRemoteTargetConnected(const wxString& line) { IDebugger* dbgr = DebuggerMgr::Get().GetActiveDebugger(); - + if (dbgr && dbgr->IsRunning()) { wxString commands; // An old behavior for legacy workspace @@ -2514,12 +2510,12 @@ void Manager::UpdateRemoteTargetConnected(const wxString& line) if (bldConf) { commands = bldConf->GetDebuggerPostRemoteConnectCmds(); } - + // Filesystem workspace and so on } else if (!dbgr->GetPostRemoteConnectCommands().empty()) { commands = dbgr->GetPostRemoteConnectCommands(); } - + // - Execute commands wxArrayString dbg_cmds = wxStringTokenize(commands, wxT("\n"), wxTOKEN_STRTOK); for (size_t i = 0; i < dbg_cmds.GetCount(); i++) { diff --git a/Plugin/FileSystemWorkspace/FSConfigPage.cpp b/Plugin/FileSystemWorkspace/FSConfigPage.cpp index e567b80f8e..44fbc78c2b 100644 --- a/Plugin/FileSystemWorkspace/FSConfigPage.cpp +++ b/Plugin/FileSystemWorkspace/FSConfigPage.cpp @@ -80,10 +80,10 @@ FSConfigPage::FSConfigPage(wxWindow* parent, clFileSystemWorkspaceConfig::Ptr_t m_textCtrlExcludeFiles->ChangeValue(config->GetExcludeFilesPattern()); m_textCtrlExcludePaths->ChangeValue(config->GetExecludePaths()); m_textCtrlWD->ChangeValue(config->GetWorkingDirectory()); - + m_textCtrlDebugger->ChangeValue(config->GetDebuggerPath()); m_stcCommands->SetText(config->GetDebuggerCommands()); - + m_checkRemoteEnabled->SetValue(config->GetDebuggerRemoteEnabled()); m_checkRemoteExtended->SetValue(config->GetDebuggerRemoteExtended()); m_textRemoteTargetHost->SetValue(config->GetDebuggerRemoteHost()); @@ -164,7 +164,7 @@ void FSConfigPage::Save() last_executables.swap(small_arr); } - m_config->SetExecutable(m_comboBoxExecutable->GetValue()); //->GetStringSelection()); + m_config->SetExecutable(m_comboBoxExecutable->GetValue()); m_config->SetLastExecutables(last_executables); m_config->SetEnvironment(m_stcEnv->GetText()); m_config->SetArgs(m_textCtrlArgs->GetValue()); @@ -177,10 +177,10 @@ void FSConfigPage::Save() m_config->SetExcludeFilesPattern(m_textCtrlExcludeFiles->GetValue()); m_config->SetExcludePaths(m_textCtrlExcludePaths->GetValue()); m_config->SetWorkingDirectory(m_textCtrlWD->GetValue()); - + m_config->SetDebuggerPath(m_textCtrlDebugger->GetValue()); m_config->SetDebuggerCommands(m_stcCommands->GetText()); - + m_config->SetDebuggerRemoteEnabled(m_checkRemoteEnabled->IsChecked()); m_config->SetDebuggerRemoteExtended(m_checkRemoteExtended->IsChecked()); m_config->SetDebuggerRemoteHost(m_textRemoteTargetHost->GetValue()); diff --git a/Plugin/FileSystemWorkspace/clFileSystemWorkspace.cpp b/Plugin/FileSystemWorkspace/clFileSystemWorkspace.cpp index 0b1036a3bf..5b691b7fa1 100644 --- a/Plugin/FileSystemWorkspace/clFileSystemWorkspace.cpp +++ b/Plugin/FileSystemWorkspace/clFileSystemWorkspace.cpp @@ -940,7 +940,7 @@ void clFileSystemWorkspace::OnDebug(clDebugEvent& event) dinfo.breakAtWinMain = false; dinfo.consoleCommand = EditorConfigST::Get()->GetOptions()->GetProgramConsoleCommand(); dbgr->SetDebuggerInformation(dinfo); - + // Setup remote debugging if (GetConfig()->GetDebuggerRemoteEnabled()) { dbgr->SetIsRemoteDebugging(GetConfig()->GetDebuggerRemoteEnabled()); @@ -960,7 +960,7 @@ void clFileSystemWorkspace::OnDebug(clDebugEvent& event) session_info.exeName = exe; session_info.cwd = wd; session_info.init_file_content = GetConfig()->GetDebuggerCommands(); - + clGetManager()->GetBreakpoints(bpList); session_info.bpList = bpList; @@ -1005,29 +1005,26 @@ void clFileSystemWorkspace::OnDebug(clDebugEvent& event) clDebugEvent eventStarted(wxEVT_DEBUG_STARTED); eventStarted.SetClientData(&session_info); EventNotifier::Get()->ProcessEvent(eventStarted); - + if (dbgr->GetIsRemoteDebugging()) { // debugging remote target - wxString comm; - wxString host = GetConfig()->GetDebuggerRemoteHost(); - wxString port = GetConfig()->GetDebuggerRemotePort(); - - comm << host; + wxString remote_address; + wxString host = GetConfig()->GetDebuggerRemoteHost().Trim(false).Trim(); + wxString port = GetConfig()->GetDebuggerRemotePort().Trim(false).Trim(); - host = host.Trim().Trim(false); - port = port.Trim().Trim(false); + remote_address << host; - if (port.IsEmpty() == false) { - comm << wxT(":") << port; + if (!port.IsEmpty()) { + remote_address << wxT(":") << port; } - + // Now run the debuggee (remote) - dbgr->Run(args, comm); + dbgr->Run(args, remote_address); } else { // Now run the debuggee (local) dbgr->Run(args, ""); - + } }