Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
24912c3f
Commit
24912c3f
authored
Oct 05, 2010
by
Christiaan Janssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QmlObserver: breakpoint list is shared between engines
Reviewed by: Kai Koehne, Andre Poenitz
parent
9dfc5b14
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
92 additions
and
30 deletions
+92
-30
src/plugins/debugger/breakhandler.cpp
src/plugins/debugger/breakhandler.cpp
+59
-27
src/plugins/debugger/breakhandler.h
src/plugins/debugger/breakhandler.h
+8
-3
src/plugins/debugger/debuggerengine.cpp
src/plugins/debugger/debuggerengine.cpp
+5
-0
src/plugins/debugger/debuggerengine.h
src/plugins/debugger/debuggerengine.h
+2
-0
src/plugins/debugger/gdb/gdbengine.cpp
src/plugins/debugger/gdb/gdbengine.cpp
+5
-0
src/plugins/debugger/gdb/gdbengine.h
src/plugins/debugger/gdb/gdbengine.h
+1
-0
src/plugins/debugger/qml/qmlcppengine.cpp
src/plugins/debugger/qml/qmlcppengine.cpp
+5
-0
src/plugins/debugger/qml/qmlcppengine.h
src/plugins/debugger/qml/qmlcppengine.h
+1
-0
src/plugins/debugger/qml/qmlengine.cpp
src/plugins/debugger/qml/qmlengine.cpp
+5
-0
src/plugins/debugger/qml/qmlengine.h
src/plugins/debugger/qml/qmlengine.h
+1
-0
No files found.
src/plugins/debugger/breakhandler.cpp
View file @
24912c3f
...
...
@@ -65,6 +65,8 @@ BreakHandler::BreakHandler(Debugger::DebuggerEngine *engine)
//m_emptyIcon(_(":/debugger/images/debugger_empty_14.png")),
m_watchpointIcon
(
_
(
":/debugger/images/watchpoint.png"
)),
m_engine
(
engine
),
m_bp
(
0
),
m_masterList
(
false
),
m_lastFound
(
0
),
m_lastFoundQueried
(
false
)
{
...
...
@@ -73,6 +75,11 @@ BreakHandler::BreakHandler(Debugger::DebuggerEngine *engine)
BreakHandler
::~
BreakHandler
()
{
if
(
m_bp
&&
m_masterList
)
{
qDeleteAll
(
*
m_bp
);
m_bp
->
clear
();
delete
m_bp
;
}
clear
();
}
...
...
@@ -97,20 +104,20 @@ bool BreakHandler::hasPendingBreakpoints() const
BreakpointData
*
BreakHandler
::
at
(
int
index
)
const
{
QTC_ASSERT
(
index
<
size
(),
return
0
);
return
m_bp
.
at
(
index
);
QTC_ASSERT
(
m_bp
,
/**/
);
return
m_bp
->
at
(
index
);
}
void
BreakHandler
::
removeAt
(
int
index
)
{
QTC_ASSERT
(
m_bp
,
/**/
);
BreakpointData
*
data
=
at
(
index
);
m_bp
.
removeAt
(
index
);
m_bp
->
removeAt
(
index
);
delete
data
;
}
void
BreakHandler
::
clear
()
{
qDeleteAll
(
m_bp
);
m_bp
.
clear
();
m_enabled
.
clear
();
m_disabled
.
clear
();
m_removed
.
clear
();
...
...
@@ -119,9 +126,10 @@ void BreakHandler::clear()
BreakpointData
*
BreakHandler
::
findSimilarBreakpoint
(
const
BreakpointData
*
needle
)
const
{
QTC_ASSERT
(
m_bp
,
/**/
);
// Search a breakpoint we might refer to.
for
(
int
index
=
0
;
index
!=
size
();
++
index
)
{
BreakpointData
*
data
=
m_bp
[
index
];
BreakpointData
*
data
=
(
*
m_bp
)
[
index
];
if
(
data
->
isSimilarTo
(
needle
))
return
data
;
}
...
...
@@ -516,8 +524,9 @@ void BreakHandler::reinsertBreakpoint(BreakpointData *data)
void
BreakHandler
::
append
(
BreakpointData
*
data
)
{
QTC_ASSERT
(
m_bp
,
/**/
);
data
->
m_handler
=
this
;
m_bp
.
append
(
data
);
m_bp
->
append
(
data
);
m_inserted
.
append
(
data
);
}
...
...
@@ -554,8 +563,9 @@ Breakpoints BreakHandler::takeDisabledBreakpoints()
void
BreakHandler
::
removeBreakpointHelper
(
int
index
)
{
BreakpointData
*
data
=
m_bp
.
at
(
index
);
m_bp
.
removeAt
(
index
);
QTC_ASSERT
(
m_bp
,
/**/
);
BreakpointData
*
data
=
m_bp
->
at
(
index
);
m_bp
->
removeAt
(
index
);
data
->
removeMarker
();
m_removed
.
append
(
data
);
}
...
...
@@ -570,7 +580,8 @@ void BreakHandler::removeBreakpoint(int index)
void
BreakHandler
::
removeBreakpoint
(
BreakpointData
*
data
)
{
removeBreakpointHelper
(
m_bp
.
indexOf
(
data
));
QTC_ASSERT
(
m_bp
,
/**/
);
removeBreakpointHelper
(
m_bp
->
indexOf
(
data
));
emit
layoutChanged
();
}
...
...
@@ -614,7 +625,8 @@ void BreakHandler::removeAllBreakpoints()
BreakpointData
*
BreakHandler
::
findBreakpoint
(
quint64
address
)
const
{
foreach
(
BreakpointData
*
data
,
m_bp
)
QTC_ASSERT
(
m_bp
,
/**/
);
foreach
(
BreakpointData
*
data
,
*
m_bp
)
if
(
data
->
address
==
address
)
return
data
;
return
0
;
...
...
@@ -623,7 +635,8 @@ BreakpointData *BreakHandler::findBreakpoint(quint64 address) const
BreakpointData
*
BreakHandler
::
findBreakpoint
(
const
QString
&
fileName
,
int
lineNumber
,
bool
useMarkerPosition
)
{
foreach
(
BreakpointData
*
data
,
m_bp
)
QTC_ASSERT
(
m_bp
,
/**/
);
foreach
(
BreakpointData
*
data
,
*
m_bp
)
if
(
data
->
isLocatedAt
(
fileName
,
lineNumber
,
useMarkerPosition
))
return
data
;
return
0
;
...
...
@@ -633,15 +646,14 @@ void BreakHandler::toggleBreakpoint(const QString &fileName, int lineNumber,
quint64
address
/* = 0 */
)
{
BreakpointData
*
data
=
0
;
do
{
if
(
address
)
{
data
=
findBreakpoint
(
address
);
break
;
}
if
(
address
)
{
data
=
findBreakpoint
(
address
);
}
else
{
data
=
findBreakpoint
(
fileName
,
lineNumber
,
true
);
if
(
!
data
)
data
=
findBreakpoint
(
fileName
,
lineNumber
,
false
);
}
while
(
false
);
}
if
(
data
)
{
removeBreakpoint
(
data
);
...
...
@@ -667,9 +679,19 @@ void BreakHandler::saveSessionData()
saveBreakpoints
();
}
void
BreakHandler
::
initMasterList
()
{
if
(
m_bp
)
{
delete
m_bp
;
}
m_masterList
=
true
;
m_bp
=
new
Breakpoints
;
}
void
BreakHandler
::
loadSessionData
()
{
QTC_ASSERT
(
m_engine
->
isSessionEngine
(),
return
);
initMasterList
();
loadBreakpoints
();
updateMarkers
();
}
...
...
@@ -697,23 +719,33 @@ bool BreakHandler::isActive() const
return
m_engine
->
isActive
();
}
bool
BreakHandler
::
isMasterList
()
const
{
return
m_masterList
;
}
void
BreakHandler
::
initializeFromTemplate
(
BreakHandler
*
other
)
{
QTC_ASSERT
(
m_bp
.
isEmpty
(),
/**/
);
foreach
(
BreakpointData
*
data
,
other
->
m_bp
)
{
append
(
data
->
clone
());
data
->
removeMarker
();
QTC_ASSERT
(
other
->
isMasterList
(),
/**/
);
QTC_ASSERT
(
!
isMasterList
(),
/**/
);
QTC_ASSERT
(
other
->
m_bp
,
/**/
);
m_bp
=
other
->
m_bp
;
foreach
(
BreakpointData
*
data
,
*
m_bp
)
{
if
(
m_engine
->
acceptsBreakpoint
(
data
))
data
->
m_handler
=
this
;
}
updateMarkers
();
}
void
BreakHandler
::
storeToTemplate
(
BreakHandler
*
other
)
{
other
->
removeAllBreakpoints
();
foreach
(
const
BreakpointData
*
data
,
m_bp
)
other
->
append
(
data
->
clone
());
removeAllBreakpoints
();
other
->
updateMarkers
();
QTC_ASSERT
(
m_bp
,
/**/
);
foreach
(
BreakpointData
*
data
,
*
m_bp
)
{
data
->
m_handler
=
other
;
}
m_bp
=
0
;
other
->
saveSessionData
();
}
...
...
src/plugins/debugger/breakhandler.h
View file @
24912c3f
...
...
@@ -64,11 +64,11 @@ public:
QAbstractItemModel
*
model
()
{
return
this
;
}
BreakpointData
*
at
(
int
index
)
const
;
int
size
()
const
{
return
m_bp
.
size
();
}
int
size
()
const
{
return
m_bp
?
m_bp
->
size
()
:
0
;
}
bool
hasPendingBreakpoints
()
const
;
void
removeAt
(
int
index
);
// This also deletes the marker.
void
clear
();
// This also deletes all the marker.
int
indexOf
(
BreakpointData
*
data
)
{
return
m_bp
.
indexOf
(
data
);
}
int
indexOf
(
BreakpointData
*
data
)
{
return
m_bp
?
m_bp
->
indexOf
(
data
)
:-
1
;
}
// Find a breakpoint matching approximately the data in needle.
BreakpointData
*
findSimilarBreakpoint
(
const
BreakpointData
*
needle
)
const
;
BreakpointData
*
findBreakpointByNumber
(
int
bpNumber
)
const
;
...
...
@@ -76,6 +76,7 @@ public:
bool
watchPointAt
(
quint64
address
)
const
;
void
updateMarkers
();
bool
isActive
()
const
;
bool
isMasterList
()
const
;
Breakpoints
insertedBreakpoints
()
const
;
void
takeInsertedBreakPoint
(
BreakpointData
*
);
...
...
@@ -121,6 +122,8 @@ private:
void
removeBreakpointHelper
(
int
index
);
void
append
(
BreakpointData
*
data
);
void
initMasterList
();
const
QIcon
m_breakpointIcon
;
const
QIcon
m_disabledBreakpointIcon
;
const
QIcon
m_pendingBreakPointIcon
;
...
...
@@ -128,12 +131,14 @@ private:
const
QIcon
m_watchpointIcon
;
Debugger
::
DebuggerEngine
*
m_engine
;
// Not owned.
Breakpoints
m_bp
;
Breakpoints
*
m_bp
;
Breakpoints
m_inserted
;
// Lately inserted breakpoints.
Breakpoints
m_removed
;
// Lately removed breakpoints.
Breakpoints
m_enabled
;
// Lately enabled breakpoints.
Breakpoints
m_disabled
;
// Lately disabled breakpoints.
bool
m_masterList
;
// Hack for BreakWindow::findSimilarBreakpoint
mutable
BreakpointData
*
m_lastFound
;
mutable
bool
m_lastFoundQueried
;
...
...
src/plugins/debugger/debuggerengine.cpp
View file @
24912c3f
...
...
@@ -1667,6 +1667,11 @@ void DebuggerEngine::attemptBreakpointSynchronization()
{
}
bool
DebuggerEngine
::
acceptsBreakpoint
(
const
BreakpointData
*
)
{
return
true
;
}
void
DebuggerEngine
::
selectThread
(
int
)
{
}
...
...
src/plugins/debugger/debuggerengine.h
View file @
24912c3f
...
...
@@ -129,6 +129,7 @@ class StackFrame;
class
SourceFilesHandler
;
class
ThreadsHandler
;
class
WatchHandler
;
class
BreakpointData
;
struct
WatchUpdateFlags
{
...
...
@@ -182,6 +183,7 @@ public:
virtual
void
updateAll
();
virtual
void
attemptBreakpointSynchronization
();
virtual
bool
acceptsBreakpoint
(
const
Internal
::
BreakpointData
*
);
virtual
void
selectThread
(
int
index
);
virtual
void
assignValueInDebugger
(
const
Internal
::
WatchData
*
w
,
const
QString
&
expr
,
const
QVariant
&
value
);
...
...
src/plugins/debugger/gdb/gdbengine.cpp
View file @
24912c3f
...
...
@@ -2580,6 +2580,11 @@ void GdbEngine::attemptBreakpointSynchronization()
handler
->
updateMarkers
();
}
bool
GdbEngine
::
acceptsBreakpoint
(
const
Internal
::
BreakpointData
*
br
)
{
return
!
(
br
->
fileName
.
endsWith
(
QLatin1String
(
"js"
))
||
br
->
fileName
.
endsWith
(
QLatin1String
(
"qml"
))
);
}
//////////////////////////////////////////////////////////////////////
//
...
...
src/plugins/debugger/gdb/gdbengine.h
View file @
24912c3f
...
...
@@ -309,6 +309,7 @@ private: ////////// Inferior Management //////////
// This should be always the last call in a function.
Q_SLOT
virtual
void
attemptBreakpointSynchronization
();
bool
acceptsBreakpoint
(
const
Internal
::
BreakpointData
*
br
);
virtual
void
executeStep
();
virtual
void
executeStepOut
();
...
...
src/plugins/debugger/qml/qmlcppengine.cpp
View file @
24912c3f
...
...
@@ -222,6 +222,11 @@ void QmlCppEngine::attemptBreakpointSynchronization()
static_cast
<
DebuggerEngine
*>
(
d
->
m_qmlEngine
)
->
attemptBreakpointSynchronization
();
}
bool
QmlCppEngine
::
acceptsBreakpoint
(
const
Internal
::
BreakpointData
*
br
)
{
return
d
->
m_cppEngine
->
acceptsBreakpoint
(
br
)
||
d
->
m_qmlEngine
->
acceptsBreakpoint
(
br
);
}
void
QmlCppEngine
::
selectThread
(
int
index
)
{
d
->
m_cppEngine
->
selectThread
(
index
);
...
...
src/plugins/debugger/qml/qmlcppengine.h
View file @
24912c3f
...
...
@@ -52,6 +52,7 @@ public:
virtual
void
updateAll
();
virtual
void
attemptBreakpointSynchronization
();
virtual
bool
acceptsBreakpoint
(
const
Internal
::
BreakpointData
*
br
);
virtual
void
selectThread
(
int
index
);
virtual
void
assignValueInDebugger
(
const
Internal
::
WatchData
*
w
,
const
QString
&
expr
,
const
QVariant
&
value
);
...
...
src/plugins/debugger/qml/qmlengine.cpp
View file @
24912c3f
...
...
@@ -460,6 +460,11 @@ void QmlEngine::attemptBreakpointSynchronization()
}
}
bool
QmlEngine
::
acceptsBreakpoint
(
const
Internal
::
BreakpointData
*
br
)
{
return
(
br
->
fileName
.
endsWith
(
QLatin1String
(
"qml"
))
||
br
->
fileName
.
endsWith
(
QLatin1String
(
"js"
)));
}
void
QmlEngine
::
loadSymbols
(
const
QString
&
moduleName
)
{
Q_UNUSED
(
moduleName
)
...
...
src/plugins/debugger/qml/qmlengine.h
View file @
24912c3f
...
...
@@ -93,6 +93,7 @@ private:
void
selectThread
(
int
index
);
void
attemptBreakpointSynchronization
();
bool
acceptsBreakpoint
(
const
Internal
::
BreakpointData
*
br
);
void
assignValueInDebugger
(
const
Internal
::
WatchData
*
w
,
const
QString
&
expr
,
const
QVariant
&
value
);
void
loadSymbols
(
const
QString
&
moduleName
);
...
...
Write
Preview
Markdown
is supported
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