1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-12 13:24:09 +02:00

Added !raw immediate window command for string dumps

This commit is contained in:
Brian Fiete 2021-02-08 09:56:24 -08:00
parent 66adc12f73
commit 0f014cbec8
6 changed files with 61 additions and 6 deletions

View file

@ -96,7 +96,8 @@ namespace IDE.Debugger
MemoryAddress = 0x40,
MemoryWatch = 0x80,
Symbol = 0x100,
StepIntoCall = 0x200
StepIntoCall = 0x200,
RawStr = 0x400,
}
[Reflect]

View file

@ -718,6 +718,14 @@ namespace IDE.ui
var watch = useListViewItem.mWatchEntry;
String.NewOrSet!(watch.mName, displayString);
String.NewOrSet!(watch.mEvalStr, evalString);
if (watch.mEvalStr.StartsWith("!raw"))
{
for (int i < 4)
watch.mEvalStr[i] = ' ';
watch.mResultType = .RawText;
}
useListViewItem.mWatchEntry = watch;
if (!isLiteral)
useListViewItem.Label = displayString;
@ -759,11 +767,13 @@ namespace IDE.ui
flags |= .AllowSideEffects | .AllowCalls;
if (gApp.mSettings.mDebuggerSettings.mAutoEvaluateProperties)
flags |= .AllowProperties;
if (watch.mResultType == .RawText)
flags |= .RawStr;
DebugManager.Language language = mLanguage;
if (parentWatchEntry != null)
language = parentWatchEntry.mLanguage;
gApp.DebugEvaluate(null, evalString, val, -1, language, flags);
gApp.DebugEvaluate(null, watch.mEvalStr, val, -1, language, flags);
}
if (val == "!pending")
{
@ -773,6 +783,13 @@ namespace IDE.ui
}
watch.mIsPending = false;
}
if (watch.mResultType == .RawText)
{
String.NewOrSet!(valueSubItem.mLabel, val);
return useListViewItem;
}
var vals = scope List<StringView>(val.Split('\n'));
//if (!vals[0].IsEmpty)

View file

@ -7,6 +7,7 @@ using Beefy.theme.dark;
using Beefy.gfx;
using System.Diagnostics;
using System.IO;
using IDE.Debugger;
namespace IDE.ui
{
@ -379,6 +380,10 @@ namespace IDE.ui
var subItemLabel = result.GetSubItem(1).mLabel;
if (subItemLabel == null)
subItemLabel = "";
if (result.mWatchEntry.mResultType == .RawText)
mEditWidgetContent.AppendText(scope String(subItemLabel, "\n"));
else
mEditWidgetContent.AppendText(scope String(" ", subItemLabel, "\n"));
if (result.mWatchEntry.mWarnings != null)
@ -415,6 +420,10 @@ namespace IDE.ui
for (int32 i = startPos; i < mEditWidgetContent.mData.mTextLength; i++)
mEditWidgetContent.mData.mText[i].mDisplayTypeId = (uint8)SourceElementType.Error;
}
else if (result.mWatchEntry.mResultType == .RawText)
{
// No info button
}
else
{
mInfoButton.Resize(resultX - GS!(3), resultY - GS!(2), GS!(20), GS!(20));
@ -547,7 +556,16 @@ namespace IDE.ui
}
else
{
gApp.DebugEvaluate(null, cmdText, val, mEditWidgetContent.CursorTextPos - mEntryStartPos.mIndex - 2);
DebugManager.EvalExpressionFlags flags = .None;
if (cmdText.StartsWith("!raw"))
{
for (int i < 4)
cmdText[i] = ' ';
flags |= .RawStr;
}
gApp.DebugEvaluate(null, cmdText, val, mEditWidgetContent.CursorTextPos - mEntryStartPos.mIndex - 2, .NotSet, flags);
gApp.mIsImmediateDebugExprEval = true;
}
}
@ -570,8 +588,20 @@ namespace IDE.ui
}
var info = scope String()..Append(val, idx + ":autocomplete\n".Length);
if (!editWidgetContent.mAutoComplete.mIsDocumentationPass)
{
if ((cmdText.StartsWith("!")) && (!cmdText.Contains(' ')))
{
if ("!raw".Contains(cmdText))
info.Append("cmd\traw\n");
if ("!info".Contains(cmdText))
info.Append("cmd\tinfo\n");
if ("!step".Contains(cmdText))
info.Append("cmd\tstep\n");
}
editWidgetContent.mAutoComplete.SetInfo(info, true, mEntryStartPos.mIndex + 1);
}
}
else if (editWidgetContent.mAutoComplete != null)
editWidgetContent.mAutoComplete.Close();
}

View file

@ -27,7 +27,8 @@ namespace IDE.ui
TypeClass = 0x80,
TypeValueType = 0x100,
Namespace = 0x200,
Text = 0x400
Text = 0x400,
RawText = 0x800
}
public class WatchEntry

View file

@ -120,6 +120,7 @@ enum DwEvalExpressionFlags : int16
DwEvalExpressionFlag_MemoryWatch = 0x80,
DwEvalExpressionFlag_Symbol = 0x100,
DwEvalExpressionFlag_StepIntoCalls = 0x200,
DwEvalExpressionFlag_RawStr = 0x400
};
struct DwDisplayInfo

View file

@ -9504,6 +9504,11 @@ String WinDebugger::Evaluate(const StringImpl& expr, DwFormatInfo formatInfo, in
expressionFlags = (DwEvalExpressionFlags)(expressionFlags & ~DwEvalExpressionFlag_AllowCalls);
}
if ((expressionFlags & DwEvalExpressionFlag_RawStr) != 0)
{
formatInfo.mRawString = true;
}
auto dbgModule = GetCallStackDbgModule(callStackIdx);
auto dbgSubprogram = GetCallStackSubprogram(callStackIdx);
DbgCompileUnit* dbgCompileUnit = NULL;