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
6959a122
Commit
6959a122
authored
Jun 30, 2010
by
hjk
Browse files
debugger: fix 'run to line' with older versions of gdb
parent
ebba2748
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/gdb/gdbengine.cpp
View file @
6959a122
...
...
@@ -972,15 +972,12 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
||
response
->
resultClass
==
((
cmd
.
flags
&
RunRequest
)
?
GdbResultRunning
:
(
cmd
.
flags
&
ExitRequest
)
?
GdbResultExit
:
GdbResultDone
)
// Happens with some incarnations of gdb 6.8:
// Happens with some incarnations of gdb 6.8 for "run to line"
||
(
response
->
resultClass
==
GdbResultDone
&&
cmd
.
command
==
"continue"
)
// Happens with some incarnations of gdb 6.8 for "jump to line"
||
(
response
->
resultClass
==
GdbResultDone
&&
cmd
.
command
.
startsWith
(
"jump"
));
if
(
isExpectedResult
)
{
if
(
cmd
.
callback
)
(
this
->*
cmd
.
callback
)(
*
response
);
else
if
(
cmd
.
adapterCallback
)
(
m_gdbAdapter
->*
cmd
.
adapterCallback
)(
*
response
);
}
else
{
if
(
!
isExpectedResult
)
{
#ifdef Q_OS_WIN
// Ignore spurious 'running' responses to 'attach'
const
bool
warning
=
!
(
startParameters
().
startMode
==
AttachExternal
...
...
@@ -996,6 +993,11 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
}
}
if
(
cmd
.
callback
)
(
this
->*
cmd
.
callback
)(
*
response
);
else
if
(
cmd
.
adapterCallback
)
(
m_gdbAdapter
->*
cmd
.
adapterCallback
)(
*
response
);
if
(
cmd
.
flags
&
RebuildWatchModel
)
{
--
m_pendingWatchRequests
;
PENDING_DEBUG
(
" WATCH"
<<
cmd
.
command
<<
"=>"
<<
cmd
.
callbackName
...
...
@@ -1103,21 +1105,41 @@ void GdbEngine::handleExecuteJumpToLine(const GdbResponse &response)
}
}
//void GdbEngine::handleExecRunToFunction(const GdbResponse &response)
//{
// // FIXME: remove this special case as soon as there's a real
// // reason given when the temporary breakpoint is hit.
// // reight now we get:
// // 14*stopped,thread-id="1",frame={addr="0x0000000000403ce4",
// // func="foo",args=[{name="str",value="@0x7fff0f450460"}],
// // file="main.cpp",fullname="/tmp/g/main.cpp",line="37"}
// QTC_ASSERT(state() == InferiorStopping, qDebug() << state())
// setState(InferiorStopped);
// showStatusMessage(tr("Function reached. Stopped"));
// GdbMi frame = response.data.findChild("frame");
// StackFrame f = parseStackFrame(frame, 0);
// gotoLocation(f, true);
//}
void
GdbEngine
::
handleExecuteRunToLine
(
const
GdbResponse
&
response
)
{
if
(
response
.
resultClass
==
GdbResultRunning
)
{
// All is fine. Waiting for the temporary breakpoint to be hit.
}
else
if
(
response
.
resultClass
==
GdbResultDone
)
{
// This happens on old gdb. Trigger the effect of a '*stopped'.
// >&"continue\n"
// >~"Continuing.\n"
//>~"testArray () at ../simple/app.cpp:241\n"
//>~"241\t s[1] = \"b\";\n"
//>122^done
gotoLocation
(
m_targetFrame
,
true
);
showStatusMessage
(
tr
(
"Target line hit. Stopped"
));
setState
(
InferiorStopped
);
handleStop1
(
response
);
}
}
/*
void GdbEngine::handleExecuteRunToFunction(const GdbResponse &response)
{
// FIXME: remove this special case as soon as there's a real
// reason given when the temporary breakpoint is hit.
// reight now we get:
// 14*stopped,thread-id="1",frame={addr="0x0000000000403ce4",
// func="foo",args=[{name="str",value="@0x7fff0f450460"}],
// file="main.cpp",fullname="/tmp/g/main.cpp",line="37"}
QTC_ASSERT(state() == InferiorStopping, qDebug() << state())
setState(InferiorStopped);
showStatusMessage(tr("Function reached. Stopped"));
GdbMi frame = response.data.findChild("frame");
StackFrame f = parseStackFrame(frame, 0);
gotoLocation(f, true);
}
*/
static
bool
isExitedReason
(
const
QByteArray
&
reason
)
{
...
...
@@ -1943,10 +1965,12 @@ void GdbEngine::executeRunToLine(const QString &fileName, int lineNumber)
setState
(
InferiorRunningRequested
);
showStatusMessage
(
tr
(
"Run to line %1 requested..."
).
arg
(
lineNumber
),
5000
);
#if 1
m_targetFrame
.
file
=
fileName
;
m_targetFrame
.
line
=
lineNumber
;
QByteArray
loc
=
'"'
+
breakLocation
(
fileName
).
toLocal8Bit
()
+
'"'
+
':'
+
QByteArray
::
number
(
lineNumber
);
postCommand
(
"tbreak "
+
loc
);
postCommand
(
"continue"
,
RunRequest
);
postCommand
(
"continue"
,
RunRequest
,
CB
(
handleExecuteRunToLine
)
);
#else
// Seems to jump to unpredicatable places. Observed in the manual
// tests in the Foo::Foo() constructor with both gdb 6.8 and 7.1.
...
...
@@ -1963,7 +1987,7 @@ void GdbEngine::executeRunToFunction(const QString &functionName)
postCommand
(
"-break-insert -t "
+
functionName
.
toLatin1
());
continueInferiorInternal
();
//setState(InferiorRunningRequested);
//postCommand("-exec-continue", handleExecRunToFunction);
//postCommand("-exec-continue", handleExec
ute
RunToFunction);
showStatusMessage
(
tr
(
"Run to function %1 requested..."
).
arg
(
functionName
),
5000
);
}
...
...
@@ -1989,7 +2013,7 @@ void GdbEngine::executeJumpToLine(const QString &fileName, int lineNumber)
//setBreakpoint();
//postCommand("jump " + loc);
#else
gotoLocation
(
frame
,
true
);
gotoLocation
(
frame
,
true
);
setBreakpoint
(
fileName
,
lineNumber
);
setState
(
InferiorRunningRequested
);
postCommand
(
"jump "
+
loc
,
RunRequest
);
...
...
src/plugins/debugger/gdb/gdbengine.h
View file @
6959a122
...
...
@@ -31,8 +31,10 @@
#define DEBUGGER_GDBENGINE_H
#include "debuggerengine.h"
#include "gdbmi.h"
#include "localgdbprocess.h"
#include "stackframe.h"
#include "watchutils.h"
#include <QtCore/QByteArray>
...
...
@@ -303,7 +305,6 @@ private: ////////// Inferior Management //////////
virtual
void
executeRunToLine
(
const
QString
&
fileName
,
int
lineNumber
);
virtual
void
executeRunToFunction
(
const
QString
&
functionName
);
// void handleExecRunToFunction(const GdbResponse &response);
virtual
void
executeJumpToLine
(
const
QString
&
fileName
,
int
lineNumber
);
virtual
void
executeReturn
();
...
...
@@ -312,6 +313,8 @@ private: ////////// Inferior Management //////////
void
handleExecuteNext
(
const
GdbResponse
&
response
);
void
handleExecuteReturn
(
const
GdbResponse
&
response
);
void
handleExecuteJumpToLine
(
const
GdbResponse
&
response
);
void
handleExecuteRunToLine
(
const
GdbResponse
&
response
);
//void handleExecuteRunToFunction(const GdbResponse &response);
void
maybeHandleInferiorPidChanged
(
const
QString
&
pid
);
void
handleInfoProc
(
const
GdbResponse
&
response
);
...
...
@@ -522,6 +525,9 @@ private: ////////// View & Data Stuff //////////
static
QString
m_toolTipExpression
;
static
QPoint
m_toolTipPos
;
static
QByteArray
tooltipIName
();
// HACK:
StackFrame
m_targetFrame
;
};
}
// namespace Internal
...
...
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