Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
abdc85f0
Commit
abdc85f0
authored
Aug 13, 2009
by
hjk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugger: register view cosmetics
Show the current number base in the view.
parent
6fd0433c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
65 additions
and
175 deletions
+65
-175
src/plugins/debugger/cdb/cdbdebugengine.cpp
src/plugins/debugger/cdb/cdbdebugengine.cpp
+1
-20
src/plugins/debugger/debuggeractions.cpp
src/plugins/debugger/debuggeractions.cpp
+1
-73
src/plugins/debugger/debuggeractions.h
src/plugins/debugger/debuggeractions.h
+0
-15
src/plugins/debugger/debuggerplugin.cpp
src/plugins/debugger/debuggerplugin.cpp
+1
-14
src/plugins/debugger/gdb/gdbengine.cpp
src/plugins/debugger/gdb/gdbengine.cpp
+1
-20
src/plugins/debugger/registerhandler.cpp
src/plugins/debugger/registerhandler.cpp
+26
-5
src/plugins/debugger/registerhandler.h
src/plugins/debugger/registerhandler.h
+3
-1
src/plugins/debugger/registerwindow.cpp
src/plugins/debugger/registerwindow.cpp
+32
-27
No files found.
src/plugins/debugger/cdb/cdbdebugengine.cpp
View file @
abdc85f0
...
...
@@ -1320,28 +1320,9 @@ QList<Symbol> CdbDebugEngine::moduleSymbols(const QString &moduleName)
return
rc
;
}
static
inline
int
registerFormatBase
()
{
switch
(
checkedRegisterFormatAction
())
{
case
FormatHexadecimal
:
return
16
;
case
FormatDecimal
:
return
10
;
case
FormatOctal
:
return
8
;
case
FormatBinary
:
return
2
;
break
;
case
FormatRaw
:
case
FormatNatural
:
break
;
}
return
10
;
}
void
CdbDebugEngine
::
reloadRegisters
()
{
const
int
intBase
=
registerFormatBase
()
;
const
int
intBase
=
10
;
if
(
debugCDB
)
qDebug
()
<<
Q_FUNC_INFO
<<
intBase
;
QList
<
Register
>
registers
;
...
...
src/plugins/debugger/debuggeractions.cpp
View file @
abdc85f0
...
...
@@ -36,7 +36,6 @@
#include <QtCore/QSettings>
#include <QtGui/QAction>
#include <QtGui/QActionGroup>
#include <QtGui/QAbstractButton>
#include <QtGui/QRadioButton>
#include <QtGui/QCheckBox>
...
...
@@ -54,7 +53,7 @@ namespace Internal {
//////////////////////////////////////////////////////////////////////////
DebuggerSettings
::
DebuggerSettings
(
QObject
*
parent
)
:
QObject
(
parent
)
,
m_registerFormatGroup
(
0
)
:
QObject
(
parent
)
{}
DebuggerSettings
::~
DebuggerSettings
()
...
...
@@ -222,68 +221,6 @@ DebuggerSettings *DebuggerSettings::instance()
instance
->
insertItem
(
SynchronizeBreakpoints
,
item
);
//
// Registers
//
instance
->
m_registerFormatGroup
=
new
QActionGroup
(
instance
);
instance
->
m_registerFormatGroup
->
setExclusive
(
true
);
item
=
new
SavedAction
(
instance
);
item
->
setText
(
tr
(
"Hexadecimal"
));
item
->
setCheckable
(
true
);
item
->
setSettingsKey
(
debugModeGroup
,
QLatin1String
(
"FormatHexadecimal"
));
item
->
setChecked
(
true
);
item
->
setDefaultValue
(
false
);
item
->
setData
(
FormatHexadecimal
);
instance
->
insertItem
(
FormatHexadecimal
,
item
);
instance
->
m_registerFormatGroup
->
addAction
(
item
);
item
=
new
SavedAction
(
instance
);
item
->
setText
(
tr
(
"Decimal"
));
item
->
setCheckable
(
true
);
item
->
setSettingsKey
(
debugModeGroup
,
QLatin1String
(
"FormatDecimal"
));
item
->
setDefaultValue
(
false
);
item
->
setData
(
FormatDecimal
);
instance
->
insertItem
(
FormatDecimal
,
item
);
instance
->
m_registerFormatGroup
->
addAction
(
item
);
item
=
new
SavedAction
(
instance
);
item
->
setText
(
tr
(
"Octal"
));
item
->
setCheckable
(
true
);
item
->
setSettingsKey
(
debugModeGroup
,
QLatin1String
(
"FormatOctal"
));
item
->
setDefaultValue
(
false
);
item
->
setData
(
FormatOctal
);
instance
->
insertItem
(
FormatOctal
,
item
);
instance
->
m_registerFormatGroup
->
addAction
(
item
);
item
=
new
SavedAction
(
instance
);
item
->
setText
(
tr
(
"Binary"
));
item
->
setCheckable
(
true
);
item
->
setSettingsKey
(
debugModeGroup
,
QLatin1String
(
"FormatBinary"
));
item
->
setDefaultValue
(
false
);
item
->
setData
(
FormatBinary
);
instance
->
insertItem
(
FormatBinary
,
item
);
instance
->
m_registerFormatGroup
->
addAction
(
item
);
item
=
new
SavedAction
(
instance
);
item
->
setText
(
tr
(
"Raw"
));
item
->
setCheckable
(
true
);
item
->
setSettingsKey
(
debugModeGroup
,
QLatin1String
(
"FormatRaw"
));
item
->
setDefaultValue
(
false
);
item
->
setData
(
FormatRaw
);
instance
->
insertItem
(
FormatRaw
,
item
);
instance
->
m_registerFormatGroup
->
addAction
(
item
);
item
=
new
SavedAction
(
instance
);
item
->
setText
(
tr
(
"Natural"
));
item
->
setCheckable
(
true
);
item
->
setSettingsKey
(
debugModeGroup
,
QLatin1String
(
"FormatNatural"
));
item
->
setDefaultValue
(
true
);
item
->
setData
(
FormatNatural
);
instance
->
insertItem
(
FormatNatural
,
item
);
instance
->
m_registerFormatGroup
->
addAction
(
item
);
//
// Settings
//
...
...
@@ -373,10 +310,6 @@ DebuggerSettings *DebuggerSettings::instance()
return
instance
;
}
int
DebuggerSettings
::
checkedRegisterFormatAction
()
const
{
return
m_registerFormatGroup
->
checkedAction
()
->
data
().
toInt
();
}
//////////////////////////////////////////////////////////////////////////
//
...
...
@@ -389,11 +322,6 @@ SavedAction *theDebuggerAction(int code)
return
DebuggerSettings
::
instance
()
->
item
(
code
);
}
int
checkedRegisterFormatAction
()
{
return
DebuggerSettings
::
instance
()
->
checkedRegisterFormatAction
();
}
bool
theDebuggerBoolSetting
(
int
code
)
{
return
DebuggerSettings
::
instance
()
->
item
(
code
)
->
value
().
toBool
();
...
...
src/plugins/debugger/debuggeractions.h
View file @
abdc85f0
...
...
@@ -55,16 +55,12 @@ public:
static
DebuggerSettings
*
instance
();
// Return one of FormatHexadecimal, FormatDecimal,...
int
checkedRegisterFormatAction
()
const
;
public
slots
:
void
readSettings
(
QSettings
*
settings
);
void
writeSettings
(
QSettings
*
settings
)
const
;
private:
QHash
<
int
,
Core
::
Utils
::
SavedAction
*>
m_items
;
QActionGroup
*
m_registerFormatGroup
;
};
...
...
@@ -120,22 +116,11 @@ enum DebuggerActionCode
SelectedPluginBreakpoints
,
NoPluginBreakpoints
,
SelectedPluginBreakpointsPattern
,
// Registers
FormatHexadecimal
,
FormatDecimal
,
FormatOctal
,
FormatBinary
,
FormatRaw
,
FormatNatural
,
};
// singleton access
Core
::
Utils
::
SavedAction
*
theDebuggerAction
(
int
code
);
// Return one of FormatHexadecimal, FormatDecimal,...
int
checkedRegisterFormatAction
();
// convenience
bool
theDebuggerBoolSetting
(
int
code
);
QString
theDebuggerStringSetting
(
int
code
);
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
abdc85f0
...
...
@@ -762,20 +762,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
connect
(
resetToSimpleAction
,
SIGNAL
(
triggered
()),
m_manager
,
SLOT
(
setSimpleDockWidgetArrangement
()));
connect
(
theDebuggerAction
(
FormatHexadecimal
),
SIGNAL
(
triggered
()),
m_manager
,
SLOT
(
reloadRegisters
()));
connect
(
theDebuggerAction
(
FormatDecimal
),
SIGNAL
(
triggered
()),
m_manager
,
SLOT
(
reloadRegisters
()));
connect
(
theDebuggerAction
(
FormatOctal
),
SIGNAL
(
triggered
()),
m_manager
,
SLOT
(
reloadRegisters
()));
connect
(
theDebuggerAction
(
FormatBinary
),
SIGNAL
(
triggered
()),
m_manager
,
SLOT
(
reloadRegisters
()));
connect
(
theDebuggerAction
(
FormatRaw
),
SIGNAL
(
triggered
()),
m_manager
,
SLOT
(
reloadRegisters
()));
connect
(
theDebuggerAction
(
FormatNatural
),
SIGNAL
(
triggered
()),
m_manager
,
SLOT
(
reloadRegisters
()));
// FIXME:
// FIXME:
addAutoReleasedObject
(
new
CommonOptionsPage
);
addAutoReleasedObject
(
new
DebuggingHelperOptionPage
);
foreach
(
Core
::
IOptionsPage
*
op
,
engineOptionPages
)
...
...
src/plugins/debugger/gdb/gdbengine.cpp
View file @
abdc85f0
...
...
@@ -2652,28 +2652,9 @@ void GdbEngine::handleStackListThreads(const GdbResultRecord &record, const QVar
//
//////////////////////////////////////////////////////////////////////
static
inline
char
registerFormatChar
()
{
switch
(
checkedRegisterFormatAction
())
{
case
FormatHexadecimal
:
return
'x'
;
case
FormatDecimal
:
return
'd'
;
case
FormatOctal
:
return
'o'
;
case
FormatBinary
:
return
't'
;
case
FormatRaw
:
return
'r'
;
default:
break
;
}
return
'N'
;
}
void
GdbEngine
::
reloadRegisters
()
{
postCommand
(
_
(
"-data-list-register-values
"
)
+
_c
(
registerFormatChar
()
),
postCommand
(
_
(
"-data-list-register-values
d"
),
Discardable
,
CB
(
handleRegisterListValues
));
}
...
...
src/plugins/debugger/registerhandler.cpp
View file @
abdc85f0
...
...
@@ -50,8 +50,9 @@ using namespace Debugger::Constants;
//////////////////////////////////////////////////////////////////
RegisterHandler
::
RegisterHandler
(
QObject
*
parent
)
:
QAbstractTableModel
(
parent
)
{}
:
QAbstractTableModel
(
parent
),
m_base
(
16
)
{
}
int
RegisterHandler
::
rowCount
(
const
QModelIndex
&
parent
)
const
{
...
...
@@ -66,19 +67,33 @@ int RegisterHandler::columnCount(const QModelIndex &parent) const
QVariant
RegisterHandler
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
static
const
QVariant
red
=
QColor
(
200
,
0
,
0
);
if
(
role
==
Qt
::
UserRole
)
return
m_base
;
if
(
!
index
.
isValid
()
||
index
.
row
()
>=
m_registers
.
size
())
return
QVariant
();
const
Register
&
reg
=
m_registers
.
at
(
index
.
row
());
const
QString
padding
=
" "
;
if
(
role
==
Qt
::
DisplayRole
)
{
switch
(
index
.
column
())
{
case
0
:
return
reg
.
name
;
case
1
:
return
reg
.
value
;
case
0
:
return
padding
+
reg
.
name
+
padding
;
case
1
:
{
bool
ok
=
true
;
qulonglong
value
=
reg
.
value
.
toULongLong
(
&
ok
,
0
);
return
padding
+
QString
::
number
(
value
,
m_base
)
+
padding
;
}
}
}
if
(
role
==
Qt
::
TextAlignmentRole
&&
index
.
column
()
==
1
)
return
Qt
::
AlignRight
;
if
(
role
==
Qt
::
TextColorRole
&&
reg
.
changed
&&
index
.
column
()
==
1
)
return
red
;
return
QVariant
();
}
...
...
@@ -88,7 +103,7 @@ QVariant RegisterHandler::headerData(int section, Qt::Orientation orientation,
if
(
orientation
==
Qt
::
Horizontal
&&
role
==
Qt
::
DisplayRole
)
{
switch
(
section
)
{
case
0
:
return
tr
(
"Name"
);
case
1
:
return
tr
(
"Value
"
);
case
1
:
return
tr
(
"Value
(base %1)"
).
arg
(
m_base
);
};
}
return
QVariant
();
...
...
@@ -115,3 +130,9 @@ QList<Register> RegisterHandler::registers() const
{
return
m_registers
;
}
void
RegisterHandler
::
setNumberBase
(
int
base
)
{
m_base
=
base
;
emit
reset
();
}
src/plugins/debugger/registerhandler.h
View file @
abdc85f0
...
...
@@ -60,6 +60,7 @@ public:
void
setRegisters
(
const
QList
<
Register
>
&
registers
);
QList
<
Register
>
registers
()
const
;
void
removeAll
();
Q_SLOT
void
setNumberBase
(
int
base
);
private:
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
...
...
@@ -67,8 +68,9 @@ private:
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
;
QVariant
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
int
role
=
Qt
::
DisplayRole
)
const
;
QList
<
Register
>
m_registers
;
int
m_base
;
};
}
// namespace Internal
...
...
src/plugins/debugger/registerwindow.cpp
View file @
abdc85f0
...
...
@@ -67,46 +67,51 @@ void RegisterWindow::resizeEvent(QResizeEvent *ev)
void
RegisterWindow
::
contextMenuEvent
(
QContextMenuEvent
*
ev
)
{
enum
{
Adjust
,
AlwaysAdjust
,
Reload
,
AlwaysReload
,
Count
};
QMenu
menu
;
QAction
*
actions
[
Count
];
//QString format = model()->property(PROPERTY_REGISTER_FORMAT).toString();
//qDebug() << "FORMAT: " << format;
actions
[
Adjust
]
=
menu
.
addAction
(
tr
(
"Adjust column widths to contents"
));
actions
[
AlwaysAdjust
]
=
menu
.
addAction
(
tr
(
"Always adjust column widths to contents"
));
actions
[
AlwaysAdjust
]
->
setCheckable
(
true
);
actions
[
AlwaysAdjust
]
->
setChecked
(
m_alwaysResizeColumnsToContents
);
actions
[
Reload
]
=
menu
.
addAction
(
tr
(
"Reload register listing"
));
actions
[
AlwaysReload
]
=
menu
.
addAction
(
tr
(
"Always reload register listing"
));
actions
[
AlwaysReload
]
->
setCheckable
(
true
);
actions
[
AlwaysReload
]
->
setChecked
(
m_alwaysReloadContents
);
QAction
*
actAdjust
=
menu
.
addAction
(
tr
(
"Adjust column widths to contents"
));
QAction
*
actAlwaysAdjust
=
menu
.
addAction
(
tr
(
"Always adjust column widths to contents"
));
actAlwaysAdjust
->
setCheckable
(
true
);
actAlwaysAdjust
->
setChecked
(
m_alwaysResizeColumnsToContents
);
QAction
*
actReload
=
menu
.
addAction
(
tr
(
"Reload register listing"
));
QAction
*
actAlwaysReload
=
menu
.
addAction
(
tr
(
"Always reload register listing"
));
actAlwaysReload
->
setCheckable
(
true
);
actAlwaysReload
->
setChecked
(
m_alwaysReloadContents
);
menu
.
addSeparator
();
menu
.
addAction
(
theDebuggerAction
(
FormatHexadecimal
));
menu
.
addAction
(
theDebuggerAction
(
FormatDecimal
));
menu
.
addAction
(
theDebuggerAction
(
FormatOctal
));
menu
.
addAction
(
theDebuggerAction
(
FormatBinary
));
menu
.
addAction
(
theDebuggerAction
(
FormatRaw
));
menu
.
addAction
(
theDebuggerAction
(
FormatNatural
));
int
base
=
model
()
->
data
(
QModelIndex
(),
Qt
::
UserRole
).
toInt
();
QAction
*
act16
=
menu
.
addAction
(
tr
(
"Hexadecimal"
));
act16
->
setCheckable
(
true
);
act16
->
setChecked
(
base
==
16
);
QAction
*
act10
=
menu
.
addAction
(
tr
(
"Decimal"
));
act10
->
setCheckable
(
true
);
act10
->
setChecked
(
base
==
10
);
QAction
*
act8
=
menu
.
addAction
(
tr
(
"Octal"
));
act8
->
setCheckable
(
true
);
act8
->
setChecked
(
base
==
8
);
QAction
*
act2
=
menu
.
addAction
(
tr
(
"Binary"
));
act2
->
setCheckable
(
true
);
act2
->
setChecked
(
base
==
2
);
menu
.
addSeparator
();
menu
.
addAction
(
theDebuggerAction
(
SettingsDialog
));
QAction
*
act
=
menu
.
exec
(
ev
->
globalPos
());
if
(
act
==
act
ions
[
Adjust
]
)
if
(
act
==
act
Adjust
)
resizeColumnsToContents
();
else
if
(
act
==
act
ions
[
AlwaysAdjust
]
)
else
if
(
act
==
act
AlwaysAdjust
)
setAlwaysResizeColumnsToContents
(
!
m_alwaysResizeColumnsToContents
);
else
if
(
act
==
act
ions
[
Reload
]
)
else
if
(
act
==
act
Reload
)
reloadContents
();
else
if
(
act
==
act
ions
[
AlwaysReload
]
)
else
if
(
act
==
act
AlwaysReload
)
setAlwaysReloadContents
(
!
m_alwaysReloadContents
);
else
if
(
act
)
{
base
=
(
act
==
act10
?
10
:
act
==
act8
?
8
:
act
==
act2
?
2
:
16
);
QMetaObject
::
invokeMethod
(
model
(),
"setNumberBase"
,
Q_ARG
(
int
,
base
));
}
}
void
RegisterWindow
::
resizeColumnsToContents
()
...
...
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