Disassembler: Force disassembler reload when switching output flavor

Change-Id: I8356cba5766a0afc519c66f120c24d1755c840e4
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
hjk
2014-05-26 15:24:27 +02:00
parent 7e47a8a453
commit ddfc1f8d27
5 changed files with 23 additions and 17 deletions

View File

@@ -169,6 +169,8 @@ public:
m_isStateDebugging(false) m_isStateDebugging(false)
{ {
connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation())); connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation()));
connect(debuggerCore()->action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
SLOT(reloadDisassembly()));
} }
public slots: public slots:
@@ -180,6 +182,11 @@ public slots:
void doInterruptInferior(); void doInterruptInferior();
void doFinishDebugger(); void doFinishDebugger();
void reloadDisassembly()
{
m_disassemblerAgent.reload();
}
void queueSetupEngine() void queueSetupEngine()
{ {
m_engine->setState(EngineSetupRequested); m_engine->setState(EngineSetupRequested);

View File

@@ -30,6 +30,7 @@
#include "disassembleragent.h" #include "disassembleragent.h"
#include "breakhandler.h" #include "breakhandler.h"
#include "debuggeractions.h"
#include "debuggercore.h" #include "debuggercore.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggerinternalconstants.h" #include "debuggerinternalconstants.h"
@@ -214,6 +215,12 @@ bool DisassemblerAgent::isMixed() const
&& d->location.functionName() != _("??"); && d->location.functionName() != _("??");
} }
void DisassemblerAgent::reload()
{
d->cache.clear();
d->engine->fetchDisassembler(this);
}
void DisassemblerAgent::setLocation(const Location &loc) void DisassemblerAgent::setLocation(const Location &loc)
{ {
d->location = loc; d->location = loc;

View File

@@ -67,6 +67,9 @@ public:
void cleanup(); void cleanup();
bool isMixed() const; bool isMixed() const;
// Force reload, e.g. after changing the output flavour.
void reload();
private: private:
void setContentsToDocument(const DisassemblerLines &contents); void setContentsToDocument(const DisassemblerLines &contents);
int indexOf(const Location &loc) const; int indexOf(const Location &loc) const;

View File

@@ -236,8 +236,6 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters)
SLOT(reloadLocals())); SLOT(reloadLocals()));
connect(debuggerCore()->action(UseDynamicType), SIGNAL(valueChanged(QVariant)), connect(debuggerCore()->action(UseDynamicType), SIGNAL(valueChanged(QVariant)),
SLOT(reloadLocals())); SLOT(reloadLocals()));
connect(debuggerCore()->action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
SLOT(reloadDisassembly()));
} }
GdbEngine::~GdbEngine() GdbEngine::~GdbEngine()
@@ -3968,9 +3966,11 @@ public:
void GdbEngine::fetchDisassembler(DisassemblerAgent *agent) void GdbEngine::fetchDisassembler(DisassemblerAgent *agent)
{ {
// Doing that unconditionally seems to be the most robust if (debuggerCore()->boolSetting(IntelFlavor))
// solution given the richest output. Looks like GDB is postCommand("set disassembly-flavor intel");
// a command line tool after all... else
postCommand("set disassembly-flavor att");
fetchDisassemblerByCliPointMixed(agent); fetchDisassemblerByCliPointMixed(agent);
} }
@@ -4078,12 +4078,6 @@ bool GdbEngine::handleCliDisassemblerResult(const QByteArray &output, Disassembl
return false; return false;
} }
void GdbEngine::reloadDisassembly()
{
setTokenBarrier();
updateLocals();
}
void GdbEngine::handleFetchDisassemblerByCliPointMixed(const GdbResponse &response) void GdbEngine::handleFetchDisassemblerByCliPointMixed(const GdbResponse &response)
{ {
DisassemblerAgentCookie ac = response.cookie.value<DisassemblerAgentCookie>(); DisassemblerAgentCookie ac = response.cookie.value<DisassemblerAgentCookie>();
@@ -4475,11 +4469,7 @@ void GdbEngine::handleInferiorPrepared()
} }
} }
if (debuggerCore()->boolSetting(IntelFlavor)) {
//postCommand("set follow-exec-mode new"); //postCommand("set follow-exec-mode new");
postCommand("set disassembly-flavor intel");
}
if (sp.breakOnMain) { if (sp.breakOnMain) {
QByteArray cmd = "tbreak "; QByteArray cmd = "tbreak ";
cmd += sp.toolChainAbi.os() == Abi::WindowsOS ? "qMain" : "main"; cmd += sp.toolChainAbi.os() == Abi::WindowsOS ? "qMain" : "main";

View File

@@ -362,7 +362,6 @@ private: ////////// View & Data Stuff //////////
void handleFetchDisassemblerByCliRangeMixed(const GdbResponse &response); void handleFetchDisassemblerByCliRangeMixed(const GdbResponse &response);
void handleFetchDisassemblerByCliRangePlain(const GdbResponse &response); void handleFetchDisassemblerByCliRangePlain(const GdbResponse &response);
bool handleCliDisassemblerResult(const QByteArray &response, DisassemblerAgent *agent); bool handleCliDisassemblerResult(const QByteArray &response, DisassemblerAgent *agent);
Q_SLOT void reloadDisassembly();
void handleBreakOnQFatal(const GdbResponse &response); void handleBreakOnQFatal(const GdbResponse &response);