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
Tobias Hunger
qt-creator
Commits
b6c7c597
Commit
b6c7c597
authored
Feb 05, 2010
by
Friedemann Kleint
Browse files
Debugger: Introduce engine capability flags to enable actions correctly.
Reviewed-by: hjk
parent
5c2738d6
Changes
12
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/cdb/cdbdebugengine.cpp
View file @
b6c7c597
...
...
@@ -1499,6 +1499,11 @@ void CdbDebugEngine::syncDebuggerPaths()
}
}
unsigned
CdbDebugEngine
::
debuggerCapabilities
()
const
{
return
DisassemblerCapability
|
RegisterCapability
|
ShowMemoryCapability
;
}
// Accessed by DebuggerManager
IDebuggerEngine
*
createWinEngine
(
DebuggerManager
*
parent
,
bool
cmdLineEnabled
,
...
...
src/plugins/debugger/cdb/cdbdebugengine.h
View file @
b6c7c597
...
...
@@ -67,6 +67,7 @@ public:
virtual
void
exitDebugger
();
virtual
void
detachDebugger
();
virtual
void
updateWatchData
(
const
WatchData
&
data
);
virtual
unsigned
debuggerCapabilities
()
const
;
virtual
void
stepExec
();
virtual
void
stepOutExec
();
...
...
src/plugins/debugger/debuggerconstants.h
View file @
b6c7c597
...
...
@@ -109,6 +109,19 @@ enum DebuggerStartMode
StartRemote
// Start and attach to a remote process
};
enum
DebuggerCapabilities
{
ReverseSteppingCapability
=
0x1
,
SnapshotCapability
=
0x2
,
AutoDerefPointersCapability
=
0x4
,
DisassemblerCapability
=
0x80
,
RegisterCapability
=
0x10
,
ShowMemoryCapability
=
0x20
,
JumpToLineCapability
=
0x40
,
ReloadModuleCapability
=
0x80
,
ReloadModuleSymbolsCapability
=
0x100
,
};
enum
LogChannel
{
LogInput
,
// Used for user input
...
...
src/plugins/debugger/debuggermanager.cpp
View file @
b6c7c597
...
...
@@ -1051,6 +1051,10 @@ void DebuggerManager::startNewDebugger(const DebuggerStartParametersPtr &sp)
setState
(
EngineStarting
);
connect
(
d
->
m_engine
,
SIGNAL
(
startFailed
()),
this
,
SLOT
(
startFailed
()));
d
->
m_engine
->
startDebugger
(
d
->
m_startParameters
);
const
unsigned
engineCapabilities
=
d
->
m_engine
->
debuggerCapabilities
();
theDebuggerAction
(
OperateByInstruction
)
->
setEnabled
(
engineCapabilities
&
DisassemblerCapability
);
d
->
m_actions
.
reverseDirectionAction
->
setEnabled
(
engineCapabilities
&
ReverseSteppingCapability
);
}
void
DebuggerManager
::
startFailed
()
...
...
@@ -1717,10 +1721,12 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
if
(
stopped
)
QApplication
::
alert
(
mainWindow
(),
3000
);
const
bool
actionsEnabled
=
debuggerActionsEnabled
();
const
unsigned
engineCapabilities
=
debuggerCapabilities
();
d
->
m_actions
.
watchAction1
->
setEnabled
(
true
);
d
->
m_actions
.
watchAction2
->
setEnabled
(
true
);
d
->
m_actions
.
breakAction
->
setEnabled
(
true
);
d
->
m_actions
.
snapshotAction
->
setEnabled
(
stopped
);
d
->
m_actions
.
snapshotAction
->
setEnabled
(
stopped
&&
(
engineCapabilities
&
SnapshotCapability
)
);
bool
interruptIsExit
=
!
running
;
if
(
interruptIsExit
)
{
...
...
@@ -1740,12 +1746,13 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
d
->
m_actions
.
stepOutAction
->
setEnabled
(
stopped
);
d
->
m_actions
.
runToLineAction
->
setEnabled
(
stopped
);
d
->
m_actions
.
runToFunctionAction
->
setEnabled
(
stopped
);
d
->
m_actions
.
jumpToLineAction
->
setEnabled
(
stopped
);
d
->
m_actions
.
jumpToLineAction
->
setEnabled
(
stopped
&&
(
engineCapabilities
&
JumpToLineCapability
));
d
->
m_actions
.
nextAction
->
setEnabled
(
stopped
);
const
bool
actionsEnabled
=
debuggerActionsEnabled
();
theDebuggerAction
(
RecheckDebuggingHelpers
)
->
setEnabled
(
actionsEnabled
);
theDebuggerAction
(
AutoDerefPointers
)
->
setEnabled
(
actionsEnabled
&&
d
->
m_engine
->
isGdbEngine
());
theDebuggerAction
(
AutoDerefPointers
)
->
setEnabled
(
actionsEnabled
&&
(
engineCapabilities
&
AutoDerefPointersCapability
));
theDebuggerAction
(
ExpandStack
)
->
setEnabled
(
actionsEnabled
);
theDebuggerAction
(
ExecuteCommand
)
->
setEnabled
(
d
->
m_state
!=
DebuggerNotReady
);
...
...
@@ -1787,6 +1794,11 @@ bool DebuggerManager::debuggerActionsEnabled() const
return
false
;
}
unsigned
DebuggerManager
::
debuggerCapabilities
()
const
{
return
d
->
m_engine
?
d
->
m_engine
->
debuggerCapabilities
()
:
0
;
}
bool
DebuggerManager
::
checkDebugConfiguration
(
int
toolChain
,
QString
*
errorMessage
,
QString
*
settingsCategory
/* = 0 */
,
...
...
src/plugins/debugger/debuggermanager.h
View file @
b6c7c597
...
...
@@ -188,6 +188,7 @@ public:
int
buttons
=
0
);
bool
debuggerActionsEnabled
()
const
;
unsigned
debuggerCapabilities
()
const
;
bool
checkDebugConfiguration
(
int
toolChain
,
QString
*
errorMessage
,
...
...
src/plugins/debugger/gdb/gdbengine.cpp
View file @
b6c7c597
...
...
@@ -1696,6 +1696,13 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
m_gdbAdapter
->
startAdapter
();
}
unsigned
GdbEngine
::
debuggerCapabilities
()
const
{
return
ReverseSteppingCapability
|
SnapshotCapability
|
AutoDerefPointersCapability
|
DisassemblerCapability
|
RegisterCapability
|
ShowMemoryCapability
|
JumpToLineCapability
|
ReloadModuleCapability
|
ReloadModuleSymbolsCapability
;
}
void
GdbEngine
::
continueInferiorInternal
()
{
QTC_ASSERT
(
state
()
==
InferiorStopped
||
state
()
==
InferiorStarting
,
...
...
src/plugins/debugger/gdb/gdbengine.h
View file @
b6c7c597
...
...
@@ -103,10 +103,8 @@ private: ////////// General Interface //////////
virtual
void
addOptionPages
(
QList
<
Core
::
IOptionsPage
*>
*
opts
)
const
;
virtual
bool
checkConfiguration
(
int
toolChain
,
QString
*
errorMessage
,
QString
*
settingsPage
=
0
)
const
;
virtual
bool
isGdbEngine
()
const
{
return
true
;
}
virtual
void
startDebugger
(
const
DebuggerStartParametersPtr
&
sp
);
virtual
unsigned
debuggerCapabilities
()
const
;
virtual
void
exitDebugger
();
virtual
void
detachDebugger
();
virtual
void
shutdown
();
...
...
src/plugins/debugger/idebuggerengine.h
View file @
b6c7c597
...
...
@@ -118,7 +118,7 @@ public:
{
Q_UNUSED
(
regnr
);
Q_UNUSED
(
value
);
}
virtual
void
addOptionPages
(
QList
<
Core
::
IOptionsPage
*>
*
)
const
{}
virtual
bool
isGdbEngine
()
const
{
return
false
;
}
virtual
unsigned
debuggerCapabilities
()
const
{
return
0
;
}
virtual
bool
checkConfiguration
(
int
/* toolChain */
,
QString
*
/* errorMessage */
,
QString
*
/* settingsPage */
=
0
)
const
{
return
true
;
}
virtual
bool
isSynchroneous
()
const
{
return
false
;
}
...
...
src/plugins/debugger/moduleswindow.cpp
View file @
b6c7c597
...
...
@@ -108,27 +108,29 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
QMenu
menu
;
const
bool
enabled
=
Debugger
::
DebuggerManager
::
instance
()
->
debuggerActionsEnabled
();
const
unsigned
capabilities
=
Debugger
::
DebuggerManager
::
instance
()
->
debuggerCapabilities
();
QAction
*
act0
=
new
QAction
(
tr
(
"Update module list"
),
&
menu
);
act0
->
setEnabled
(
enabled
);
act0
->
setEnabled
(
enabled
&&
(
capabilities
&
ReloadModuleCapability
)
);
QAction
*
act3
=
new
QAction
(
tr
(
"Show source files for module
\"
%1
\"
"
).
arg
(
name
),
&
menu
);
act3
->
setEnabled
(
enabled
);
act3
->
setEnabled
(
enabled
&&
(
capabilities
&
ReloadModuleCapability
)
);
QAction
*
act4
=
new
QAction
(
tr
(
"Load symbols for all modules"
),
&
menu
);
act4
->
setEnabled
(
enabled
);
act4
->
setEnabled
(
enabled
&&
(
capabilities
&
ReloadModuleSymbolsCapability
)
);
QAction
*
act5
=
0
;
QAction
*
act6
=
0
;
QAction
*
act7
=
0
;
if
(
name
.
isEmpty
())
{
act5
=
new
QAction
(
tr
(
"Load symbols for module"
),
&
menu
);
act5
->
setEnabled
(
false
);
act6
=
new
QAction
(
tr
(
"Edit file"
),
&
menu
);
act6
->
setEnabled
(
false
);
act7
=
new
QAction
(
tr
(
"Show symbols"
),
&
menu
);
act7
->
setEnabled
(
false
);
}
else
{
act5
=
new
QAction
(
tr
(
"Load symbols for module
\"
%1
\"
"
).
arg
(
name
),
&
menu
);
act5
->
setEnabled
(
capabilities
&
ReloadModuleSymbolsCapability
);
act6
=
new
QAction
(
tr
(
"Edit file
\"
%1
\"
"
).
arg
(
name
),
&
menu
);
act7
=
new
QAction
(
tr
(
"Show symbols in file
\"
%1
\"
"
).
arg
(
name
),
&
menu
);
}
act5
->
setDisabled
(
name
.
isEmpty
());
act6
->
setDisabled
(
name
.
isEmpty
());
act7
->
setDisabled
(
name
.
isEmpty
());
menu
.
addAction
(
act0
);
menu
.
addAction
(
act4
);
...
...
src/plugins/debugger/registerwindow.cpp
View file @
b6c7c597
...
...
@@ -165,7 +165,12 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu
menu
;
const
unsigned
engineCapabilities
=
m_manager
->
debuggerCapabilities
();
const
bool
actionsEnabled
=
m_manager
->
debuggerActionsEnabled
();
QAction
*
actReload
=
menu
.
addAction
(
tr
(
"Reload register listing"
));
actReload
->
setEnabled
(
engineCapabilities
&
RegisterCapability
);
menu
.
addSeparator
();
QModelIndex
idx
=
indexAt
(
ev
->
pos
());
...
...
@@ -176,8 +181,8 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
actShowMemory
->
setEnabled
(
false
);
}
else
{
actShowMemory
->
setText
(
tr
(
"Open memory editor at %1"
).
arg
(
address
));
actShowMemory
->
setEnabled
(
actionsEnabled
&
(
engineCapabilities
&
ShowMemoryCapability
));
}
actShowMemory
->
setEnabled
(
m_manager
->
debuggerActionsEnabled
());
menu
.
addSeparator
();
int
base
=
model
()
->
data
(
QModelIndex
(),
RegisterNumberBaseRole
).
toInt
();
...
...
src/plugins/debugger/stackwindow.cpp
View file @
b6c7c597
...
...
@@ -96,6 +96,7 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
QMenu
menu
;
const
unsigned
engineCapabilities
=
m_manager
->
debuggerCapabilities
();
menu
.
addAction
(
theDebuggerAction
(
ExpandStack
));
QAction
*
actCopyContents
=
menu
.
addAction
(
tr
(
"Copy contents to clipboard"
));
...
...
@@ -107,6 +108,7 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
actShowMemory
->
setEnabled
(
false
);
}
else
{
actShowMemory
->
setText
(
tr
(
"Open memory editor at %1"
).
arg
(
address
));
actShowMemory
->
setEnabled
(
engineCapabilities
&
ShowMemoryCapability
);
}
QAction
*
actShowDisassembler
=
menu
.
addAction
(
QString
());
...
...
@@ -115,6 +117,7 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
actShowDisassembler
->
setEnabled
(
false
);
}
else
{
actShowDisassembler
->
setText
(
tr
(
"Open disassembler at %1"
).
arg
(
address
));
actShowDisassembler
->
setEnabled
(
engineCapabilities
&
DisassemblerCapability
);
}
menu
.
addSeparator
();
...
...
src/plugins/debugger/watchwindow.cpp
View file @
b6c7c597
...
...
@@ -261,12 +261,14 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction
*
actSelectWidgetToWatch
=
menu
.
addAction
(
tr
(
"Select widget to watch"
));
const
bool
actionsEnabled
=
m_manager
->
debuggerActionsEnabled
();
const
unsigned
engineCapabilities
=
m_manager
->
debuggerCapabilities
();
const
QString
address
=
model
()
->
data
(
mi0
,
AddressRole
).
toString
();
QAction
*
actWatchKnownMemory
=
0
;
QAction
*
actWatchUnknownMemory
=
new
QAction
(
tr
(
"Open memory editor..."
),
&
menu
);
actWatchUnknownMemory
->
setEnabled
(
actionsEnabled
);
const
bool
canShowMemory
=
engineCapabilities
&
ShowMemoryCapability
;
actWatchUnknownMemory
->
setEnabled
(
actionsEnabled
&&
canShowMemory
);
if
(
!
address
.
isEmpty
())
if
(
canShowMemory
&&
!
address
.
isEmpty
())
actWatchKnownMemory
=
new
QAction
(
tr
(
"Open memory editor at %1"
).
arg
(
address
),
&
menu
);
menu
.
addSeparator
();
...
...
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