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
c3afba0f
Commit
c3afba0f
authored
Mar 29, 2010
by
hjk
Browse files
debugger: add a context menu action to the stackview to create a full
backtrace in the main editor. Useful for sending bug reports.
parent
89196e5c
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggeractions.cpp
View file @
c3afba0f
...
...
@@ -444,6 +444,10 @@ DebuggerSettings *DebuggerSettings::instance()
item
->
setText
(
tr
(
"Reload Full Stack"
));
instance
->
insertItem
(
ExpandStack
,
item
);
item
=
new
SavedAction
(
instance
);
item
->
setText
(
tr
(
"Create Full Backtrace"
));
instance
->
insertItem
(
CreateFullBacktrace
,
item
);
item
=
new
SavedAction
(
instance
);
item
->
setText
(
tr
(
"Execute Line"
));
instance
->
insertItem
(
ExecuteCommand
,
item
);
...
...
src/plugins/debugger/debuggeractions.h
View file @
c3afba0f
...
...
@@ -112,6 +112,7 @@ enum DebuggerActionCode
// Stack
MaximalStackDepth
,
ExpandStack
,
CreateFullBacktrace
,
// Watchers & Locals
WatchExpression
,
...
...
src/plugins/debugger/debuggerconstants.h
View file @
c3afba0f
...
...
@@ -129,6 +129,7 @@ enum DebuggerCapabilities
ReloadModuleSymbolsCapability
=
0x100
,
BreakOnThrowAndCatchCapability
=
0x200
,
ReturnFromFunctionCapability
=
0x400
,
CreateFullBacktraceCapability
=
0x800
,
};
enum
LogChannel
...
...
src/plugins/debugger/debuggermanager.cpp
View file @
c3afba0f
...
...
@@ -1947,6 +1947,12 @@ void DebuggerManager::updateWatchersWindow()
d
->
m_watchHandler
->
model
(
WatchersWatch
)
->
rowCount
(
QModelIndex
())
>
0
);
}
void
DebuggerManager
::
openTextEditor
(
const
QString
&
titlePattern
,
const
QString
&
contents
)
{
d
->
m_plugin
->
openTextEditor
(
titlePattern
,
contents
);
}
//////////////////////////////////////////////////////////////////////
//
// AbstractDebuggerEngine
...
...
src/plugins/debugger/debuggermanager.h
View file @
c3afba0f
...
...
@@ -345,6 +345,8 @@ private:
Internal
::
BreakpointData
*
findBreakpoint
(
const
QString
&
fileName
,
int
lineNumber
);
void
setToolTipExpression
(
const
QPoint
&
mousePos
,
TextEditor
::
ITextEditor
*
editor
,
int
cursorPos
);
void
openTextEditor
(
const
QString
&
titlePattern
,
const
QString
&
contents
);
DebuggerManagerPrivate
*
d
;
};
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
c3afba0f
...
...
@@ -1233,6 +1233,18 @@ void DebuggerPlugin::gotoLocation(const QString &file, int line, bool setMarker)
}
}
void
DebuggerPlugin
::
openTextEditor
(
const
QString
&
titlePattern0
,
const
QString
&
contents
)
{
QString
titlePattern
=
titlePattern0
;
EditorManager
*
editorManager
=
EditorManager
::
instance
();
QTC_ASSERT
(
editorManager
,
return
);
Core
::
IEditor
*
editor
=
editorManager
->
openEditorWithContents
(
Core
::
Constants
::
K_DEFAULT_TEXT_EDITOR_ID
,
&
titlePattern
,
contents
);
QTC_ASSERT
(
editor
,
return
);
editorManager
->
activateEditor
(
editor
);
}
void
DebuggerPlugin
::
handleStateChanged
(
int
state
)
{
// Prevent it from beeing triggered on setup.
...
...
src/plugins/debugger/debuggerplugin.h
View file @
c3afba0f
...
...
@@ -107,6 +107,8 @@ private slots:
void
resetLocation
();
void
gotoLocation
(
const
QString
&
file
,
int
line
,
bool
setMarker
);
void
openTextEditor
(
const
QString
&
titlePattern
,
const
QString
&
contents
);
void
breakpointSetRemoveMarginActionTriggered
();
void
breakpointEnableDisableMarginActionTriggered
();
void
onModeChanged
(
Core
::
IMode
*
mode
);
...
...
src/plugins/debugger/gdb/gdbengine.cpp
View file @
c3afba0f
...
...
@@ -188,6 +188,8 @@ GdbEngine::GdbEngine(DebuggerManager *manager) : IDebuggerEngine(manager)
connect
(
theDebuggerAction
(
AutoDerefPointers
),
SIGNAL
(
valueChanged
(
QVariant
)),
this
,
SLOT
(
setAutoDerefPointers
(
QVariant
)));
connect
(
theDebuggerAction
(
CreateFullBacktrace
),
SIGNAL
(
triggered
()),
this
,
SLOT
(
createFullBacktrace
()));
}
void
GdbEngine
::
connectDebuggingHelperActions
()
...
...
@@ -1795,7 +1797,8 @@ unsigned GdbEngine::debuggerCapabilities() const
|
RegisterCapability
|
ShowMemoryCapability
|
JumpToLineCapability
|
ReloadModuleCapability
|
ReloadModuleSymbolsCapability
|
BreakOnThrowAndCatchCapability
|
ReturnFromFunctionCapability
;
|
ReturnFromFunctionCapability
|
CreateFullBacktraceCapability
;
}
void
GdbEngine
::
continueInferiorInternal
()
...
...
@@ -4350,6 +4353,20 @@ bool GdbEngine::hasPython() const
return
m_hasPython
;
}
void
GdbEngine
::
createFullBacktrace
()
{
postCommand
(
"thread apply all bt"
,
NeedsStop
,
CB
(
handleCreateFullBacktrace
));
}
void
GdbEngine
::
handleCreateFullBacktrace
(
const
GdbResponse
&
response
)
{
if
(
response
.
resultClass
==
GdbResultDone
)
{
m_manager
->
openTextEditor
(
_
(
"Backtrace $"
),
_
(
response
.
data
.
findChild
(
"consolestreamoutput"
).
data
()));
}
}
//
// Factory
//
...
...
src/plugins/debugger/gdb/gdbengine.h
View file @
c3afba0f
...
...
@@ -479,6 +479,9 @@ private: ////////// View & Data Stuff //////////
void
handleDebuggingHelperEditValue
(
const
GdbResponse
&
response
);
void
handleDebuggingHelperSetup
(
const
GdbResponse
&
response
);
Q_SLOT
void
createFullBacktrace
();
void
handleCreateFullBacktrace
(
const
GdbResponse
&
response
);
void
updateLocals
(
const
QVariant
&
cookie
=
QVariant
());
void
updateLocalsClassic
(
const
QVariant
&
cookie
);
void
updateLocalsPython
(
const
QByteArray
&
varList
);
...
...
src/plugins/debugger/stackwindow.cpp
View file @
c3afba0f
...
...
@@ -102,12 +102,14 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
const
unsigned
engineCapabilities
=
m_manager
->
debuggerCapabilities
();
menu
.
addAction
(
theDebuggerAction
(
ExpandStack
));
QAction
*
actCopyContents
=
menu
.
addAction
(
tr
(
"Copy
c
ontents to
c
lipboard"
));
QAction
*
actCopyContents
=
menu
.
addAction
(
tr
(
"Copy
C
ontents to
C
lipboard"
));
actCopyContents
->
setEnabled
(
model
()
!=
0
);
menu
.
addAction
(
theDebuggerAction
(
CreateFullBacktrace
));
QAction
*
actShowMemory
=
menu
.
addAction
(
QString
());
if
(
address
.
isEmpty
())
{
actShowMemory
->
setText
(
tr
(
"Open
m
emory
e
ditor"
));
actShowMemory
->
setText
(
tr
(
"Open
M
emory
E
ditor"
));
actShowMemory
->
setEnabled
(
false
);
}
else
{
actShowMemory
->
setText
(
tr
(
"Open Memory Editor at %1"
).
arg
(
address
));
...
...
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