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
3cf3f14d
Commit
3cf3f14d
authored
Nov 16, 2010
by
hjk
Browse files
debugger: more breakpoint refactoring
parent
62c7a110
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/breakhandler.cpp
View file @
3cf3f14d
...
...
@@ -195,8 +195,8 @@ void BreakHandler::setWatchpointByAddress(quint64 address)
{
const
int
id
=
findWatchpointByAddress
(
address
);
if
(
id
==
-
1
)
{
Breakpoint
Data
data
(
Watchpoint
);
data
.
setA
ddress
(
address
)
;
Breakpoint
Parameters
data
(
Watchpoint
);
data
.
a
ddress
=
address
;
appendBreakpoint
(
data
);
scheduleSynchronization
();
}
else
{
...
...
@@ -257,39 +257,37 @@ void BreakHandler::loadBreakpoints()
//clear();
foreach
(
const
QVariant
&
var
,
list
)
{
const
QMap
<
QString
,
QVariant
>
map
=
var
.
toMap
();
Breakpoint
Data
data
(
BreakpointByFileAndLine
);
Breakpoint
Parameters
data
(
BreakpointByFileAndLine
);
QVariant
v
=
map
.
value
(
_
(
"filename"
));
if
(
v
.
isValid
())
data
.
setF
ileName
(
v
.
toString
()
)
;
data
.
f
ileName
=
v
.
toString
();
v
=
map
.
value
(
_
(
"linenumber"
));
if
(
v
.
isValid
())
data
.
setL
ineNumber
(
v
.
toString
().
toInt
()
)
;
data
.
l
ineNumber
=
v
.
toString
().
toInt
();
v
=
map
.
value
(
_
(
"condition"
));
if
(
v
.
isValid
())
data
.
setC
ondition
(
v
.
toString
().
toLatin1
()
)
;
data
.
c
ondition
=
v
.
toString
().
toLatin1
();
v
=
map
.
value
(
_
(
"address"
));
if
(
v
.
isValid
())
data
.
setA
ddress
(
v
.
toString
().
toULongLong
()
)
;
data
.
a
ddress
=
v
.
toString
().
toULongLong
();
v
=
map
.
value
(
_
(
"ignorecount"
));
if
(
v
.
isValid
())
data
.
setI
gnoreCount
(
v
.
toString
().
toInt
()
)
;
data
.
i
gnoreCount
=
v
.
toString
().
toInt
();
v
=
map
.
value
(
_
(
"threadspec"
));
if
(
v
.
isValid
())
data
.
setT
hreadSpec
(
v
.
toString
().
toLatin1
()
)
;
data
.
t
hreadSpec
=
v
.
toString
().
toLatin1
();
v
=
map
.
value
(
_
(
"funcname"
));
if
(
v
.
isValid
())
data
.
setF
unctionName
(
v
.
toString
()
)
;
data
.
f
unctionName
=
v
.
toString
();
v
=
map
.
value
(
_
(
"disabled"
));
if
(
v
.
isValid
())
data
.
setE
nabled
(
!
v
.
toInt
()
)
;
data
.
e
nabled
=
!
v
.
toInt
();
v
=
map
.
value
(
_
(
"usefullpath"
));
if
(
v
.
isValid
())
data
.
setU
seFullPath
(
bool
(
v
.
toInt
())
)
;
data
.
u
seFullPath
=
bool
(
v
.
toInt
());
v
=
map
.
value
(
_
(
"type"
));
if
(
v
.
isValid
()
&&
v
.
toInt
()
!=
UnknownType
)
data
.
setType
(
BreakpointType
(
v
.
toInt
()));
data
.
setMarkerFileName
(
data
.
fileName
());
data
.
setMarkerLineNumber
(
data
.
lineNumber
());
data
.
type
=
BreakpointType
(
v
.
toInt
());
appendBreakpoint
(
data
);
}
//qDebug() << "LOADED BREAKPOINTS" << this << list.size();
...
...
@@ -618,9 +616,9 @@ void BreakHandler::removeBreakpoint(BreakpointId id)
}
}
void
BreakHandler
::
appendBreakpoint
(
const
Breakpoint
Data
&
data
)
void
BreakHandler
::
appendBreakpoint
(
const
Breakpoint
Parameters
&
data
)
{
QTC_ASSERT
(
data
.
type
()
!=
UnknownType
,
return
);
QTC_ASSERT
(
data
.
type
!=
UnknownType
,
return
);
// Ok to be not thread-safe. The order does not matter and only the gui
// produces authoritative ids.
...
...
@@ -628,7 +626,9 @@ void BreakHandler::appendBreakpoint(const BreakpointData &data)
BreakpointId
id
(
++
currentId
);
BreakpointItem
item
;
item
.
data
=
data
;
BreakpointData
d
;
d
.
m_parameters
=
data
;
item
.
data
=
d
;
m_storage
.
insert
(
id
,
item
);
scheduleSynchronization
();
}
...
...
@@ -649,17 +649,15 @@ void BreakHandler::toggleBreakpoint(const QString &fileName, int lineNumber,
if
(
id
!=
BreakpointId
(
-
1
))
{
removeBreakpoint
(
id
);
}
else
{
Breakpoint
Data
data
;
Breakpoint
Parameters
data
;
if
(
address
)
{
data
.
setType
(
BreakpointByAddress
)
;
data
.
setA
ddress
(
address
)
;
data
.
type
=
BreakpointByAddress
;
data
.
a
ddress
=
address
;
}
else
{
data
.
setType
(
BreakpointByFileAndLine
)
;
data
.
setF
ileName
(
fileName
)
;
data
.
setL
ineNumber
(
lineNumber
)
;
data
.
type
=
BreakpointByFileAndLine
;
data
.
f
ileName
=
fileName
;
data
.
l
ineNumber
=
lineNumber
;
}
data
.
setMarkerFileName
(
fileName
);
data
.
setMarkerLineNumber
(
lineNumber
);
appendBreakpoint
(
data
);
}
debuggerCore
()
->
synchronizeBreakpoints
();
...
...
@@ -688,8 +686,8 @@ void BreakHandler::breakByFunction(const QString &functionName)
&&
data
.
ignoreCount
()
==
0
)
return
;
}
Breakpoint
Data
data
(
BreakpointByFunction
);
data
.
setF
unctionName
(
functionName
)
;
Breakpoint
Parameters
data
(
BreakpointByFunction
);
data
.
f
unctionName
=
functionName
;
appendBreakpoint
(
data
);
}
...
...
@@ -857,6 +855,16 @@ void BreakHandler::setResponse(BreakpointId id, const BreakpointResponse &data)
updateMarker
(
id
);
}
void
BreakHandler
::
setData
(
BreakpointId
id
,
const
BreakpointParameters
&
data
)
{
Iterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
);
if
(
data
==
it
->
data
.
m_parameters
)
return
;
it
->
data
.
m_parameters
=
data
;
updateMarker
(
id
);
layoutChanged
();
}
//////////////////////////////////////////////////////////////////
//
...
...
src/plugins/debugger/breakhandler.h
View file @
3cf3f14d
...
...
@@ -65,7 +65,7 @@ public:
QAbstractItemModel
*
model
()
{
return
this
;
}
// The only way to add a new breakpoint.
void
appendBreakpoint
(
const
Breakpoint
Data
&
data
);
void
appendBreakpoint
(
const
Breakpoint
Parameters
&
data
);
BreakpointIds
allBreakpointIds
()
const
;
BreakpointIds
engineBreakpointIds
(
DebuggerEngine
*
engine
)
const
;
...
...
@@ -100,6 +100,7 @@ public:
QIcon
icon
(
BreakpointId
id
)
const
;
void
gotoLocation
(
BreakpointId
id
)
const
;
void
setData
(
BreakpointId
id
,
const
BreakpointParameters
&
data
);
// Getter retrieves property value.
// Setter sets property value and triggers update if changed.
...
...
src/plugins/debugger/breakwindow.cpp
View file @
3cf3f14d
...
...
@@ -67,7 +67,7 @@ class BreakpointDialog : public QDialog, public Ui::BreakpointDialog
Q_OBJECT
public:
explicit
BreakpointDialog
(
QWidget
*
parent
);
bool
showDialog
(
Breakpoint
Data
*
data
);
bool
showDialog
(
Breakpoint
Parameters
*
data
);
void
setParameters
(
const
BreakpointParameters
&
p
);
BreakpointParameters
parameters
()
const
;
...
...
@@ -160,28 +160,19 @@ void BreakpointDialog::typeChanged(int)
lineEditFunction
->
setText
(
QLatin1String
(
"main"
));
}
bool
BreakpointDialog
::
showDialog
(
Breakpoint
Data
*
data
)
bool
BreakpointDialog
::
showDialog
(
Breakpoint
Parameters
*
data
)
{
setParameters
(
data
->
parameters
()
);
setParameters
(
*
data
);
if
(
exec
()
!=
QDialog
::
Accepted
)
return
false
;
// Check if changed.
const
BreakpointParameters
newParameters
=
parameters
();
if
(
newParameters
==
data
->
p
arameters
(
))
if
(
data
->
equals
(
newP
arameters
))
return
false
;
bool
result
=
false
;
result
|=
data
->
setType
(
newParameters
.
type
);
result
|=
data
->
setAddress
(
newParameters
.
address
);
result
|=
data
->
setFunctionName
(
newParameters
.
functionName
);
result
|=
data
->
setUseFullPath
(
newParameters
.
useFullPath
);
result
|=
data
->
setFileName
(
newParameters
.
fileName
);
result
|=
data
->
setLineNumber
(
newParameters
.
lineNumber
);
result
|=
data
->
setCondition
(
newParameters
.
condition
);
result
|=
data
->
setIgnoreCount
(
newParameters
.
ignoreCount
);
result
|=
data
->
setThreadSpec
(
newParameters
.
threadSpec
);
return
result
;
*
data
=
newParameters
;
return
true
;
}
///////////////////////////////////////////////////////////////////////
...
...
@@ -396,11 +387,10 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
setBreakpointsEnabled
(
si
,
!
enabled
);
else
if
(
act
==
addBreakpointAction
)
addBreakpoint
();
else
if
(
act
==
breakAtThrowAction
)
{
handler
->
appendBreakpoint
(
BreakpointData
(
BreakpointAtThrow
));
}
else
if
(
act
==
breakAtCatchAction
)
{
handler
->
appendBreakpoint
(
BreakpointData
(
BreakpointAtCatch
));
}
else
if
(
act
==
breakAtThrowAction
)
handler
->
appendBreakpoint
(
BreakpointParameters
(
BreakpointAtThrow
));
else
if
(
act
==
breakAtCatchAction
)
handler
->
appendBreakpoint
(
BreakpointParameters
(
BreakpointAtCatch
));
}
void
BreakWindow
::
setBreakpointsEnabled
(
const
QModelIndexList
&
list
,
bool
enabled
)
...
...
@@ -427,12 +417,14 @@ void BreakWindow::deleteBreakpoints(const QModelIndexList &list)
void
BreakWindow
::
editBreakpoint
(
BreakpointId
id
,
QWidget
*
parent
)
{
BreakpointDialog
dialog
(
parent
);
dialog
.
showDialog
(
breakHandler
()
->
breakpointById
(
id
));
BreakpointParameters
data
=
breakHandler
()
->
breakpointById
(
id
)
->
parameters
();
if
(
dialog
.
showDialog
(
&
data
))
breakHandler
()
->
setData
(
id
,
data
);
}
void
BreakWindow
::
addBreakpoint
()
{
Breakpoint
Data
data
(
BreakpointByFileAndLine
);
Breakpoint
Parameters
data
(
BreakpointByFileAndLine
);
BreakpointDialog
dialog
(
this
);
if
(
dialog
.
showDialog
(
&
data
))
breakHandler
()
->
appendBreakpoint
(
data
);
...
...
src/plugins/debugger/lldb/ipcenginehost.cpp
View file @
3cf3f14d
...
...
@@ -62,7 +62,7 @@ IPCEngineHost::IPCEngineHost (const DebuggerStartParameters &startParameters)
,
m_cookie
(
1
)
,
m_device
(
0
)
{
connect
(
this
,
SIGNAL
(
stateChanged
(
const
DebuggerState
&
)),
this
,
SLOT
(
m_stateChanged
(
const
DebuggerState
&
)));
connect
(
this
,
SIGNAL
(
stateChanged
(
DebuggerState
)),
this
,
SLOT
(
m_stateChanged
(
DebuggerState
)));
}
IPCEngineHost
::~
IPCEngineHost
()
...
...
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