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
2780ff6f
Commit
2780ff6f
authored
Mar 01, 2011
by
hjk
Browse files
debugger: refactor watch point lookup
In preparation of bitfield watch points.
parent
b0b8a452
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/breakhandler.cpp
View file @
2780ff6f
...
...
@@ -240,33 +240,18 @@ const BreakpointParameters &BreakHandler::breakpointData(BreakpointId id) const
return
it
->
data
;
}
BreakpointId
BreakHandler
::
findWatchpoint
ByAddress
(
quint64
address
)
const
BreakpointId
BreakHandler
::
findWatchpoint
(
const
BreakpointParameters
&
data
)
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
==
data
.
address
&&
it
->
data
.
size
==
data
.
size
&&
it
->
data
.
bitpos
==
data
.
bitpos
)
return
it
.
key
();
return
BreakpointId
();
}
void
BreakHandler
::
setWatchpointByAddress
(
quint64
address
)
{
const
int
id
=
findWatchpointByAddress
(
address
);
if
(
id
)
{
qDebug
()
<<
"WATCHPOINT EXISTS"
;
// removeBreakpoint(index);
return
;
}
BreakpointParameters
data
(
Watchpoint
);
data
.
address
=
address
;
appendBreakpoint
(
data
);
}
bool
BreakHandler
::
hasWatchpointAt
(
quint64
address
)
const
{
return
findWatchpointByAddress
(
address
);
}
void
BreakHandler
::
saveBreakpoints
()
{
const
QString
one
=
_
(
"1"
);
...
...
src/plugins/debugger/breakhandler.h
View file @
2780ff6f
...
...
@@ -80,12 +80,10 @@ public:
// Find a breakpoint matching approximately the data in needle.
BreakpointId
findSimilarBreakpoint
(
const
BreakpointResponse
&
needle
)
const
;
BreakpointId
findBreakpointByNumber
(
int
bpNumber
)
const
;
BreakpointId
findWatchpoint
ByAddress
(
quint64
address
)
const
;
BreakpointId
findWatchpoint
(
const
BreakpointParameters
&
data
)
const
;
BreakpointId
findBreakpointByFunction
(
const
QString
&
functionName
)
const
;
BreakpointId
findBreakpointByIndex
(
const
QModelIndex
&
index
)
const
;
BreakpointIds
findBreakpointsByIndex
(
const
QList
<
QModelIndex
>
&
list
)
const
;
void
setWatchpointByAddress
(
quint64
address
);
bool
hasWatchpointAt
(
quint64
address
)
const
;
void
updateMarkers
();
static
QIcon
breakpointIcon
();
...
...
src/plugins/debugger/breakpoint.cpp
View file @
2780ff6f
...
...
@@ -53,7 +53,8 @@ namespace Internal {
BreakpointParameters
::
BreakpointParameters
(
BreakpointType
t
)
:
type
(
t
),
enabled
(
true
),
pathUsage
(
BreakpointPathUsageEngineDefault
),
ignoreCount
(
0
),
lineNumber
(
0
),
address
(
0
),
threadSpec
(
-
1
),
ignoreCount
(
0
),
lineNumber
(
0
),
address
(
0
),
size
(
0
),
bitpos
(
0
),
bitsize
(
0
),
threadSpec
(
-
1
),
tracepoint
(
false
)
{}
...
...
src/plugins/debugger/breakpoint.h
View file @
2780ff6f
...
...
@@ -107,6 +107,9 @@ public:
int
ignoreCount
;
//!< Ignore count associated with breakpoint.
int
lineNumber
;
//!< Line in source file.
quint64
address
;
//!< Address for watchpoints.
uint
size
;
//!< Size of watched area for watchpoints.
uint
bitpos
;
//!< Location of watched bitfield within watched area.
uint
bitsize
;
//!< Size of watched bitfield within watched area.
int
threadSpec
;
//!< Thread specification.
QString
functionName
;
QString
module
;
//!< module for file name
...
...
src/plugins/debugger/watchhandler.cpp
View file @
2780ff6f
...
...
@@ -724,17 +724,21 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
return
pointerValue
(
data
.
value
);
return
QVariant
(
quint64
(
0
));
case
LocalsIsWatchpointAtAddressRole
:
return
engine
()
->
breakHandler
()
->
hasWatchpointAt
(
data
.
coreAddress
());
case
LocalsIsWatchpointAtAddressRole
:
{
BreakpointParameters
bp
(
Watchpoint
);
bp
.
address
=
data
.
coreAddress
();
return
engine
()
->
breakHandler
()
->
findWatchpoint
(
bp
)
!=
0
;
}
case
LocalsAddressRole
:
return
data
.
coreAddress
();
case
LocalsIsWatchpointAtPointerValueRole
:
if
(
isPointerType
(
data
.
type
))
return
engine
()
->
breakHandler
()
->
hasWatchpointAt
(
pointerValue
(
data
.
value
));
if
(
isPointerType
(
data
.
type
))
{
BreakpointParameters
bp
(
Watchpoint
);
bp
.
address
=
pointerValue
(
data
.
value
);
return
engine
()
->
breakHandler
()
->
findWatchpoint
(
bp
)
!=
0
;
}
return
false
;
default:
...
...
src/plugins/debugger/watchwindow.cpp
View file @
2780ff6f
...
...
@@ -654,7 +654,15 @@ void WatchWindow::setModelData
void
WatchWindow
::
setWatchpoint
(
quint64
address
)
{
breakHandler
()
->
setWatchpointByAddress
(
address
);
BreakpointParameters
data
(
Watchpoint
);
data
.
address
=
address
;
BreakpointId
id
=
breakHandler
()
->
findWatchpoint
(
data
);
if
(
id
)
{
qDebug
()
<<
"WATCHPOINT EXISTS"
;
// removeBreakpoint(index);
return
;
}
breakHandler
()
->
appendBreakpoint
(
data
);
}
}
// namespace Internal
...
...
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