mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Support for string literals with embedded zeroes
This commit is contained in:
parent
d11c79e43e
commit
dc7ebf12c5
3 changed files with 20 additions and 5 deletions
|
@ -789,6 +789,7 @@ DbgTypedValue DbgExprEvaluator::GetString(const StringImpl& str)
|
||||||
dbgValue.mType = charPtrType;
|
dbgValue.mType = charPtrType;
|
||||||
dbgValue.mLocalPtr = resultPtr->c_str();
|
dbgValue.mLocalPtr = resultPtr->c_str();
|
||||||
dbgValue.mIsLiteral = true;
|
dbgValue.mIsLiteral = true;
|
||||||
|
dbgValue.mDataLen = resultPtr->mLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dbgValue;
|
return dbgValue;
|
||||||
|
|
|
@ -51,7 +51,11 @@ public:
|
||||||
bool mIsLiteral;
|
bool mIsLiteral;
|
||||||
bool mHasNoValue;
|
bool mHasNoValue;
|
||||||
bool mIsReadOnly;
|
bool mIsReadOnly;
|
||||||
|
union
|
||||||
|
{
|
||||||
int mRegNum;
|
int mRegNum;
|
||||||
|
int mDataLen;
|
||||||
|
};
|
||||||
addr_target mSrcAddress;
|
addr_target mSrcAddress;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -6284,7 +6284,7 @@ String WinDebugger::ReadString(DbgTypeCode charType, intptr addr, bool isLocalAd
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
char c = GET_FROM(bufPtr, char);
|
char c = GET_FROM(bufPtr, char);
|
||||||
if (c != 0)
|
if ((c != 0) || (formatInfo.mOverrideCount != -1))
|
||||||
{
|
{
|
||||||
if ((uint8)c >= 0x80)
|
if ((uint8)c >= 0x80)
|
||||||
hasHighAscii = true;
|
hasHighAscii = true;
|
||||||
|
@ -6297,7 +6297,7 @@ String WinDebugger::ReadString(DbgTypeCode charType, intptr addr, bool isLocalAd
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
uint16 c16 = GET_FROM(bufPtr, uint16);
|
uint16 c16 = GET_FROM(bufPtr, uint16);
|
||||||
if (c16 != 0)
|
if ((c16 != 0) || (formatInfo.mOverrideCount != -1))
|
||||||
{
|
{
|
||||||
char str[8];
|
char str[8];
|
||||||
u8_toutf8(str, 8, c16);
|
u8_toutf8(str, 8, c16);
|
||||||
|
@ -6310,7 +6310,7 @@ String WinDebugger::ReadString(DbgTypeCode charType, intptr addr, bool isLocalAd
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
uint32 c32 = GET_FROM(bufPtr, uint32);
|
uint32 c32 = GET_FROM(bufPtr, uint32);
|
||||||
if (c32 != 0)
|
if ((c32 != 0) || (formatInfo.mOverrideCount != -1))
|
||||||
{
|
{
|
||||||
char str[8];
|
char str[8];
|
||||||
u8_toutf8(str, 8, c32);
|
u8_toutf8(str, 8, c32);
|
||||||
|
@ -7002,7 +7002,17 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
|
||||||
if ((!typedValue.mIsLiteral) && (!formatInfo.mHidePointers))
|
if ((!typedValue.mIsLiteral) && (!formatInfo.mHidePointers))
|
||||||
retVal = EncodeDataPtr(ptrVal, true);
|
retVal = EncodeDataPtr(ptrVal, true);
|
||||||
|
|
||||||
String strResult = ReadString(unmodInnerType->mTypeCode, typedValue.mLocalIntPtr, typedValue.mIsLiteral, typedValue.mIsLiteral ? strlen(typedValue.mCharPtr) : -1, formatInfo);
|
int strLen = -1;
|
||||||
|
if (typedValue.mIsLiteral)
|
||||||
|
{
|
||||||
|
if (typedValue.mDataLen > 0)
|
||||||
|
strLen = typedValue.mDataLen;
|
||||||
|
else
|
||||||
|
strLen = strlen(typedValue.mCharPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetAndRestoreValue<intptr> prevOverrideLen(formatInfo.mOverrideCount, strLen);
|
||||||
|
String strResult = ReadString(unmodInnerType->mTypeCode, typedValue.mLocalIntPtr, typedValue.mIsLiteral, strLen, formatInfo);
|
||||||
if (formatInfo.mRawString)
|
if (formatInfo.mRawString)
|
||||||
return strResult;
|
return strResult;
|
||||||
if (!strResult.IsEmpty())
|
if (!strResult.IsEmpty())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue