Commit 37686e6a authored by hjk's avatar hjk

debugger: rework logic for chain of disassembler fallbacks.

Old logic was too fragile to maintain.
Now it's  PointMixed -> PointPlain -> RangeMixed -> RangePlain.
parent d8763dca
......@@ -33,19 +33,28 @@
#include "disassemblerlines.h"
#include <QtCore/QDebug>
#include <QtCore/QRegExp>
namespace Debugger {
namespace Internal {
DisassemblerLine::DisassemblerLine(const QString &unparsed)
{
int pos = -1;
for (int i = 0; i != unparsed.size(); ++i) {
uint c = unparsed.at(i).unicode();
if (c == ' ' || c == ':' || c == '\t') {
pos = i;
break;
}
}
// Mac gdb has an overflow reporting 64bit addresses causing the instruction
// to follow the last digit "0x000000013fff4810mov 1,1". Truncate here.
const int pos = qMin(unparsed.indexOf(QLatin1Char(' ')), 19);
if (pos < 0) {
address = 0;
data = unparsed;
return;
}
if (pos > 19 && unparsed.mid(3, 16).toULongLong())
pos = 19;
QString addr = unparsed.left(pos);
// MSVC 64bit: Remove 64bit separator 00000000`00a45000'.
if (addr.size() >= 9 && addr.at(8) == QLatin1Char('`'))
......@@ -55,8 +64,7 @@ DisassemblerLine::DisassemblerLine(const QString &unparsed)
addr.chop(1);
if (addr.startsWith(QLatin1String("0x")))
addr.remove(0, 2);
bool ok;
address = addr.toULongLong(&ok, 16);
address = addr.toULongLong(0, 16);
if (address)
data = unparsed.mid(pos + 1);
else
......
This diff is collapsed.
......@@ -407,17 +407,31 @@ private: ////////// View & Data Stuff //////////
//
// Disassembler specific stuff
//
// Chain of fallbacks: PointMixed -> PointPlain -> RangeMixed -> RangePlain.
// The Mi versions are not used right now.
void fetchDisassembler(DisassemblerAgent *agent);
void fetchDisassemblerByAddress(const DisassemblerAgentCookie &ac,
bool useMixedMode);
void fetchDisassemblerByCli(const DisassemblerAgentCookie &ac,
bool useMixedMode);
void fetchDisassemblerByAddressCli(const DisassemblerAgentCookie &ac);
void handleFetchDisassemblerByCli(const GdbResponse &response);
void handleFetchDisassemblerByLine(const GdbResponse &response);
void handleFetchDisassemblerByAddress1(const GdbResponse &response);
void handleFetchDisassemblerByAddress0(const GdbResponse &response);
DisassemblerLines parseDisassembler(const GdbMi &lines);
void fetchDisassemblerByCliPointMixed(const DisassemblerAgentCookie &ac);
void fetchDisassemblerByCliPointPlain(const DisassemblerAgentCookie &ac);
void fetchDisassemblerByCliRangeMixed(const DisassemblerAgentCookie &ac);
void fetchDisassemblerByCliRangePlain(const DisassemblerAgentCookie &ac);
//void fetchDisassemblerByMiPointMixed(const DisassemblerAgentCookie &ac);
//void fetchDisassemblerByMiPointPlain(const DisassemblerAgentCookie &ac);
//void fetchDisassemblerByMiRangeMixed(const DisassemblerAgentCookie &ac);
//void fetchDisassemblerByMiRangePlain(const DisassemblerAgentCookie &ac);
void handleFetchDisassemblerByCliPointMixed(const GdbResponse &response);
void handleFetchDisassemblerByCliPointPlain(const GdbResponse &response);
void handleFetchDisassemblerByCliRangeMixed(const GdbResponse &response);
void handleFetchDisassemblerByCliRangePlain(const GdbResponse &response);
//void handleFetchDisassemblerByMiPointMixed(const GdbResponse &response);
//void handleFetchDisassemblerByMiPointPlain(const GdbResponse &response);
//void handleFetchDisassemblerByMiRangeMixed(const GdbResponse &response);
//void handleFetchDisassemblerByMiRangePlain(const GdbResponse &response);
void handleDisassemblerCheck(const GdbResponse &response);
DisassemblerLines parseDisassembler(const GdbMi &data);
DisassemblerLines parseCliDisassembler(const GdbMi &lines);
DisassemblerLines parseMiDisassembler(const GdbMi &lines);
bool m_disassembleUsesComma;
//
// Source file specific stuff
......
Markdown is supported
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