Skip to content
GitLab
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
a638b933
Commit
a638b933
authored
Dec 01, 2010
by
hjk
Browse files
debugger: make '0' the 'invalid' BreakpointId value
parent
739144ce
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/breakhandler.cpp
View file @
a638b933
...
...
@@ -154,7 +154,7 @@ BreakpointId BreakHandler::findSimilarBreakpoint(const BreakpointResponse &needl
if
(
isSimilarTo
(
data
,
needle
))
return
id
;
}
return
BreakpointId
(
-
1
);
return
BreakpointId
();
}
BreakpointId
BreakHandler
::
findBreakpointByNumber
(
int
bpNumber
)
const
...
...
@@ -163,7 +163,7 @@ BreakpointId BreakHandler::findBreakpointByNumber(int bpNumber) const
for
(
;
it
!=
et
;
++
it
)
if
(
it
->
response
.
number
==
bpNumber
)
return
it
.
key
();
return
BreakpointId
(
-
1
);
return
BreakpointId
();
}
BreakpointId
BreakHandler
::
findBreakpointByFunction
(
const
QString
&
functionName
)
const
...
...
@@ -172,7 +172,7 @@ BreakpointId BreakHandler::findBreakpointByFunction(const QString &functionName)
for
(
;
it
!=
et
;
++
it
)
if
(
it
->
data
.
functionName
==
functionName
)
return
it
.
key
();
return
BreakpointId
(
-
1
);
return
BreakpointId
();
}
BreakpointId
BreakHandler
::
findBreakpointByAddress
(
quint64
address
)
const
...
...
@@ -181,7 +181,7 @@ BreakpointId BreakHandler::findBreakpointByAddress(quint64 address) const
for
(
;
it
!=
et
;
++
it
)
if
(
it
->
data
.
address
==
address
)
return
it
.
key
();
return
BreakpointId
(
-
1
);
return
BreakpointId
();
}
BreakpointId
BreakHandler
::
findBreakpointByFileAndLine
(
const
QString
&
fileName
,
...
...
@@ -191,7 +191,7 @@ BreakpointId BreakHandler::findBreakpointByFileAndLine(const QString &fileName,
for
(
;
it
!=
et
;
++
it
)
if
(
it
->
isLocatedAt
(
fileName
,
lineNumber
,
useMarkerPosition
))
return
it
.
key
();
return
BreakpointId
(
-
1
);
return
BreakpointId
();
}
const
BreakpointParameters
&
BreakHandler
::
breakpointData
(
BreakpointId
id
)
const
...
...
@@ -208,25 +208,25 @@ BreakpointId BreakHandler::findWatchpointByAddress(quint64 address) const
for
(
;
it
!=
et
;
++
it
)
if
(
it
->
data
.
isWatchpoint
()
&&
it
->
data
.
address
==
address
)
return
it
.
key
();
return
BreakpointId
(
-
1
);
return
BreakpointId
();
}
void
BreakHandler
::
setWatchpointByAddress
(
quint64
address
)
{
const
int
id
=
findWatchpointByAddress
(
address
);
if
(
id
==
-
1
)
{
BreakpointParameters
data
(
Watchpoint
);
data
.
address
=
address
;
appendBreakpoint
(
data
);
}
else
{
if
(
id
)
{
qDebug
()
<<
"WATCHPOINT EXISTS"
;
// removeBreakpoint(index);
// removeBreakpoint(index);
return
;
}
BreakpointParameters
data
(
Watchpoint
);
data
.
address
=
address
;
appendBreakpoint
(
data
);
}
bool
BreakHandler
::
hasWatchpointAt
(
quint64
address
)
const
{
return
findWatchpointByAddress
(
address
)
!=
BreakpointId
(
-
1
)
;
return
findWatchpointByAddress
(
address
);
}
void
BreakHandler
::
saveBreakpoints
()
...
...
@@ -354,7 +354,7 @@ BreakpointId BreakHandler::findBreakpointByIndex(const QModelIndex &index) const
for
(
int
i
=
0
;
it
!=
et
;
++
it
,
++
i
)
if
(
i
==
r
)
return
it
.
key
();
return
BreakpointId
(
-
1
);
return
BreakpointId
();
}
BreakpointIds
BreakHandler
::
findBreakpointsByIndex
(
const
QList
<
QModelIndex
>
&
list
)
const
...
...
src/plugins/debugger/cdb2/cdbengine2.cpp
View file @
a638b933
...
...
@@ -1316,7 +1316,7 @@ void CdbEngine::handleSessionIdle(const QByteArray &message)
if
(
reason
==
"breakpoint"
)
{
const
int
number
=
stopReason
.
findChild
(
"breakpointId"
).
data
().
toInt
();
const
BreakpointId
id
=
breakHandler
()
->
findBreakpointByNumber
(
number
);
if
(
id
!=
BreakpointId
(
-
1
)
&&
breakHandler
()
->
type
(
id
)
==
Debugger
::
Internal
::
Watchpoint
)
{
if
(
id
&&
breakHandler
()
->
type
(
id
)
==
Debugger
::
Internal
::
Watchpoint
)
{
showStatusMessage
(
msgWatchpointTriggered
(
id
,
number
,
breakHandler
()
->
address
(
id
),
QString
::
number
(
threadId
)));
}
else
{
showStatusMessage
(
msgBreakpointTriggered
(
id
,
number
,
QString
::
number
(
threadId
)));
...
...
src/plugins/debugger/debuggerengine.cpp
View file @
a638b933
...
...
@@ -1338,7 +1338,7 @@ bool DebuggerEngine::isDying() const
QString
DebuggerEngine
::
msgWatchpointTriggered
(
BreakpointId
id
,
const
int
number
,
quint64
address
)
{
return
id
!=
BreakpointId
(
-
1
)
return
id
?
tr
(
"Watchpoint %1 (%2) at 0x%3 triggered."
)
.
arg
(
id
).
arg
(
number
).
arg
(
address
,
0
,
16
)
:
tr
(
"Internal watchpoint %1 at 0x%2 triggered."
)
...
...
@@ -1348,7 +1348,7 @@ QString DebuggerEngine::msgWatchpointTriggered(BreakpointId id,
QString
DebuggerEngine
::
msgWatchpointTriggered
(
BreakpointId
id
,
const
int
number
,
quint64
address
,
const
QString
&
threadId
)
{
return
id
!=
BreakpointId
(
-
1
)
return
id
?
tr
(
"Watchpoint %1 (%2) at 0x%3 in thread %4 triggered."
)
.
arg
(
id
).
arg
(
number
).
arg
(
address
,
0
,
16
).
arg
(
threadId
)
:
tr
(
"Internal watchpoint %1 at 0x%2 in thread %3 triggered."
)
...
...
@@ -1358,7 +1358,7 @@ QString DebuggerEngine::msgWatchpointTriggered(BreakpointId id,
QString
DebuggerEngine
::
msgBreakpointTriggered
(
BreakpointId
id
,
const
int
number
,
const
QString
&
threadId
)
{
return
id
!=
BreakpointId
(
-
1
)
return
id
?
tr
(
"Stopped at breakpoint %1 (%2) in thread %3."
)
.
arg
(
id
).
arg
(
number
).
arg
(
threadId
)
:
tr
(
"Stopped at internal breakpoint %1 in thread %2."
)
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
a638b933
...
...
@@ -2391,7 +2391,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditor::ITextEditor *editor,
if
(
!
isDebuggable
(
editor
))
return
;
BreakpointId
id
=
-
1
;
BreakpointId
id
=
BreakpointId
()
;
QString
fileName
;
quint64
address
=
0
;
...
...
@@ -2415,7 +2415,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditor::ITextEditor *editor,
args
.
append
(
lineNumber
);
args
.
append
(
address
);
if
(
id
!=
BreakpointId
(
-
1
)
)
{
if
(
id
)
{
// Remove existing breakpoint.
QAction
*
act
=
new
QAction
(
menu
);
act
->
setData
(
int
(
id
));
...
...
@@ -2497,10 +2497,10 @@ void DebuggerPluginPrivate::toggleBreakpointByFileAndLine(const QString &fileNam
BreakHandler
*
handler
=
m_breakHandler
;
BreakpointId
id
=
handler
->
findBreakpointByFileAndLine
(
fileName
,
lineNumber
,
true
);
if
(
id
==
BreakpointId
(
-
1
)
)
if
(
!
id
)
id
=
handler
->
findBreakpointByFileAndLine
(
fileName
,
lineNumber
,
false
);
if
(
id
!=
BreakpointId
(
-
1
)
)
{
if
(
id
)
{
handler
->
removeBreakpoint
(
id
);
}
else
{
BreakpointParameters
data
(
BreakpointByFileAndLine
);
...
...
@@ -2516,7 +2516,7 @@ void DebuggerPluginPrivate::toggleBreakpointByAddress(quint64 address)
BreakHandler
*
handler
=
m_breakHandler
;
BreakpointId
id
=
handler
->
findBreakpointByAddress
(
address
);
if
(
id
!=
BreakpointId
(
-
1
)
)
{
if
(
id
)
{
handler
->
removeBreakpoint
(
id
);
}
else
{
BreakpointParameters
data
(
BreakpointByAddress
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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