forked from qt-creator/qt-creator
		
	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:
		@@ -169,6 +169,8 @@ public:
 | 
			
		||||
        m_isStateDebugging(false)
 | 
			
		||||
    {
 | 
			
		||||
        connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation()));
 | 
			
		||||
        connect(debuggerCore()->action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
 | 
			
		||||
                SLOT(reloadDisassembly()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
@@ -180,6 +182,11 @@ public slots:
 | 
			
		||||
    void doInterruptInferior();
 | 
			
		||||
    void doFinishDebugger();
 | 
			
		||||
 | 
			
		||||
    void reloadDisassembly()
 | 
			
		||||
    {
 | 
			
		||||
        m_disassemblerAgent.reload();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void queueSetupEngine()
 | 
			
		||||
    {
 | 
			
		||||
        m_engine->setState(EngineSetupRequested);
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,7 @@
 | 
			
		||||
#include "disassembleragent.h"
 | 
			
		||||
 | 
			
		||||
#include "breakhandler.h"
 | 
			
		||||
#include "debuggeractions.h"
 | 
			
		||||
#include "debuggercore.h"
 | 
			
		||||
#include "debuggerengine.h"
 | 
			
		||||
#include "debuggerinternalconstants.h"
 | 
			
		||||
@@ -214,6 +215,12 @@ bool DisassemblerAgent::isMixed() const
 | 
			
		||||
        && d->location.functionName() != _("??");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DisassemblerAgent::reload()
 | 
			
		||||
{
 | 
			
		||||
    d->cache.clear();
 | 
			
		||||
    d->engine->fetchDisassembler(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DisassemblerAgent::setLocation(const Location &loc)
 | 
			
		||||
{
 | 
			
		||||
    d->location = loc;
 | 
			
		||||
 
 | 
			
		||||
@@ -67,6 +67,9 @@ public:
 | 
			
		||||
    void cleanup();
 | 
			
		||||
    bool isMixed() const;
 | 
			
		||||
 | 
			
		||||
    // Force reload, e.g. after changing the output flavour.
 | 
			
		||||
    void reload();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    void setContentsToDocument(const DisassemblerLines &contents);
 | 
			
		||||
    int indexOf(const Location &loc) const;
 | 
			
		||||
 
 | 
			
		||||
@@ -236,8 +236,6 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters)
 | 
			
		||||
            SLOT(reloadLocals()));
 | 
			
		||||
    connect(debuggerCore()->action(UseDynamicType), SIGNAL(valueChanged(QVariant)),
 | 
			
		||||
            SLOT(reloadLocals()));
 | 
			
		||||
    connect(debuggerCore()->action(IntelFlavor), SIGNAL(valueChanged(QVariant)),
 | 
			
		||||
            SLOT(reloadDisassembly()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GdbEngine::~GdbEngine()
 | 
			
		||||
@@ -3968,9 +3966,11 @@ public:
 | 
			
		||||
 | 
			
		||||
void GdbEngine::fetchDisassembler(DisassemblerAgent *agent)
 | 
			
		||||
{
 | 
			
		||||
    // Doing that unconditionally seems to be the most robust
 | 
			
		||||
    // solution given the richest output. Looks like GDB is
 | 
			
		||||
    // a command line tool after all...
 | 
			
		||||
    if (debuggerCore()->boolSetting(IntelFlavor))
 | 
			
		||||
        postCommand("set disassembly-flavor intel");
 | 
			
		||||
    else
 | 
			
		||||
        postCommand("set disassembly-flavor att");
 | 
			
		||||
 | 
			
		||||
    fetchDisassemblerByCliPointMixed(agent);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -4078,12 +4078,6 @@ bool GdbEngine::handleCliDisassemblerResult(const QByteArray &output, Disassembl
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GdbEngine::reloadDisassembly()
 | 
			
		||||
{
 | 
			
		||||
    setTokenBarrier();
 | 
			
		||||
    updateLocals();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GdbEngine::handleFetchDisassemblerByCliPointMixed(const GdbResponse &response)
 | 
			
		||||
{
 | 
			
		||||
    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 disassembly-flavor intel");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //postCommand("set follow-exec-mode new");
 | 
			
		||||
    if (sp.breakOnMain) {
 | 
			
		||||
        QByteArray cmd = "tbreak ";
 | 
			
		||||
        cmd += sp.toolChainAbi.os() == Abi::WindowsOS ? "qMain" : "main";
 | 
			
		||||
 
 | 
			
		||||
@@ -362,7 +362,6 @@ private: ////////// View & Data Stuff //////////
 | 
			
		||||
    void handleFetchDisassemblerByCliRangeMixed(const GdbResponse &response);
 | 
			
		||||
    void handleFetchDisassemblerByCliRangePlain(const GdbResponse &response);
 | 
			
		||||
    bool handleCliDisassemblerResult(const QByteArray &response, DisassemblerAgent *agent);
 | 
			
		||||
    Q_SLOT void reloadDisassembly();
 | 
			
		||||
 | 
			
		||||
    void handleBreakOnQFatal(const GdbResponse &response);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user