forked from qt-creator/qt-creator
Debugger: Fix "Run in Terminal" with lldb
Previously lldb never actually attached to the process running in the terminal, but started its own copy. Since the process is interrupted by the terminal stub already, code was added to automatically continue the process. "Start and break on main" and "Run in Terminal" also did not work together and are now fixed. Change-Id: Iaeb6e7dd0f511f3bf195ab5d0008856b310615d9 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -870,6 +870,7 @@ class Dumper(DumperBase):
|
||||
self.startMode_ = args.get('startmode', 1)
|
||||
self.breakOnMain_ = args.get('breakonmain', 0)
|
||||
self.useTerminal_ = args.get('useterminal', 0)
|
||||
self.firstStop_ = True
|
||||
pargs = self.hexdecode(args.get('processargs', ''))
|
||||
self.processArgs_ = pargs.split('\0') if len(pargs) else []
|
||||
self.environment_ = args.get('environment', [])
|
||||
@@ -930,6 +931,8 @@ class Dumper(DumperBase):
|
||||
|
||||
if self.startMode_ == DebuggerStartMode.AttachExternal:
|
||||
attach_info = lldb.SBAttachInfo(self.attachPid_)
|
||||
if self.breakOnMain_:
|
||||
self.createBreakpointAtMain()
|
||||
self.process = self.target.Attach(attach_info, error)
|
||||
if not error.Success():
|
||||
self.reportState('enginerunfailed')
|
||||
@@ -1474,6 +1477,12 @@ class Dumper(DumperBase):
|
||||
self.reportState("inferiorstopok")
|
||||
else:
|
||||
self.reportState("stopped")
|
||||
if self.firstStop_:
|
||||
self.firstStop_ = False
|
||||
if self.useTerminal_:
|
||||
# When using a terminal, the process will be interrupted on startup.
|
||||
# We therefore need to continue it here.
|
||||
self.process.Continue()
|
||||
else:
|
||||
self.reportState(self.stateName(state))
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# Debugger start modes. Keep in sync with DebuggerStartMode in debuggerconstants.h
|
||||
|
||||
|
||||
# MT: Why does this not match (anymore?) to debuggerconstants.h : DebuggerStartMode ?
|
||||
class DebuggerStartMode():
|
||||
(
|
||||
NoStartMode,
|
||||
|
||||
@@ -279,8 +279,8 @@ void LldbEngine::handleLldbStarted()
|
||||
? QString::fromLatin1("Attaching to %1 (%2)").arg(attachedPID).arg(attachedMainThreadID)
|
||||
: QString::fromLatin1("Attaching to %1").arg(attachedPID);
|
||||
showMessage(msg, LogMisc);
|
||||
cmd2.arg("startmode", DebuggerStartMode::AttachToLocalProcess);
|
||||
cmd2.arg("attachpid", attachedPID);
|
||||
|
||||
} else {
|
||||
cmd2.arg("startmode", rp.startMode);
|
||||
// it is better not to check the start mode on the python sid (as we would have to duplicate the
|
||||
|
||||
Reference in New Issue
Block a user