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
0a004097
Commit
0a004097
authored
Nov 16, 2010
by
hjk
Browse files
debugger: remove intermediate BreakpointData stucture layer
parent
3a7f7b6d
Changes
13
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/breakhandler.cpp
View file @
0a004097
...
...
@@ -84,30 +84,30 @@ static inline bool fileNameMatch(const QString &f1, const QString &f2)
#endif
}
static
bool
isSimilarTo
(
const
Breakpoint
Data
&
data
,
const
BreakpointResponse
&
needle
)
static
bool
isSimilarTo
(
const
Breakpoint
Parameters
&
data
,
const
BreakpointResponse
&
needle
)
{
// Clear hit.
// Clear miss.
if
(
needle
.
type
!=
UnknownType
&&
data
.
type
()
!=
UnknownType
&&
data
.
type
()
!=
needle
.
type
)
if
(
needle
.
type
!=
UnknownType
&&
data
.
type
!=
UnknownType
&&
data
.
type
!=
needle
.
type
)
return
false
;
// Clear hit.
if
(
data
.
address
()
&&
data
.
address
()
==
needle
.
address
)
if
(
data
.
address
&&
data
.
address
==
needle
.
address
)
return
true
;
// At least at a position we were looking for.
// FIXME: breaks multiple breakpoints at the same location
if
(
!
data
.
fileName
()
.
isEmpty
()
&&
fileNameMatch
(
data
.
fileName
()
,
needle
.
fileName
)
&&
data
.
lineNumber
()
==
needle
.
lineNumber
)
if
(
!
data
.
fileName
.
isEmpty
()
&&
fileNameMatch
(
data
.
fileName
,
needle
.
fileName
)
&&
data
.
lineNumber
==
needle
.
lineNumber
)
return
true
;
// At least at a position we were looking for.
// FIXME: breaks multiple breakpoints at the same location
if
(
!
data
.
fileName
()
.
isEmpty
()
&&
fileNameMatch
(
data
.
fileName
()
,
needle
.
fileName
)
&&
data
.
lineNumber
()
==
needle
.
lineNumber
)
if
(
!
data
.
fileName
.
isEmpty
()
&&
fileNameMatch
(
data
.
fileName
,
needle
.
fileName
)
&&
data
.
lineNumber
==
needle
.
lineNumber
)
return
true
;
return
false
;
...
...
@@ -119,7 +119,7 @@ BreakpointId BreakHandler::findSimilarBreakpoint(const BreakpointResponse &needl
ConstIterator
it
=
m_storage
.
constBegin
(),
et
=
m_storage
.
constEnd
();
for
(
;
it
!=
et
;
++
it
)
{
const
BreakpointId
id
=
it
.
key
();
const
Breakpoint
Data
&
data
=
it
->
data
;
const
Breakpoint
Parameters
&
data
=
it
->
data
;
const
BreakpointResponse
&
response
=
it
->
response
;
qDebug
()
<<
"COMPARING "
<<
data
.
toString
()
<<
" WITH "
<<
needle
.
toString
();
if
(
response
.
number
&&
response
.
number
==
needle
.
number
)
...
...
@@ -144,7 +144,7 @@ BreakpointId BreakHandler::findBreakpointByFunction(const QString &functionName)
{
ConstIterator
it
=
m_storage
.
constBegin
(),
et
=
m_storage
.
constEnd
();
for
(
;
it
!=
et
;
++
it
)
if
(
it
->
data
.
functionName
()
==
functionName
)
if
(
it
->
data
.
functionName
==
functionName
)
return
it
.
key
();
return
BreakpointId
(
-
1
);
}
...
...
@@ -153,7 +153,7 @@ BreakpointId BreakHandler::findBreakpointByAddress(quint64 address) const
{
ConstIterator
it
=
m_storage
.
constBegin
(),
et
=
m_storage
.
constEnd
();
for
(
;
it
!=
et
;
++
it
)
if
(
it
->
data
.
address
()
==
address
)
if
(
it
->
data
.
address
==
address
)
return
it
.
key
();
return
BreakpointId
(
-
1
);
}
...
...
@@ -173,14 +173,14 @@ const BreakpointParameters &BreakHandler::breakpointData(BreakpointId id) const
static
BreakpointParameters
dummy
;
ConstIterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
dummy
);
return
it
->
data
.
parameters
()
;
return
it
->
data
;
}
BreakpointId
BreakHandler
::
findWatchpointByAddress
(
quint64
address
)
const
{
ConstIterator
it
=
m_storage
.
constBegin
(),
et
=
m_storage
.
constEnd
();
for
(
;
it
!=
et
;
++
it
)
if
(
it
->
data
.
isWatchpoint
()
&&
it
->
data
.
address
()
==
address
)
if
(
it
->
data
.
isWatchpoint
()
&&
it
->
data
.
address
==
address
)
return
it
.
key
();
return
BreakpointId
(
-
1
);
}
...
...
@@ -211,30 +211,30 @@ void BreakHandler::saveBreakpoints()
QList
<
QVariant
>
list
;
ConstIterator
it
=
m_storage
.
constBegin
(),
et
=
m_storage
.
constEnd
();
for
(
;
it
!=
et
;
++
it
)
{
const
Breakpoint
Data
&
data
=
it
->
data
;
const
Breakpoint
Parameters
&
data
=
it
->
data
;
QMap
<
QString
,
QVariant
>
map
;
// Do not persist Watchpoints.
if
(
data
.
isWatchpoint
())
continue
;
if
(
data
.
type
()
!=
BreakpointByFileAndLine
)
map
.
insert
(
_
(
"type"
),
data
.
type
()
);
if
(
!
data
.
fileName
()
.
isEmpty
())
map
.
insert
(
_
(
"filename"
),
data
.
fileName
()
);
if
(
data
.
lineNumber
()
)
map
.
insert
(
_
(
"linenumber"
),
data
.
lineNumber
()
);
if
(
!
data
.
functionName
()
.
isEmpty
())
map
.
insert
(
_
(
"funcname"
),
data
.
functionName
()
);
if
(
data
.
address
()
)
map
.
insert
(
_
(
"address"
),
data
.
address
()
);
if
(
!
data
.
condition
()
.
isEmpty
())
map
.
insert
(
_
(
"condition"
),
data
.
condition
()
);
if
(
data
.
ignoreCount
()
)
map
.
insert
(
_
(
"ignorecount"
),
data
.
ignoreCount
()
);
if
(
!
data
.
threadSpec
()
.
isEmpty
())
map
.
insert
(
_
(
"threadspec"
),
data
.
threadSpec
()
);
if
(
!
data
.
isE
nabled
()
)
if
(
data
.
type
!=
BreakpointByFileAndLine
)
map
.
insert
(
_
(
"type"
),
data
.
type
);
if
(
!
data
.
fileName
.
isEmpty
())
map
.
insert
(
_
(
"filename"
),
data
.
fileName
);
if
(
data
.
lineNumber
)
map
.
insert
(
_
(
"linenumber"
),
data
.
lineNumber
);
if
(
!
data
.
functionName
.
isEmpty
())
map
.
insert
(
_
(
"funcname"
),
data
.
functionName
);
if
(
data
.
address
)
map
.
insert
(
_
(
"address"
),
data
.
address
);
if
(
!
data
.
condition
.
isEmpty
())
map
.
insert
(
_
(
"condition"
),
data
.
condition
);
if
(
data
.
ignoreCount
)
map
.
insert
(
_
(
"ignorecount"
),
data
.
ignoreCount
);
if
(
!
data
.
threadSpec
.
isEmpty
())
map
.
insert
(
_
(
"threadspec"
),
data
.
threadSpec
);
if
(
!
data
.
e
nabled
)
map
.
insert
(
_
(
"disabled"
),
_
(
"1"
));
if
(
data
.
useFullPath
()
)
if
(
data
.
useFullPath
)
map
.
insert
(
_
(
"usefullpath"
),
_
(
"1"
));
list
.
append
(
map
);
}
...
...
@@ -351,7 +351,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
BreakpointId
id
=
findBreakpointByIndex
(
mi
);
ConstIterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
QVariant
());
const
Breakpoint
Data
&
data
=
it
->
data
;
const
Breakpoint
Parameters
&
data
=
it
->
data
;
const
BreakpointResponse
&
response
=
it
->
response
;
switch
(
mi
.
column
())
{
...
...
@@ -363,7 +363,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
if
(
role
==
Qt
::
DecorationRole
)
{
if
(
data
.
isWatchpoint
())
return
m_watchpointIcon
;
if
(
!
data
.
isE
nabled
()
)
if
(
!
data
.
e
nabled
)
return
m_disabledBreakpointIcon
;
return
it
->
isPending
()
?
m_pendingBreakPointIcon
:
m_breakpointIcon
;
}
...
...
@@ -371,20 +371,20 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
case
1
:
if
(
role
==
Qt
::
DisplayRole
)
{
const
QString
str
=
it
->
isPending
()
?
data
.
functionName
()
:
response
.
functionName
;
?
data
.
functionName
:
response
.
functionName
;
return
str
.
isEmpty
()
?
empty
:
str
;
}
break
;
case
2
:
if
(
role
==
Qt
::
DisplayRole
)
{
QString
str
=
it
->
isPending
()
?
data
.
fileName
()
:
response
.
fileName
;
?
data
.
fileName
:
response
.
fileName
;
str
=
QFileInfo
(
str
).
fileName
();
// FIXME: better?
//if (data.bpMultiple && str.isEmpty() && !data.markerFileName.isEmpty())
// str = data.markerFileName;
str
=
str
.
isEmpty
()
?
empty
:
str
;
if
(
data
.
useFullPath
()
)
if
(
data
.
useFullPath
)
str
=
QDir
::
toNativeSeparators
(
QLatin1String
(
"/.../"
)
+
str
);
return
str
;
}
...
...
@@ -395,48 +395,48 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
//if (data.bpMultiple && str.isEmpty() && !data.markerFileName.isEmpty())
// str = data.markerLineNumber;
const
int
nr
=
it
->
isPending
()
?
data
.
lineNumber
()
:
response
.
lineNumber
;
?
data
.
lineNumber
:
response
.
lineNumber
;
return
nr
?
QString
::
number
(
nr
)
:
empty
;
}
if
(
role
==
Qt
::
UserRole
+
1
)
return
data
.
lineNumber
()
;
return
data
.
lineNumber
;
break
;
case
4
:
if
(
role
==
Qt
::
DisplayRole
)
return
it
->
isPending
()
?
data
.
condition
()
:
response
.
condition
;
return
it
->
isPending
()
?
data
.
condition
:
response
.
condition
;
if
(
role
==
Qt
::
ToolTipRole
)
return
tr
(
"Breakpoint will only be hit if this condition is met."
);
if
(
role
==
Qt
::
UserRole
+
1
)
return
data
.
condition
()
;
return
data
.
condition
;
break
;
case
5
:
if
(
role
==
Qt
::
DisplayRole
)
{
const
int
ignoreCount
=
it
->
isPending
()
?
data
.
ignoreCount
()
:
response
.
ignoreCount
;
it
->
isPending
()
?
data
.
ignoreCount
:
response
.
ignoreCount
;
return
ignoreCount
?
QVariant
(
ignoreCount
)
:
QVariant
(
QString
());
}
if
(
role
==
Qt
::
ToolTipRole
)
return
tr
(
"Breakpoint will only be hit after being ignored so many times."
);
if
(
role
==
Qt
::
UserRole
+
1
)
return
data
.
ignoreCount
()
;
return
data
.
ignoreCount
;
break
;
case
6
:
if
(
role
==
Qt
::
DisplayRole
)
{
if
(
it
->
isPending
())
return
!
data
.
threadSpec
()
.
isEmpty
()
?
data
.
threadSpec
()
:
tr
(
"(all)"
);
return
!
data
.
threadSpec
.
isEmpty
()
?
data
.
threadSpec
:
tr
(
"(all)"
);
else
return
!
response
.
threadSpec
.
isEmpty
()
?
response
.
threadSpec
:
tr
(
"(all)"
);
}
if
(
role
==
Qt
::
ToolTipRole
)
return
tr
(
"Breakpoint will only be hit in the specified thread(s)."
);
if
(
role
==
Qt
::
UserRole
+
1
)
return
data
.
threadSpec
()
;
return
data
.
threadSpec
;
break
;
case
7
:
if
(
role
==
Qt
::
DisplayRole
)
{
QString
displayValue
;
const
quint64
address
=
data
.
isWatchpoint
()
?
data
.
address
()
:
response
.
address
;
data
.
isWatchpoint
()
?
data
.
address
:
response
.
address
;
if
(
address
)
displayValue
+=
QString
::
fromAscii
(
"0x%1"
).
arg
(
address
,
0
,
16
);
if
(
!
response
.
state
.
isEmpty
())
{
...
...
@@ -462,24 +462,25 @@ type BreakHandler::getter(BreakpointId id) const \
QTC_ASSERT(it != m_storage.end(), \
qDebug() << "ID" << id << "NOT KNOWN"; \
return type()); \
return it->data.getter
()
; \
return it->data.getter; \
}
#define SETTER(type, setter) \
#define SETTER(type,
getter,
setter) \
void BreakHandler::setter(BreakpointId id, const type &value) \
{ \
Iterator it = m_storage.find(id); \
QTC_ASSERT(it != m_storage.end(), \
qDebug() << "ID" << id << "NOT KNOWN"; return); \
if (
!
it->data.
s
etter
(
value)
)
\
if (it->data.
g
etter
==
value) \
return; \
it->data.getter = value; \
it->state = BreakpointChangeRequested; \
scheduleSynchronization(); \
}
#define PROPERTY(type, getter, setter) \
GETTER(type, getter) \
SETTER(type, setter)
SETTER(type,
getter,
setter)
PROPERTY
(
bool
,
useFullPath
,
setUseFullPath
)
...
...
@@ -496,7 +497,7 @@ bool BreakHandler::isEnabled(BreakpointId id) const
{
ConstIterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
false
);
return
it
->
data
.
isE
nabled
()
;
return
it
->
data
.
e
nabled
;
}
void
BreakHandler
::
setEnabled
(
BreakpointId
id
,
bool
on
)
...
...
@@ -504,12 +505,13 @@ void BreakHandler::setEnabled(BreakpointId id, bool on)
Iterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
);
//qDebug() << "SET ENABLED: " << id << it->data.isEnabled() << on;
if
(
it
->
data
.
setEnabled
(
on
))
{
it
->
destroyMarker
();
it
->
state
=
BreakpointChangeRequested
;
updateMarker
(
id
);
scheduleSynchronization
();
}
if
(
it
->
data
.
enabled
==
on
)
return
;
it
->
data
.
enabled
=
on
;
it
->
destroyMarker
();
it
->
state
=
BreakpointChangeRequested
;
updateMarker
(
id
);
scheduleSynchronization
();
}
void
BreakHandler
::
setMarkerFileAndLine
(
BreakpointId
id
,
...
...
@@ -565,7 +567,7 @@ void BreakHandler::ackCondition(BreakpointId id)
{
Iterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
);
it
->
response
.
condition
=
it
->
data
.
condition
()
;
it
->
response
.
condition
=
it
->
data
.
condition
;
updateMarker
(
id
);
}
...
...
@@ -573,7 +575,7 @@ void BreakHandler::ackIgnoreCount(BreakpointId id)
{
Iterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
);
it
->
response
.
ignoreCount
=
it
->
data
.
ignoreCount
()
;
it
->
response
.
ignoreCount
=
it
->
data
.
ignoreCount
;
updateMarker
(
id
);
}
...
...
@@ -581,7 +583,7 @@ void BreakHandler::ackEnabled(BreakpointId id)
{
Iterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
);
it
->
response
.
enabled
=
it
->
data
.
isE
nabled
()
;
it
->
response
.
enabled
=
it
->
data
.
e
nabled
;
updateMarker
(
id
);
}
...
...
@@ -620,7 +622,7 @@ void BreakHandler::appendBreakpoint(const BreakpointParameters &data)
BreakpointId
id
(
++
currentId
);
BreakpointItem
item
;
item
.
data
.
m_parameters
=
data
;
item
.
data
=
data
;
item
.
markerFileName
=
data
.
fileName
;
item
.
markerLineNumber
=
data
.
lineNumber
;
m_storage
.
insert
(
id
,
item
);
...
...
@@ -674,10 +676,10 @@ void BreakHandler::breakByFunction(const QString &functionName)
// combinations of multiple conditions and ignore counts, though.
ConstIterator
it
=
m_storage
.
constBegin
(),
et
=
m_storage
.
constEnd
();
for
(
;
it
!=
et
;
++
it
)
{
const
Breakpoint
Data
&
data
=
it
->
data
;
if
(
data
.
functionName
()
==
functionName
&&
data
.
condition
()
.
isEmpty
()
&&
data
.
ignoreCount
()
==
0
)
const
Breakpoint
Parameters
&
data
=
it
->
data
;
if
(
data
.
functionName
==
functionName
&&
data
.
condition
.
isEmpty
()
&&
data
.
ignoreCount
==
0
)
return
;
}
BreakpointParameters
data
(
BreakpointByFunction
);
...
...
@@ -689,7 +691,7 @@ QIcon BreakHandler::icon(BreakpointId id) const
{
ConstIterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
pendingBreakPointIcon
());
if
(
!
it
->
data
.
isE
nabled
()
)
if
(
!
it
->
data
.
e
nabled
)
return
m_disabledBreakpointIcon
;
if
(
it
->
state
==
BreakpointInserted
)
return
breakpointIcon
();
...
...
@@ -719,7 +721,7 @@ void BreakHandler::gotoLocation(BreakpointId id) const
ConstIterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
);
debuggerCore
()
->
gotoLocation
(
it
->
data
.
fileName
()
,
it
->
data
.
lineNumber
()
,
false
);
it
->
data
.
fileName
,
it
->
data
.
lineNumber
,
false
);
}
void
BreakHandler
::
updateLineNumberFromMarker
(
BreakpointId
id
,
int
lineNumber
)
...
...
@@ -744,7 +746,7 @@ void BreakHandler::updateLineNumberFromMarker(BreakpointId id, int lineNumber)
// the next line that generated code.
// FIXME: Do we need yet another data member?
if
(
it
->
response
.
number
==
0
)
{
it
->
data
.
setL
ineNumber
(
lineNumber
)
;
it
->
data
.
l
ineNumber
=
lineNumber
;
updateMarker
(
id
);
}
}
...
...
@@ -853,9 +855,9 @@ void BreakHandler::setBreakpointData(BreakpointId id, const BreakpointParameters
{
Iterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
);
if
(
data
==
it
->
data
.
m_parameters
)
if
(
data
==
it
->
data
)
return
;
it
->
data
.
m_parameters
=
data
;
it
->
data
=
data
;
updateMarker
(
id
);
layoutChanged
();
}
...
...
@@ -907,7 +909,7 @@ static QString stateToString(BreakpointState state)
bool
BreakHandler
::
BreakpointItem
::
isLocatedAt
(
const
QString
&
fileName
,
int
lineNumber
,
bool
useMarkerPosition
)
const
{
int
line
=
useMarkerPosition
?
markerLineNumber
:
data
.
lineNumber
()
;
int
line
=
useMarkerPosition
?
markerLineNumber
:
data
.
lineNumber
;
return
lineNumber
==
line
&&
fileNameMatch
(
fileName
,
markerFileName
);
}
...
...
@@ -915,7 +917,7 @@ QString BreakHandler::BreakpointItem::toToolTip() const
{
QString
t
;
switch
(
data
.
type
()
)
{
switch
(
data
.
type
)
{
case
BreakpointByFileAndLine
:
t
=
tr
(
"Breakpoint by File and Line"
);
break
;
...
...
@@ -967,22 +969,22 @@ QString BreakHandler::BreakpointItem::toToolTip() const
<<
"<tr><td>"
<<
tr
(
"Internal Number:"
)
<<
"</td><td>—</td><td>"
<<
response
.
number
<<
"</td></tr>"
<<
"<tr><td>"
<<
tr
(
"File Name:"
)
<<
"</td><td>"
<<
QDir
::
toNativeSeparators
(
data
.
fileName
()
)
<<
"</td><td>"
<<
QDir
::
toNativeSeparators
(
data
.
fileName
)
<<
"</td><td>"
<<
QDir
::
toNativeSeparators
(
response
.
fileName
)
<<
"</td></tr>"
<<
"<tr><td>"
<<
tr
(
"Function Name:"
)
<<
"</td><td>"
<<
data
.
functionName
()
<<
"</td><td>"
<<
data
.
functionName
<<
"</td><td>"
<<
response
.
functionName
<<
"</td></tr>"
<<
"<tr><td>"
<<
tr
(
"Line Number:"
)
<<
"</td><td>"
;
if
(
data
.
lineNumber
()
)
str
<<
data
.
lineNumber
()
;
if
(
data
.
lineNumber
)
str
<<
data
.
lineNumber
;
str
<<
"</td><td>"
;
if
(
response
.
lineNumber
)
str
<<
response
.
lineNumber
;
str
<<
"</td></tr>"
<<
"<tr><td>"
<<
tr
(
"Breakpoint Address:"
)
<<
"</td><td>"
;
formatAddress
(
str
,
data
.
address
()
);
formatAddress
(
str
,
data
.
address
);
str
<<
"</td><td>"
;
formatAddress
(
str
,
response
.
address
);
//str << "</td></tr>"
...
...
@@ -994,17 +996,17 @@ QString BreakHandler::BreakpointItem::toToolTip() const
// str << '-';
str
<<
"</td></tr>"
<<
"<tr><td>"
<<
tr
(
"Condition:"
)
<<
"</td><td>"
<<
data
.
condition
()
<<
"</td><td>"
<<
data
.
condition
<<
"</td><td>"
<<
response
.
condition
<<
"</td></tr>"
<<
"<tr><td>"
<<
tr
(
"Ignore Count:"
)
<<
"</td><td>"
;
if
(
data
.
ignoreCount
()
)
str
<<
data
.
ignoreCount
()
;
if
(
data
.
ignoreCount
)
str
<<
data
.
ignoreCount
;
str
<<
"</td><td>"
;
if
(
response
.
ignoreCount
)
str
<<
response
.
ignoreCount
;
str
<<
"</td></tr>"
<<
"<tr><td>"
<<
tr
(
"Thread Specification:"
)
<<
"</td><td>"
<<
data
.
threadSpec
()
<<
"</td><td>"
<<
data
.
threadSpec
<<
"</td><td>"
<<
response
.
threadSpec
<<
"</td></tr>"
<<
"</table></body></html>"
;
return
rc
;
...
...
src/plugins/debugger/breakhandler.h
View file @
0a004097
...
...
@@ -180,7 +180,7 @@ private:
bool
useMarkerPosition
)
const
;
QString
toToolTip
()
const
;
Breakpoint
Data
data
;
Breakpoint
Parameters
data
;
BreakpointState
state
;
// Current state of breakpoint.
DebuggerEngine
*
engine
;
// Engine currently handling the breakpoint.
BreakpointResponse
response
;
...
...
src/plugins/debugger/breakpoint.cpp
View file @
0a004097
...
...
@@ -37,12 +37,12 @@ namespace Internal {
//////////////////////////////////////////////////////////////////
//
// Breakpoint
Data
// Breakpoint
Parameters
//
//////////////////////////////////////////////////////////////////
BreakpointParameters
::
BreakpointParameters
(
BreakpointType
t
)
:
type
(
t
),
enabled
(
true
),
useFullPath
(
false
),
BreakpointParameters
::
BreakpointParameters
(
BreakpointType
t
)
:
type
(
t
),
enabled
(
true
),
useFullPath
(
false
),
ignoreCount
(
0
),
lineNumber
(
0
),
address
(
0
)
{
}
...
...
@@ -57,68 +57,10 @@ bool BreakpointParameters::equals(const BreakpointParameters &rhs) const
&&
functionName
==
rhs
.
functionName
;
}
BreakpointData
::
BreakpointData
(
BreakpointType
type
)
:
m_parameters
(
type
)
{}
BreakpointResponse
::
BreakpointResponse
()
:
number
(
0
),
multiple
(
false
)
{}
#define SETIT(var, value) return (var != value) && (var = value, true)
bool
BreakpointData
::
setUseFullPath
(
bool
on
)
{
SETIT
(
m_parameters
.
useFullPath
,
on
);
}
bool
BreakpointData
::
setFileName
(
const
QString
&
file
)
{
SETIT
(
m_parameters
.
fileName
,
file
);
}
bool
BreakpointData
::
setEnabled
(
bool
on
)
{
SETIT
(
m_parameters
.
enabled
,
on
);
}
bool
BreakpointData
::
setIgnoreCount
(
int
count
)
{
SETIT
(
m_parameters
.
ignoreCount
,
count
);
}
bool
BreakpointData
::
setFunctionName
(
const
QString
&
name
)
{
SETIT
(
m_parameters
.
functionName
,
name
);
}
bool
BreakpointData
::
setLineNumber
(
int
line
)
{
SETIT
(
m_parameters
.
lineNumber
,
line
);
}
bool
BreakpointData
::
setAddress
(
quint64
address
)
{
SETIT
(
m_parameters
.
address
,
address
);
}
bool
BreakpointData
::
setThreadSpec
(
const
QByteArray
&
spec
)
{
SETIT
(
m_parameters
.
threadSpec
,
spec
);
}
bool
BreakpointData
::
setType
(
BreakpointType
type
)
{
SETIT
(
m_parameters
.
type
,
type
);
}
bool
BreakpointData
::
setCondition
(
const
QByteArray
&
cond
)
{
SETIT
(
m_parameters
.
condition
,
cond
);
}
#undef SETIT
bool
BreakpointParameters
::
conditionsMatch
(
const
QByteArray
&
other
)
const
{
// Some versions of gdb "beautify" the passed condition.
...
...
@@ -129,17 +71,17 @@ bool BreakpointParameters::conditionsMatch(const QByteArray &other) const
return
s1
==
s2
;
}
QString
Breakpoint
Data
::
toString
()
const
QString
Breakpoint
Parameters
::
toString
()
const
{
QString
result
;
QTextStream
ts
(
&
result
);
ts
<<
fileName
()
;
ts
<<
condition
()
;
ts
<<
ignoreCount
()
;
ts
<<
lineNumber
()
;
ts
<<
address
()
;
ts
<<
functionName
()
;
ts
<<
useFullPath
()
;
ts
<<
fileName
;
ts
<<
condition
;
ts
<<
ignoreCount
;
ts
<<
lineNumber
;
ts
<<
address
;
ts
<<
functionName
;
ts
<<
useFullPath
;
return
result
;
}
...
...
src/plugins/debugger/breakpoint.h
View file @
0a004097
...
...
@@ -40,13 +40,6 @@ typedef quint64 BreakpointId; // FIXME: make Internal.
namespace
Internal
{
class
BreakWindow
;
class
BreakpointDialog
;
class
BreakHandler
;
class
BreakpointData
;
QDataStream
&
operator
>>
(
QDataStream
&
stream
,
BreakpointData
&
data
);
//////////////////////////////////////////////////////////////////
//
// BreakpointData
...
...
@@ -85,6 +78,12 @@ public:
explicit
BreakpointParameters
(
BreakpointType
=
UnknownType
);
bool
equals
(
const
BreakpointParameters
&
rhs
)
const
;
bool
conditionsMatch
(
const
QByteArray
&
other
)
const
;
bool
isWatchpoint
()
const
{
return
type
==
Watchpoint
;
}
bool
isBreakpoint
()
const
{
return
type
!=
Watchpoint
;
}
// Enough for now.
QString
toString
()
const
;
bool
operator
==
(
const
BreakpointParameters
&
p
)
const
{
return
equals
(
p
);
}
bool
operator
!=
(
const
BreakpointParameters
&
p
)
const
{
return
!
equals
(
p
);
}
BreakpointType
type
;
// Type of breakpoint.
bool
enabled
;
// Should we talk to the debugger engine?
...
...
@@ -98,58 +97,6 @@ public:
QString
functionName
;
};
inline
bool
operator
==
(
const
BreakpointParameters
&
p1
,
const
BreakpointParameters
&
p2
)
{
return
p1
.
equals
(
p2
);
}
inline
bool
operator
!=
(
const
BreakpointParameters
&
p1
,
const
BreakpointParameters
&
p2
)
{
return
!
p1
.
equals
(
p2
);
}
class
BreakpointData
{
private: