Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
6a988657
Commit
6a988657
authored
Sep 11, 2009
by
hjk
Browse files
debugger: small refactoring in the gdbengine startup
parent
c9da1d95
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggerrunner.cpp
View file @
6a988657
...
...
@@ -179,7 +179,6 @@ void DebuggerRunControl::start()
m_manager
->
setQtDumperLibraryName
(
m_dumperLibrary
);
m_manager
->
setQtDumperLibraryLocations
(
m_dumperLibraryLocations
);
m_manager
->
startNewDebugger
(
this
,
m_startParameters
);
emit
started
();
}
void
DebuggerRunControl
::
slotAddToOutputWindowInline
(
const
QString
&
data
)
...
...
src/plugins/debugger/gdb/gdbengine.cpp
View file @
6a988657
...
...
@@ -269,6 +269,7 @@ void GdbEngine::gdbProcError(QProcess::ProcessError error)
"invoked program '%1' is missing, or you may have insufficient "
"permissions to invoke the program."
)
.
arg
(
theDebuggerStringSetting
(
GdbLocation
));
emitStartFailed
();
break
;
case
QProcess
::
Crashed
:
kill
=
false
;
...
...
@@ -746,10 +747,8 @@ void GdbEngine::flushCommand(GdbCommand &cmd)
if
(
cmd
.
flags
&
EmbedToken
)
cmd
.
command
=
cmd
.
command
.
arg
(
currentToken
());
m_gdbProc
->
write
(
cmd
.
command
.
toLatin1
()
+
"
\r\n
"
);
//emit gdbInputAvailable(QString(), " " + currentTime());
//emit gdbInputAvailable(QString(), "[" + currentTime() + "] " + cmd.command);
emit
gdbInputAvailable
(
LogInput
,
cmd
.
command
);
executeDebuggerCommand
(
cmd
.
command
);
}
void
GdbEngine
::
handleResultRecord
(
const
GdbResultRecord
&
record
)
...
...
@@ -833,12 +832,12 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
void
GdbEngine
::
executeDebuggerCommand
(
const
QString
&
command
)
{
if
(
m_gdbProc
->
state
()
=
=
QProcess
::
Not
Running
)
{
debugMessage
(
_
(
"
NO
GDB PROCESS RUNNING, PLAIN CMD IGNORED: "
)
+
command
);
if
(
m_gdbProc
->
state
()
!
=
QProcess
::
Running
)
{
debugMessage
(
_
(
"GDB PROCESS
NOT
RUNNING, PLAIN CMD IGNORED: "
)
+
command
);
return
;
}
m_gdbProc
->
write
(
command
.
toL
ocal8Bit
()
+
"
\r\n
"
);
m_gdbProc
->
write
(
command
.
toL
atin1
()
+
"
\r\n
"
);
}
void
GdbEngine
::
handleTargetCore
(
const
GdbResultRecord
&
,
const
QVariant
&
)
...
...
@@ -1496,7 +1495,7 @@ void GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
if
(
m_gdbProc
->
state
()
!=
QProcess
::
NotRunning
)
{
debugMessage
(
_
(
"GDB IS ALREADY RUNNING, STATE: %1"
).
arg
(
m_gdbProc
->
state
()));
m_gdbProc
->
kill
();
emit
s
tartFailed
();
emit
S
tartFailed
();
return
;
}
...
...
@@ -1527,7 +1526,7 @@ void GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
if
(
!
m_stubProc
.
start
(
m_startParameters
.
executable
,
m_startParameters
.
processArgs
))
{
// Error message for user is delivered via a signal.
emit
s
tartFailed
();
emit
S
tartFailed
();
return
;
}
}
else
{
...
...
@@ -1535,7 +1534,7 @@ void GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
QMessageBox
::
critical
(
q
->
mainWindow
(),
tr
(
"Debugger Startup Failure"
),
tr
(
"Cannot set up communication with child process: %1"
)
.
arg
(
m_outputCollector
.
errorString
()));
emit
s
tartFailed
();
emit
S
tartFailed
();
return
;
}
gdbArgs
.
prepend
(
_
(
"--tty="
)
+
m_outputCollector
.
serverName
());
...
...
@@ -1561,23 +1560,20 @@ void GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
m_gdbProc
->
start
(
loc
,
gdbArgs
);
}
void
GdbEngine
::
emitStartFailed
()
{
// QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"),
// tr("Cannot start debugger: %1").arg(m_gdbProc->errorString()));
m_outputCollector
.
shutdown
();
m_stubProc
.
blockSignals
(
true
);
m_stubProc
.
stop
();
m_stubProc
.
blockSignals
(
false
);
emit
startFailed
();
}
void
GdbEngine
::
startDebugger2
()
{
qDebug
()
<<
"STARTUP, PHASE 2"
;
debugMessage
(
_
(
"STARTUP, PHASE 2"
));
#if 0
if (!m_gdbProc->waitForStarted()) {
QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"),
tr("Cannot start debugger: %1").arg(m_gdbProc->errorString()));
m_outputCollector.shutdown();
m_stubProc.blockSignals(true);
m_stubProc.stop();
m_stubProc.blockSignals(false);
emit startFailed();
return;
}
#endif
q
->
showStatusMessage
(
tr
(
"Gdb Running..."
));
postCommand
(
_
(
"show version"
),
CB
(
handleShowVersion
));
...
...
@@ -2027,7 +2023,8 @@ void GdbEngine::sendInsertBreakpoint(int index)
}
// The argument is simply a C-quoted version of the argument to the
// non-MI "break" command, including the "original" quoting it wants.
where
=
_
(
"
\"\\\"
"
)
+
GdbMi
::
escapeCString
(
where
)
+
_
(
"
\\\"
:"
)
+
data
->
lineNumber
+
_c
(
'"'
);
where
=
_
(
"
\"\\\"
%1
\\\"
:%2
\"
"
)
.
arg
(
GdbMi
::
escapeCString
(
where
)).
arg
(
data
->
lineNumber
);
}
else
{
where
=
data
->
funcName
;
}
...
...
src/plugins/debugger/gdb/gdbengine.h
View file @
6a988657
...
...
@@ -250,6 +250,7 @@ private slots:
void
stubStarted
();
void
stubError
(
const
QString
&
msg
);
void
uploadProcError
(
QProcess
::
ProcessError
error
);
void
emitStartFailed
();
private:
int
terminationIndex
(
const
QByteArray
&
buffer
,
int
&
length
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment