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
694503cc
Commit
694503cc
authored
Nov 16, 2010
by
hjk
Browse files
debugger: looks like the BreakpointData layer is going to be unneeded.
parent
3cf3f14d
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/breakhandler.cpp
View file @
694503cc
...
...
@@ -168,18 +168,12 @@ BreakpointId BreakHandler::findBreakpointByFileAndLine(const QString &fileName,
return
BreakpointId
(
-
1
);
}
const
Breakpoint
Data
*
BreakHandler
::
breakpoint
ById
(
BreakpointId
id
)
const
const
Breakpoint
Parameters
&
BreakHandler
::
breakpoint
Data
(
BreakpointId
id
)
const
{
static
BreakpointParameters
dummy
;
ConstIterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
0
);
return
&
it
->
data
;
}
BreakpointData
*
BreakHandler
::
breakpointById
(
BreakpointId
id
)
{
Iterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
0
);
return
&
it
->
data
;
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
dummy
);
return
it
->
data
.
parameters
();
}
BreakpointId
BreakHandler
::
findWatchpointByAddress
(
quint64
address
)
const
...
...
@@ -626,9 +620,9 @@ void BreakHandler::appendBreakpoint(const BreakpointParameters &data)
BreakpointId
id
(
++
currentId
);
BreakpointItem
item
;
BreakpointD
ata
d
;
d
.
m_parameters
=
data
;
item
.
data
=
d
;
item
.
data
.
m_parameters
=
d
ata
;
item
.
markerFileName
=
data
.
fileName
;
item
.
markerLineNumber
=
data
.
lineNumber
;
m_storage
.
insert
(
id
,
item
);
scheduleSynchronization
();
}
...
...
@@ -855,7 +849,7 @@ void BreakHandler::setResponse(BreakpointId id, const BreakpointResponse &data)
updateMarker
(
id
);
}
void
BreakHandler
::
setData
(
BreakpointId
id
,
const
BreakpointParameters
&
data
)
void
BreakHandler
::
set
Breakpoint
Data
(
BreakpointId
id
,
const
BreakpointParameters
&
data
)
{
Iterator
it
=
m_storage
.
find
(
id
);
QTC_ASSERT
(
it
!=
m_storage
.
end
(),
return
);
...
...
src/plugins/debugger/breakhandler.h
View file @
694503cc
...
...
@@ -92,15 +92,11 @@ public:
BreakpointId
findBreakpointByFileAndLine
(
const
QString
&
fileName
,
int
lineNumber
,
bool
useMarkerPosition
=
true
);
BreakpointId
findBreakpointByAddress
(
quint64
address
)
const
;
const
BreakpointData
*
breakpointById
(
BreakpointId
id
)
const
;
BreakpointData
*
breakpointById
(
BreakpointId
id
);
// FIXME: For breakwindow.
void
breakByFunction
(
const
QString
&
functionName
);
void
removeBreakpoint
(
BreakpointId
id
);
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.
...
...
@@ -120,13 +116,14 @@ public:
PROPERTY
(
quint64
,
address
,
setAddress
);
PROPERTY
(
int
,
lineNumber
,
setLineNumber
);
#undef PROPERTY
void
setBreakpointData
(
BreakpointId
id
,
const
BreakpointParameters
&
data
);
const
BreakpointParameters
&
breakpointData
(
BreakpointId
id
)
const
;
BreakpointState
state
(
BreakpointId
id
)
const
;
bool
isEnabled
(
BreakpointId
id
)
const
;
void
setEnabled
(
BreakpointId
id
,
bool
on
);
void
updateLineNumberFromMarker
(
BreakpointId
id
,
int
lineNumber
);
void
setMarkerFileAndLine
(
BreakpointId
id
,
const
QString
&
fileName
,
int
lineNumber
);
DebuggerEngine
*
engine
(
BreakpointId
id
)
const
;
void
setEngine
(
BreakpointId
id
,
DebuggerEngine
*
engine
);
const
BreakpointResponse
&
response
(
BreakpointId
id
)
const
;
...
...
src/plugins/debugger/breakpoint.cpp
View file @
694503cc
...
...
@@ -119,10 +119,10 @@ bool BreakpointData::setCondition(const QByteArray &cond)
#undef SETIT
bool
Breakpoint
Data
::
conditionsMatch
(
const
QByteArray
&
other
)
const
bool
Breakpoint
Parameters
::
conditionsMatch
(
const
QByteArray
&
other
)
const
{
// Some versions of gdb "beautify" the passed condition.
QByteArray
s1
=
m_parameters
.
condition
;
QByteArray
s1
=
condition
;
s1
.
replace
(
' '
,
""
);
QByteArray
s2
=
other
;
s2
.
replace
(
' '
,
""
);
...
...
src/plugins/debugger/breakpoint.h
View file @
694503cc
...
...
@@ -84,6 +84,7 @@ class BreakpointParameters
public:
explicit
BreakpointParameters
(
BreakpointType
=
UnknownType
);
bool
equals
(
const
BreakpointParameters
&
rhs
)
const
;
bool
conditionsMatch
(
const
QByteArray
&
other
)
const
;
BreakpointType
type
;
// Type of breakpoint.
bool
enabled
;
// Should we talk to the debugger engine?
...
...
@@ -118,7 +119,6 @@ public:
bool
useFullPath
()
const
{
return
m_parameters
.
useFullPath
;
}
QString
toString
()
const
;
bool
conditionsMatch
(
const
QByteArray
&
other
)
const
;
QString
functionName
()
const
{
return
m_parameters
.
functionName
;
}
QString
fileName
()
const
{
return
m_parameters
.
fileName
;
}
int
lineNumber
()
const
{
return
m_parameters
.
lineNumber
;
}
...
...
src/plugins/debugger/breakwindow.cpp
View file @
694503cc
...
...
@@ -417,9 +417,9 @@ void BreakWindow::deleteBreakpoints(const QModelIndexList &list)
void
BreakWindow
::
editBreakpoint
(
BreakpointId
id
,
QWidget
*
parent
)
{
BreakpointDialog
dialog
(
parent
);
BreakpointParameters
data
=
breakHandler
()
->
breakpoint
ById
(
id
)
->
parameters
(
);
BreakpointParameters
data
=
breakHandler
()
->
breakpoint
Data
(
id
);
if
(
dialog
.
showDialog
(
&
data
))
breakHandler
()
->
setData
(
id
,
data
);
breakHandler
()
->
set
Breakpoint
Data
(
id
,
data
);
}
void
BreakWindow
::
addBreakpoint
()
...
...
src/plugins/debugger/gdb/gdbengine.cpp
View file @
694503cc
...
...
@@ -2156,32 +2156,30 @@ static QByteArray addressSpec(quint64 address)
QByteArray
GdbEngine
::
breakpointLocation
(
BreakpointId
id
)
{
BreakHandler
*
handler
=
breakHandler
();
const
BreakpointData
*
data
=
handler
->
breakpointById
(
id
);
QTC_ASSERT
(
data
,
return
QByteArray
());
const
BreakpointParameters
parameters
=
data
->
parameters
();
const
BreakpointParameters
&
data
=
handler
->
breakpointData
(
id
);
QTC_ASSERT
(
data
.
type
!=
UnknownType
,
return
QByteArray
());
// FIXME: Non-GCC-runtime
if
(
parameters
.
type
==
BreakpointAtThrow
)
if
(
data
.
type
==
BreakpointAtThrow
)
return
"__cxa_throw"
;
if
(
parameters
.
type
==
BreakpointAtCatch
)
if
(
data
.
type
==
BreakpointAtCatch
)
return
"__cxa_begin_catch"
;
if
(
parameters
.
type
==
BreakpointAtMain
)
if
(
data
.
type
==
BreakpointAtMain
)
#ifdef Q_OS_WIN
return
"qMain"
;
#else
return
"main"
;
#endif
const
QByteArray
functionName
=
parameters
.
functionName
.
toUtf8
();
const
QByteArray
functionName
=
data
.
functionName
.
toUtf8
();
if
(
!
functionName
.
isEmpty
())
return
functionName
;
if
(
const
quint64
address
=
handler
->
address
(
id
)
)
if
(
const
quint64
address
=
data
.
address
)
return
addressSpec
(
address
);
// In this case, data->funcName is something like '*0xdeadbeef'
const
int
lineNumber
=
handler
->
lineNumber
(
id
)
;
const
int
lineNumber
=
data
.
lineNumber
;
if
(
lineNumber
==
0
)
return
functionName
;
const
QString
fileName
=
parameters
.
useFullPath
?
breakLocation
(
parameters
.
fileName
)
:
parameters
.
fileName
;
const
QString
fileName
=
data
.
useFullPath
?
breakLocation
(
data
.
fileName
)
:
data
.
fileName
;
// The argument is simply a C-quoted version of the argument to the
// non-MI "break" command, including the "original" quoting it wants.
return
"
\"\\\"
"
+
GdbMi
::
escapeCString
(
fileName
).
toLocal8Bit
()
+
"
\\\"
:"
...
...
@@ -2622,32 +2620,31 @@ void GdbEngine::insertBreakpoint(BreakpointId id)
void
GdbEngine
::
changeBreakpoint
(
BreakpointId
id
)
{
const
BreakpointData
*
data0
=
breakHandler
()
->
breakpointById
(
id
);
QTC_ASSERT
(
data0
,
return
);
const
BreakpointData
&
data
=
*
data0
;
const
BreakpointParameters
&
data
=
breakHandler
()
->
breakpointData
(
id
);
QTC_ASSERT
(
data
.
type
!=
UnknownType
,
return
);
const
BreakpointResponse
&
response
=
breakHandler
()
->
response
(
id
);
QTC_ASSERT
(
response
.
number
>
0
,
return
);
const
QByteArray
bpnr
=
QByteArray
::
number
(
response
.
number
);
if
(
data
.
condition
()
!=
response
.
condition
if
(
data
.
condition
!=
response
.
condition
&&
!
data
.
conditionsMatch
(
response
.
condition
))
{
// Update conditions if needed.
postCommand
(
"condition "
+
bpnr
+
' '
+
data
.
condition
()
,
postCommand
(
"condition "
+
bpnr
+
' '
+
data
.
condition
,
NeedsStop
|
RebuildBreakpointModel
,
CB
(
handleBreakCondition
),
id
);
}
if
(
data
.
ignoreCount
()
!=
response
.
ignoreCount
)
{
if
(
data
.
ignoreCount
!=
response
.
ignoreCount
)
{
// Update ignorecount if needed.
postCommand
(
"ignore "
+
bpnr
+
' '
+
QByteArray
::
number
(
data
.
ignoreCount
()
),
postCommand
(
"ignore "
+
bpnr
+
' '
+
QByteArray
::
number
(
data
.
ignoreCount
),
NeedsStop
|
RebuildBreakpointModel
,
CB
(
handleBreakIgnore
),
id
);
}
if
(
!
data
.
isE
nabled
()
&&
response
.
enabled
)
{
if
(
!
data
.
e
nabled
&&
response
.
enabled
)
{
postCommand
(
"-break-disable "
+
bpnr
,
NeedsStop
|
RebuildBreakpointModel
,
CB
(
handleBreakDisable
),
id
);
}
if
(
data
.
isE
nabled
()
&&
!
response
.
enabled
)
{
if
(
data
.
e
nabled
&&
!
response
.
enabled
)
{
postCommand
(
"-break-enable "
+
bpnr
,
NeedsStop
|
RebuildBreakpointModel
,
CB
(
handleBreakEnable
),
id
);
...
...
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