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
Tobias Hunger
qt-creator
Commits
0b662609
Commit
0b662609
authored
Feb 16, 2011
by
hjk
Browse files
debugger: replace action(ExecuteCommand) be a direct function call
parent
e3600834
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/consolewindow.cpp
View file @
0b662609
...
...
@@ -192,11 +192,10 @@ public:
void
contextMenuEvent
(
QContextMenuEvent
*
ev
)
{
debuggerCore
()
->
action
(
ExecuteCommand
)
->
setData
(
textCursor
().
block
().
text
());
debuggerCore
()
->
executeDebuggerCommand
(
textCursor
().
block
().
text
());
QMenu
*
menu
=
createStandardContextMenu
();
menu
->
addAction
(
m_clearContentsAction
);
menu
->
addAction
(
m_saveContentsAction
);
// X11 clipboard is unreliable for long texts
menu
->
addAction
(
debuggerCore
()
->
action
(
ExecuteCommand
));
menu
->
addAction
(
debuggerCore
()
->
action
(
LogTimeStamps
));
menu
->
addAction
(
debuggerCore
()
->
action
(
VerboseLog
));
menu
->
addSeparator
();
...
...
@@ -217,7 +216,7 @@ public:
if
(
c
.
unicode
()
>=
32
&&
c
.
unicode
()
<
128
)
cleanCmd
.
append
(
c
);
if
(
!
cleanCmd
.
isEmpty
())
{
debuggerCore
()
->
action
(
ExecuteCommand
)
->
trigger
(
cleanCmd
);
debuggerCore
()
->
executeDebuggerCommand
(
cleanCmd
);
m_history
.
append
(
cleanCmd
);
}
}
...
...
src/plugins/debugger/debuggeractions.cpp
View file @
0b662609
...
...
@@ -396,10 +396,6 @@ DebuggerSettings::DebuggerSettings(QSettings *settings)
item
->
setText
(
tr
(
"Create Full Backtrace"
));
insertItem
(
CreateFullBacktrace
,
item
);
item
=
new
SavedAction
(
this
);
item
->
setText
(
tr
(
"Execute Line"
));
insertItem
(
ExecuteCommand
,
item
);
item
=
new
SavedAction
(
this
);
item
->
setSettingsKey
(
debugModeGroup
,
QLatin1String
(
"WatchdogTimeout"
));
item
->
setDefaultValue
(
20
);
...
...
src/plugins/debugger/debuggeractions.h
View file @
0b662609
...
...
@@ -104,7 +104,6 @@ enum DebuggerActionCode
// Gdb
LoadGdbInit
,
GdbScriptFile
,
ExecuteCommand
,
GdbWatchdogTimeout
,
TargetAsync
,
...
...
src/plugins/debugger/debuggercore.h
View file @
0b662609
...
...
@@ -106,6 +106,7 @@ public:
const
QVector
<
Symbol
>
&
symbols
)
=
0
;
virtual
void
openMemoryEditor
()
=
0
;
virtual
void
languagesChanged
()
=
0
;
virtual
void
executeDebuggerCommand
(
const
QString
&
command
)
=
0
;
virtual
Utils
::
SavedAction
*
action
(
int
code
)
const
=
0
;
virtual
bool
boolSetting
(
int
code
)
const
=
0
;
...
...
src/plugins/debugger/debuggerengine.cpp
View file @
0b662609
...
...
@@ -1475,6 +1475,7 @@ void DebuggerEngine::executeJumpToLine(const QString &, int)
void
DebuggerEngine
::
executeDebuggerCommand
(
const
QString
&
)
{
showStatusMessage
(
tr
(
"This debugger cannot handle user input."
));
}
BreakHandler
*
DebuggerEngine
::
breakHandler
()
const
...
...
src/plugins/debugger/debuggerengine.h
View file @
0b662609
...
...
@@ -182,6 +182,7 @@ public:
virtual
void
removeBreakpoint
(
BreakpointId
id
);
// FIXME: make pure
virtual
void
changeBreakpoint
(
BreakpointId
id
);
// FIXME: make pure
virtual
bool
acceptsDebuggerCommands
()
const
{
return
true
;
}
virtual
void
assignValueInDebugger
(
const
Internal
::
WatchData
*
data
,
const
QString
&
expr
,
const
QVariant
&
value
);
virtual
void
selectThread
(
int
index
);
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
0b662609
...
...
@@ -479,9 +479,9 @@ public:
void
runEngine
()
{}
void
shutdownEngine
()
{}
void
shutdownInferior
()
{}
void
executeDebuggerCommand
(
const
QString
&
)
{}
unsigned
debuggerCapabilities
()
const
{
return
0
;
}
bool
acceptsBreakpoint
(
BreakpointId
)
const
{
return
false
;
}
bool
acceptsDebuggerCommands
()
const
{
return
false
;
}
};
static
DebuggerEngine
*
dummyEngine
()
...
...
@@ -949,7 +949,7 @@ public slots:
void
aboutToUnloadSession
();
void
aboutToSaveSession
();
void
executeDebuggerCommand
();
void
executeDebuggerCommand
(
const
QString
&
command
);
void
scriptExpressionEntered
(
const
QString
&
expression
);
void
coreShutdown
();
...
...
@@ -2131,7 +2131,6 @@ void DebuggerPluginPrivate::setInitialState()
action
(
AutoDerefPointers
)
->
setEnabled
(
true
);
action
(
ExpandStack
)
->
setEnabled
(
false
);
action
(
ExecuteCommand
)
->
setEnabled
(
false
);
m_scriptConsoleWindow
->
setEnabled
(
false
);
}
...
...
@@ -2263,7 +2262,6 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
action
(
AutoDerefPointers
)
->
setEnabled
(
canDeref
);
action
(
AutoDerefPointers
)
->
setEnabled
(
true
);
action
(
ExpandStack
)
->
setEnabled
(
actionsEnabled
);
action
(
ExecuteCommand
)
->
setEnabled
(
state
==
InferiorStopOk
);
const
bool
notbusy
=
state
==
InferiorStopOk
||
state
==
DebuggerNotReady
...
...
@@ -2379,10 +2377,12 @@ void DebuggerPluginPrivate::aboutToSaveSession()
m_breakHandler
->
saveSessionData
();
}
void
DebuggerPluginPrivate
::
executeDebuggerCommand
()
void
DebuggerPluginPrivate
::
executeDebuggerCommand
(
const
QString
&
command
)
{
if
(
QAction
*
action
=
qobject_cast
<
QAction
*>
(
sender
()))
currentEngine
()
->
executeDebuggerCommand
(
action
->
data
().
toString
());
if
(
currentEngine
()
->
acceptsDebuggerCommands
())
currentEngine
()
->
executeDebuggerCommand
(
command
);
else
showStatusMessage
(
tr
(
"User commands are not accepted in the current state."
));
}
void
DebuggerPluginPrivate
::
showStatusMessage
(
const
QString
&
msg0
,
int
timeout
)
...
...
@@ -2757,9 +2757,6 @@ void DebuggerPluginPrivate::extensionsInitialized()
connect
(
&
m_statusTimer
,
SIGNAL
(
timeout
()),
SLOT
(
clearStatusMessage
()));
connect
(
action
(
ExecuteCommand
),
SIGNAL
(
triggered
()),
SLOT
(
executeDebuggerCommand
()));
ActionContainer
*
debugMenu
=
am
->
actionContainer
(
ProjectExplorer
::
Constants
::
M_DEBUG
);
...
...
src/plugins/debugger/gdb/gdbengine.cpp
View file @
0b662609
...
...
@@ -1062,17 +1062,19 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
m_commandTimer
.
stop
();
}
void
GdbEngine
::
execute
DebuggerCommand
(
const
QString
&
command
)
bool
GdbEngine
::
accepts
DebuggerCommand
s
()
const
{
if
(
state
()
==
DebuggerNotReady
)
{
showMessage
(
_
(
"GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: "
)
+
command
);
return
;
}
return
state
()
==
InferiorStopOk
||
state
()
==
InferiorUnrunnable
;
}
void
GdbEngine
::
executeDebuggerCommand
(
const
QString
&
command
)
{
QTC_ASSERT
(
acceptsDebuggerCommands
(),
/**/
);
m_gdbAdapter
->
write
(
command
.
toLatin1
()
+
"
\r\n
"
);
}
//
C
alled from CoreAdapter and AttachAdapter
//
This is c
alled from CoreAdapter and AttachAdapter
.
void
GdbEngine
::
updateAll
()
{
if
(
hasPython
())
...
...
src/plugins/debugger/gdb/gdbengine.h
View file @
0b662609
...
...
@@ -115,6 +115,7 @@ private: ////////// General Interface //////////
virtual
void
shutdownInferior
();
virtual
void
notifyInferiorSetupFailed
();
virtual
bool
acceptsDebuggerCommands
()
const
;
virtual
void
executeDebuggerCommand
(
const
QString
&
command
);
virtual
QByteArray
qtNamespace
()
const
{
return
m_dumperHelper
.
qtNamespace
();
}
virtual
void
setQtNamespace
(
const
QByteArray
&
ns
)
...
...
src/plugins/debugger/logwindow.cpp
View file @
0b662609
...
...
@@ -203,9 +203,6 @@ public:
QMenu
*
menu
=
createStandardContextMenu
();
menu
->
addAction
(
m_clearContentsAction
);
menu
->
addAction
(
m_saveContentsAction
);
// X11 clipboard is unreliable for long texts
addContextActions
(
menu
);
debuggerCore
()
->
action
(
ExecuteCommand
)
->
setData
(
textCursor
().
block
().
text
());
menu
->
addAction
(
debuggerCore
()
->
action
(
ExecuteCommand
));
menu
->
addAction
(
debuggerCore
()
->
action
(
LogTimeStamps
));
menu
->
addAction
(
debuggerCore
()
->
action
(
VerboseLog
));
menu
->
addSeparator
();
...
...
@@ -214,7 +211,6 @@ public:
delete
menu
;
}
virtual
void
addContextActions
(
QMenu
*
)
{}
private
slots
:
void
saveContents
();
...
...
@@ -254,7 +250,7 @@ private:
void
keyPressEvent
(
QKeyEvent
*
ev
)
{
if
(
ev
->
modifiers
()
==
Qt
::
ControlModifier
&&
ev
->
key
()
==
Qt
::
Key_Return
)
debuggerCore
()
->
action
(
ExecuteCommand
)
->
trigger
(
textCursor
().
block
().
text
());
debuggerCore
()
->
executeDebuggerCommand
(
textCursor
().
block
().
text
());
else
if
(
ev
->
modifiers
()
==
Qt
::
ControlModifier
&&
ev
->
key
()
==
Qt
::
Key_R
)
emit
clearContentsRequested
();
else
...
...
@@ -280,11 +276,6 @@ private:
emit
commandSelected
(
n
);
}
void
addContextActions
(
QMenu
*
menu
)
{
menu
->
addAction
(
debuggerCore
()
->
action
(
ExecuteCommand
));
}
void
focusInEvent
(
QFocusEvent
*
ev
)
{
emit
statusMessageRequested
(
tr
(
"Type Ctrl-<Return> to execute a line."
),
-
1
);
...
...
@@ -351,7 +342,7 @@ LogWindow::LogWindow(QWidget *parent)
setWindowTitle
(
tr
(
"Debugger Log"
));
setObjectName
(
"Log"
);
QSplitter
*
m_splitter
=
new
Core
::
MiniSplitter
(
Qt
::
Horizontal
);
QSplitter
*
m_splitter
=
new
Core
::
MiniSplitter
(
Qt
::
Horizontal
);
m_splitter
->
setParent
(
this
);
// Mixed input/output.
...
...
@@ -414,7 +405,7 @@ LogWindow::LogWindow(QWidget *parent)
void
LogWindow
::
sendCommand
()
{
debuggerCore
()
->
action
(
ExecuteCommand
)
->
trigger
(
m_commandEdit
->
text
());
debuggerCore
()
->
executeDebuggerCommand
(
m_commandEdit
->
text
());
}
void
LogWindow
::
showOutput
(
int
channel
,
const
QString
&
output
)
...
...
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