Skip to content
GitLab
Menu
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
161e0322
Commit
161e0322
authored
Jul 02, 2010
by
ck
Browse files
BinEditor: Refactor new range requesting.
Also adds the "new range" ability to the debugger's memory viewer.
parent
2c3dd303
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/bineditor/bineditor.cpp
View file @
161e0322
...
...
@@ -453,9 +453,10 @@ void BinEditor::scrollContentsBy(int dx, int dy)
const
QScrollBar
*
const
scrollBar
=
verticalScrollBar
();
const
int
scrollPos
=
scrollBar
->
value
();
if
(
dy
<=
0
&&
scrollPos
==
scrollBar
->
maximum
())
emit
endOfRangeReached
(
editorInterface
());
emit
newRangeRequested
(
editorInterface
(),
baseAddress
()
+
dataSize
());
else
if
(
dy
>=
0
&&
scrollPos
==
scrollBar
->
minimum
())
emit
startOf
RangeRe
ach
ed
(
editorInterface
());
emit
new
RangeRe
quest
ed
(
editorInterface
()
,
baseAddress
()
);
}
}
...
...
@@ -1025,7 +1026,8 @@ bool BinEditor::event(QEvent *e) {
if
(
m_inLazyMode
)
{
const
QScrollBar
*
const
scrollBar
=
verticalScrollBar
();
if
(
scrollBar
->
value
()
>=
scrollBar
->
maximum
()
-
1
)
{
emit
endOfRangeReached
(
editorInterface
());
emit
newRangeRequested
(
editorInterface
(),
baseAddress
()
+
dataSize
());
return
true
;
}
}
...
...
@@ -1303,9 +1305,9 @@ void BinEditor::contextMenuEvent(QContextMenuEvent *event)
else
if
(
action
==
&
copyHexAction
)
copy
(
false
);
else
if
(
action
==
&
jumpToBeAddressHere
)
setCursorPosition
(
beAddress
-
m_bas
eAddr
);
jumpToAddress
(
b
eAddr
ess
);
else
if
(
action
==
&
jumpToLeAddressHere
)
setCursorPosition
(
leAddress
-
m_baseAddr
);
jumpToAddress
(
leAddress
);
else
if
(
action
==
&
jumpToBeAddressNewWindow
)
emit
newWindowRequested
(
beAddress
);
else
if
(
action
==
&
jumpToLeAddressNewWindow
)
...
...
@@ -1321,12 +1323,18 @@ void BinEditor::setupJumpToMenuAction(QMenu *menu, QAction *actionHere,
.
arg
(
QString
::
number
(
addr
,
16
)));
menu
->
addAction
(
actionHere
);
menu
->
addAction
(
actionNew
);
if
(
addr
<
m_baseAddr
||
addr
>=
m_baseAddr
+
m_size
)
actionHere
->
setEnabled
(
false
);
if
(
!
m_canRequestNewWindow
)
actionNew
->
setEnabled
(
false
);
}
void
BinEditor
::
jumpToAddress
(
quint64
address
)
{
if
(
address
>=
m_baseAddr
&&
address
<
m_baseAddr
+
m_data
.
size
())
setCursorPosition
(
address
-
m_baseAddr
);
else
emit
newRangeRequested
(
editorInterface
(),
address
);
}
void
BinEditor
::
setNewWindowRequestAllowed
()
{
m_canRequestNewWindow
=
true
;
...
...
src/plugins/bineditor/bineditor.h
View file @
161e0322
...
...
@@ -131,8 +131,7 @@ Q_SIGNALS:
void
lazyDataRequested
(
Core
::
IEditor
*
editor
,
quint64
block
,
bool
synchronous
);
void
newWindowRequested
(
quint64
address
);
void
startOfRangeReached
(
Core
::
IEditor
*
editor
);
void
endOfRangeReached
(
Core
::
IEditor
*
editor
);
void
newRangeRequested
(
Core
::
IEditor
*
,
quint64
address
);
protected:
void
scrollContentsBy
(
int
dx
,
int
dy
);
...
...
@@ -213,6 +212,7 @@ private:
void
setupJumpToMenuAction
(
QMenu
*
menu
,
QAction
*
actionHere
,
QAction
*
actionNew
,
quint64
addr
);
void
jumpToAddress
(
quint64
address
);
struct
BinEditorEditCommand
{
int
position
;
...
...
src/plugins/bineditor/bineditorplugin.cpp
View file @
161e0322
...
...
@@ -179,10 +179,8 @@ public:
m_editor
=
parent
;
connect
(
m_editor
,
SIGNAL
(
lazyDataRequested
(
Core
::
IEditor
*
,
quint64
,
bool
)),
this
,
SLOT
(
provideData
(
Core
::
IEditor
*
,
quint64
)));
connect
(
m_editor
,
SIGNAL
(
startOfRangeReached
(
Core
::
IEditor
*
)),
this
,
SLOT
(
handleStartOfRangeReached
()));
connect
(
m_editor
,
SIGNAL
(
endOfRangeReached
(
Core
::
IEditor
*
)),
this
,
SLOT
(
handleEndOfRangeReached
()));
connect
(
m_editor
,
SIGNAL
(
newRangeRequested
(
Core
::
IEditor
*
,
quint64
)),
this
,
SLOT
(
provideNewRange
(
Core
::
IEditor
*
,
quint64
)));
}
~
BinEditorFile
()
{}
...
...
@@ -202,7 +200,8 @@ public:
bool
open
(
const
QString
&
fileName
,
quint64
offset
=
0
)
{
QFile
file
(
fileName
);
if
(
file
.
open
(
QIODevice
::
ReadOnly
))
{
if
(
offset
<
static_cast
<
quint64
>
(
file
.
size
())
&&
file
.
open
(
QIODevice
::
ReadOnly
))
{
m_fileName
=
fileName
;
qint64
maxRange
=
64
*
1024
*
1024
;
if
(
file
.
isSequential
()
&&
file
.
size
()
<=
maxRange
)
{
...
...
@@ -233,20 +232,8 @@ private slots:
}
}
void
handleStartOfRangeReached
()
{
if
(
m_editor
->
baseAddress
()
!=
0
)
{
open
(
m_fileName
,
m_editor
->
baseAddress
());
}
}
void
handleEndOfRangeReached
()
{
const
quint64
currentEndAdress
=
m_editor
->
baseAddress
()
+
m_editor
->
dataSize
();
if
(
currentEndAdress
<
static_cast
<
quint64
>
(
QFileInfo
(
m_fileName
).
size
()))
open
(
m_fileName
,
currentEndAdress
);
void
provideNewRange
(
Core
::
IEditor
*
,
quint64
offset
)
{
open
(
m_fileName
,
offset
);
}
public:
...
...
src/plugins/debugger/debuggeragents.cpp
View file @
161e0322
...
...
@@ -105,6 +105,9 @@ void MemoryViewAgent::createBinEditor(quint64 addr)
this
,
SLOT
(
fetchLazyData
(
Core
::
IEditor
*
,
quint64
,
bool
)));
connect
(
editor
->
widget
(),
SIGNAL
(
newWindowRequested
(
quint64
)),
this
,
SLOT
(
createBinEditor
(
quint64
)));
connect
(
editor
->
widget
(),
SIGNAL
(
newRangeRequested
(
Core
::
IEditor
*
,
quint64
)),
this
,
SLOT
(
provideNewRange
(
Core
::
IEditor
*
,
quint64
)));
m_editors
<<
editor
;
editorManager
->
activateEditor
(
editor
);
QMetaObject
::
invokeMethod
(
editor
->
widget
(),
"setNewWindowRequestAllowed"
);
...
...
@@ -137,6 +140,13 @@ void MemoryViewAgent::addLazyData(QObject *editorToken, quint64 addr,
}
}
void
MemoryViewAgent
::
provideNewRange
(
Core
::
IEditor
*
editor
,
quint64
address
)
{
QMetaObject
::
invokeMethod
(
editor
->
widget
(),
"setLazyData"
,
Q_ARG
(
quint64
,
address
),
Q_ARG
(
int
,
1024
*
1024
),
Q_ARG
(
int
,
BinBlockSize
));
}
///////////////////////////////////////////////////////////////////////
//
...
...
src/plugins/debugger/debuggeragents.h
View file @
161e0322
...
...
@@ -59,11 +59,11 @@ public:
public
slots
:
// Called from Engine
void
addLazyData
(
QObject
*
editorToken
,
quint64
addr
,
const
QByteArray
&
data
);
// Called from Editor
void
fetchLazyData
(
Core
::
IEditor
*
,
quint64
block
,
bool
sync
);
private:
Q_SLOT
void
createBinEditor
(
quint64
startAddr
);
Q_SLOT
void
fetchLazyData
(
Core
::
IEditor
*
,
quint64
block
,
bool
sync
);
Q_SLOT
void
provideNewRange
(
Core
::
IEditor
*
editor
,
quint64
address
);
QPointer
<
IDebuggerEngine
>
m_engine
;
QList
<
QPointer
<
Core
::
IEditor
>
>
m_editors
;
...
...
Write
Preview
Supports
Markdown
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