Commit 5e909ccb authored by hjk's avatar hjk
Browse files

debugger: add name of current function to disassembler view title

parent cce7bf9f
...@@ -139,8 +139,9 @@ public: ...@@ -139,8 +139,9 @@ public:
struct DisassemblerViewAgentPrivate struct DisassemblerViewAgentPrivate
{ {
QPointer<TextEditor::ITextEditor> editor; QPointer<TextEditor::ITextEditor> editor;
QPointer<IDebuggerEngine> engine;
QString address; QString address;
QString function;
QPointer<DebuggerManager> manager;
LocationMark2 *locationMark; LocationMark2 *locationMark;
}; };
...@@ -180,8 +181,8 @@ DisassemblerViewAgent::DisassemblerViewAgent(DebuggerManager *manager) ...@@ -180,8 +181,8 @@ DisassemblerViewAgent::DisassemblerViewAgent(DebuggerManager *manager)
: QObject(manager), d(new DisassemblerViewAgentPrivate) : QObject(manager), d(new DisassemblerViewAgentPrivate)
{ {
d->editor = 0; d->editor = 0;
d->engine = manager->currentEngine();
d->locationMark = new LocationMark2(); d->locationMark = new LocationMark2();
d->manager = manager;
} }
DisassemblerViewAgent::~DisassemblerViewAgent() DisassemblerViewAgent::~DisassemblerViewAgent()
...@@ -193,8 +194,11 @@ DisassemblerViewAgent::~DisassemblerViewAgent() ...@@ -193,8 +194,11 @@ DisassemblerViewAgent::~DisassemblerViewAgent()
void DisassemblerViewAgent::setFrame(const StackFrame &frame) void DisassemblerViewAgent::setFrame(const StackFrame &frame)
{ {
d->engine->fetchDisassembler(this, frame); IDebuggerEngine *engine = d->manager->currentEngine();
QTC_ASSERT(engine, return);
engine->fetchDisassembler(this, frame);
d->address = frame.address; d->address = frame.address;
d->function = frame.function;
} }
void DisassemblerViewAgent::setContents(const QString &contents) void DisassemblerViewAgent::setContents(const QString &contents)
...@@ -208,8 +212,9 @@ void DisassemblerViewAgent::setContents(const QString &contents) ...@@ -208,8 +212,9 @@ void DisassemblerViewAgent::setContents(const QString &contents)
QString titlePattern = "Disassembler"; QString titlePattern = "Disassembler";
d->editor = qobject_cast<ITextEditor *>( d->editor = qobject_cast<ITextEditor *>(
editorManager->openEditorWithContents( editorManager->openEditorWithContents(
Core::Constants::K_DEFAULT_TEXT_EDITOR, Core::Constants::K_DEFAULT_TEXT_EDITOR,
&titlePattern)); &titlePattern));
QTC_ASSERT(d->editor, return);
if ((plainTextEdit = qobject_cast<QPlainTextEdit *>(d->editor->widget()))) if ((plainTextEdit = qobject_cast<QPlainTextEdit *>(d->editor->widget())))
(void) new DisassemblerHighlighter(plainTextEdit); (void) new DisassemblerHighlighter(plainTextEdit);
} }
...@@ -221,6 +226,7 @@ void DisassemblerViewAgent::setContents(const QString &contents) ...@@ -221,6 +226,7 @@ void DisassemblerViewAgent::setContents(const QString &contents)
plainTextEdit->setPlainText(contents); plainTextEdit->setPlainText(contents);
d->editor->markableInterface()->removeMark(d->locationMark); d->editor->markableInterface()->removeMark(d->locationMark);
d->editor->setDisplayName(_("Disassembler (%1)").arg(d->function));
for (int pos = 0, line = 0; ; ++line, ++pos) { for (int pos = 0, line = 0; ; ++line, ++pos) {
if (contents.midRef(pos, d->address.size()) == d->address) { if (contents.midRef(pos, d->address.size()) == d->address) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment