forked from qt-creator/qt-creator
Debugger: Consolidate memoryToHex{W,} in CDB helpers
Only one is really needed. Change-Id: I43eb36336faa1f73a93f685fa60e518ee9225abb Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -120,9 +120,9 @@ static StopReasonMap breakPointStopReasonParameters(PDEBUG_BREAKPOINT b)
|
|||||||
if (CIDebugClient *client = ExtensionContext::instance().hookedClient()) {
|
if (CIDebugClient *client = ExtensionContext::instance().hookedClient()) {
|
||||||
IInterfacePointer<CIDebugDataSpaces> dataSpaces(client);
|
IInterfacePointer<CIDebugDataSpaces> dataSpaces(client);
|
||||||
if (dataSpaces) {
|
if (dataSpaces) {
|
||||||
const std::wstring memoryHex = memoryToHexW(dataSpaces.data(), memoryRange.first, memoryRange.second);
|
const std::string memoryHex = memoryToHex(dataSpaces.data(), memoryRange.first, memoryRange.second);
|
||||||
if (!memoryHex.empty())
|
if (!memoryHex.empty())
|
||||||
rc.insert(StopReasonMapValue("memory", wStringToString(memoryHex)));
|
rc.insert(StopReasonMapValue("memory", memoryHex));
|
||||||
} // dataSpaces
|
} // dataSpaces
|
||||||
} // client
|
} // client
|
||||||
return rc;
|
return rc;
|
||||||
|
|||||||
@@ -592,17 +592,6 @@ std::string memoryToHex(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring memoryToHexW(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
|
|
||||||
std::string *errorMessage /* = 0 */)
|
|
||||||
{
|
|
||||||
if (const unsigned char *buffer = SymbolGroupValue::readMemory(ds, address, length, errorMessage)) {
|
|
||||||
const std::wstring hex = dataToHexW(buffer, buffer + length);
|
|
||||||
delete [] buffer;
|
|
||||||
return hex;
|
|
||||||
}
|
|
||||||
return std::wstring();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format stack as GDBMI
|
// Format stack as GDBMI
|
||||||
static StackFrames getStackTrace(CIDebugControl *debugControl,
|
static StackFrames getStackTrace(CIDebugControl *debugControl,
|
||||||
CIDebugSymbols *debugSymbols,
|
CIDebugSymbols *debugSymbols,
|
||||||
@@ -789,9 +778,9 @@ static bool gdbmiFormatBreakpoint(std::ostream &str,
|
|||||||
// Report the memory of watchpoints for comparing bitfields
|
// Report the memory of watchpoints for comparing bitfields
|
||||||
if (dataSpaces && memoryRange.second > 0) {
|
if (dataSpaces && memoryRange.second > 0) {
|
||||||
str << ",size=\"" << memoryRange.second << '"';
|
str << ",size=\"" << memoryRange.second << '"';
|
||||||
const std::wstring memoryHex = memoryToHexW(dataSpaces, memoryRange.first, memoryRange.second);
|
const std::string memoryHex = memoryToHex(dataSpaces, memoryRange.first, memoryRange.second);
|
||||||
if (!memoryHex.empty())
|
if (!memoryHex.empty())
|
||||||
str << ",memory=\"" << gdbmiWStringFormat(memoryHex) << '"';
|
str << ",memory=\"" << gdbmiStringFormat(memoryHex) << '"';
|
||||||
}
|
}
|
||||||
} // Got address
|
} // Got address
|
||||||
} // !deferred
|
} // !deferred
|
||||||
|
|||||||
@@ -164,8 +164,6 @@ std::string gdbmiRegisters(CIDebugRegisters *regs,
|
|||||||
|
|
||||||
std::string memoryToHex(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
|
std::string memoryToHex(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
|
||||||
std::string *errorMessage = 0);
|
std::string *errorMessage = 0);
|
||||||
std::wstring memoryToHexW(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
|
|
||||||
std::string *errorMessage = 0);
|
|
||||||
// Stack helpers
|
// Stack helpers
|
||||||
StackFrames getStackTrace(CIDebugControl *debugControl, CIDebugSymbols *debugSymbols,
|
StackFrames getStackTrace(CIDebugControl *debugControl, CIDebugSymbols *debugSymbols,
|
||||||
unsigned maxFrames, bool *incomplete, std::string *errorMessage);
|
unsigned maxFrames, bool *incomplete, std::string *errorMessage);
|
||||||
|
|||||||
Reference in New Issue
Block a user