Skip to content

Commit 4f40cf1

Browse files
authored
Better prompt message for launching a target during remote debugging (#844)
1 parent 8ffdb19 commit 4f40cf1

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

ui/controlswidget.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ void DebugControlsWidget::performLaunch()
180180
{
181181
isLocalLaunch = false;
182182
}
183+
184+
// Also consider debug server connections as remote
185+
if (m_controller->IsConnectedToDebugServer())
186+
{
187+
isLocalLaunch = false;
188+
}
183189

184190
if (isLocalLaunch && firstLaunch && Settings::Instance()->Get<bool>("debugger.confirmFirstLaunch"))
185191
{
@@ -188,6 +194,16 @@ void DebugControlsWidget::performLaunch()
188194
if (QMessageBox::question(this, "Launch Target", prompt) != QMessageBox::Yes)
189195
return;
190196
}
197+
else if (!isLocalLaunch && firstLaunch && Settings::Instance()->Get<bool>("debugger.confirmFirstLaunch"))
198+
{
199+
auto remoteHost = QString::fromStdString(m_controller->GetRemoteHost());
200+
auto remotePort = m_controller->GetRemotePort();
201+
auto prompt = QString("You are about to launch \n\n%1\n\non remote host %2:%3. "
202+
"Are you sure to continue?").arg(QString::fromStdString(m_controller->GetExecutablePath()))
203+
.arg(remoteHost).arg(remotePort);
204+
if (QMessageBox::question(this, "Launch Target", prompt) != QMessageBox::Yes)
205+
return;
206+
}
191207

192208
auto data = m_controller->GetData();
193209
if (!data->GetDefaultPlatform())

ui/ui.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,12 @@ void GlobalDebuggerUI::SetupMenu(UIContext* context)
476476
{
477477
isLocalLaunch = false;
478478
}
479+
480+
// Also consider debug server connections as remote
481+
if (controller->IsConnectedToDebugServer())
482+
{
483+
isLocalLaunch = false;
484+
}
479485

480486
if (isLocalLaunch && firstLaunch && Settings::Instance()->Get<bool>("debugger.confirmFirstLaunch"))
481487
{
@@ -485,6 +491,16 @@ void GlobalDebuggerUI::SetupMenu(UIContext* context)
485491
if (QMessageBox::question(context->mainWindow(), "Launch Target", prompt) != QMessageBox::Yes)
486492
return;
487493
}
494+
else if (!isLocalLaunch && firstLaunch && Settings::Instance()->Get<bool>("debugger.confirmFirstLaunch"))
495+
{
496+
auto remoteHost = QString::fromStdString(controller->GetRemoteHost());
497+
auto remotePort = controller->GetRemotePort();
498+
auto prompt = QString("You are about to launch \n\n%1\n\non remote host %2:%3. "
499+
"Are you sure to continue?").arg(QString::fromStdString(controller->GetExecutablePath()))
500+
.arg(remoteHost).arg(remotePort);
501+
if (QMessageBox::question(context->mainWindow(), "Launch Target", prompt) != QMessageBox::Yes)
502+
return;
503+
}
488504

489505
if (!ensureBinaryViewHasPlatform(controller->GetData(), context->mainWindow()))
490506
return;

0 commit comments

Comments
 (0)