Skip to content

Commit

Permalink
* Fix for review
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Bezborodov committed Dec 18, 2024
1 parent 7de16ee commit 29f5ccd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 34 deletions.
24 changes: 10 additions & 14 deletions LiteEditor/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -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
Expand All @@ -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++) {
Expand Down
10 changes: 5 additions & 5 deletions Plugin/FileSystemWorkspace/FSConfigPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down
27 changes: 12 additions & 15 deletions Plugin/FileSystemWorkspace/clFileSystemWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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;

Expand Down Expand Up @@ -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, "");

}
}

Expand Down

0 comments on commit 29f5ccd

Please sign in to comment.