1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Added float format flags

This commit is contained in:
Brian Fiete 2020-06-19 06:42:52 -07:00
parent 82a108714d
commit 271d88f261
7 changed files with 146 additions and 79 deletions

View file

@ -37,6 +37,15 @@ namespace IDE.Debugger
COUNT
}
public enum FloatDisplayType
{
Default,
Minimal,
Full,
Hexadecimal,
COUNT
}
public enum StringDisplayType
{
Default,
@ -190,10 +199,10 @@ namespace IDE.Debugger
static extern void* Debugger_CreateStepFilter(char8* filter, bool isGlobal, StepFilterKind stepFilterKind);
[CallingConvention(.Stdcall),CLink]
static extern void Debugger_SetDisplayTypes(char8* referenceId, IntDisplayType intDisplayType, MmDisplayType mmDisplayType);
static extern void Debugger_SetDisplayTypes(char8* referenceId, IntDisplayType intDisplayType, MmDisplayType mmDisplayType, FloatDisplayType floatDisplayType);
[CallingConvention(.Stdcall),CLink]
static extern bool Debugger_GetDisplayTypes(char8* referenceId, out IntDisplayType intDisplayType, out MmDisplayType mmDisplayType);
static extern bool Debugger_GetDisplayTypes(char8* referenceId, out IntDisplayType intDisplayType, out MmDisplayType mmDisplayType, out FloatDisplayType floatDisplayType);
[CallingConvention(.Stdcall),CLink]
static extern char8* Debugger_GetDisplayTypeNames();
@ -1033,14 +1042,14 @@ namespace IDE.Debugger
Debugger_WriteMemory(addr, size, data.CArray());
}
public void SetDisplayTypes(String referenceId, IntDisplayType intDisplayType, MmDisplayType mmDisplayType)
public void SetDisplayTypes(String referenceId, IntDisplayType intDisplayType, MmDisplayType mmDisplayType, FloatDisplayType floatDisplayType)
{
Debugger_SetDisplayTypes(referenceId, intDisplayType, mmDisplayType);
Debugger_SetDisplayTypes(referenceId, intDisplayType, mmDisplayType, floatDisplayType);
}
public bool GetDisplayTypes(String referenceId, out IntDisplayType intDisplayType, out MmDisplayType mmDisplayType)
public bool GetDisplayTypes(String referenceId, out IntDisplayType intDisplayType, out MmDisplayType mmDisplayType, out FloatDisplayType floatDisplayType)
{
return Debugger_GetDisplayTypes(referenceId, out intDisplayType, out mmDisplayType);
return Debugger_GetDisplayTypes(referenceId, out intDisplayType, out mmDisplayType, out floatDisplayType);
}
public void GetDisplayTypeNames(String outDisplayTypeNames)

View file

@ -1770,11 +1770,13 @@ namespace IDE
{
DebugManager.IntDisplayType intDisplayType;
DebugManager.MmDisplayType mmDisplayType;
mDebugger.GetDisplayTypes(referenceId, out intDisplayType, out mmDisplayType);
DebugManager.FloatDisplayType floatDisplayType;
mDebugger.GetDisplayTypes(referenceId, out intDisplayType, out mmDisplayType, out floatDisplayType);
using (sd.CreateObject(referenceId))
{
sd.Add("IntDisplayType", intDisplayType);
sd.Add("MmDisplayType", mmDisplayType);
sd.ConditionalAdd("IntDisplayType", intDisplayType);
sd.ConditionalAdd("MmDisplayType", mmDisplayType);
sd.ConditionalAdd("FloatDisplayType", floatDisplayType);
}
}
}
@ -2947,8 +2949,9 @@ namespace IDE
referenceIdStr = null;
var intDisplayType = data.GetEnum<DebugManager.IntDisplayType>("IntDisplayType");
var mmDisplayType = data.GetEnum<DebugManager.MmDisplayType>("MmDisplayType");
mDebugger.SetDisplayTypes(referenceIdStr, intDisplayType, mmDisplayType);
var mmDisplayType = data.GetEnum<DebugManager.MmDisplayType>("MmDisplayType");
var floatDisplayType = data.GetEnum<DebugManager.FloatDisplayType>("FloatDisplayType");
mDebugger.SetDisplayTypes(referenceIdStr, intDisplayType, mmDisplayType, floatDisplayType);
}
for (data.Enumerate("StepFilters"))
@ -5757,7 +5760,7 @@ namespace IDE
String outKey;
FileEditData editData;
if (mFileEditData.TryGetValue(oldFixedFilePath, out outKey, out editData))
if (mFileEditData.TryGet(oldFixedFilePath, out outKey, out editData))
{
mFileEditData.Remove(oldFixedFilePath);
delete outKey;
@ -7023,7 +7026,7 @@ namespace IDE
KeyState matchedKey;
IDECommandBase commandBase;
if (curKeyMap.mMap.TryGetValue(keyState, out matchedKey, out commandBase))
if (curKeyMap.mMap.TryGet(keyState, out matchedKey, out commandBase))
{
if (var commandMap = commandBase as CommandMap)
{

View file

@ -19,13 +19,14 @@ namespace IDE.ui
None = 0,
Value = 1,
Int = 2,
MM128 = 4,
Object = 8,
Pointer = 0x10,
TypeClass = 0x20,
TypeValueType = 0x40,
Namespace = 0x80,
Text = 0x100
Float = 4,
MM128 = 8,
Object = 0x10,
Pointer = 0x20,
TypeClass = 0x40,
TypeValueType = 0x80,
Namespace = 0x100,
Text = 0x200
}
public class WatchEntry
@ -70,41 +71,44 @@ namespace IDE.ui
{
switch (scope String(cmd[0]))
{
case ":type":
switch (scope String(cmd[1]))
{
case "object":
mResultType |= WatchResultType.Object;
return true;
case "pointer":
mResultType |= WatchResultType.Pointer;
return true;
case "class":
mResultType |= WatchResultType.TypeClass;
return true;
case "valuetype":
mResultType |= WatchResultType.TypeValueType;
return true;
case "namespace":
mResultType |= WatchResultType.Namespace;
return true;
case "int":
mResultType |= WatchResultType.Int;
return true;
case "mm128":
mResultType |= WatchResultType.MM128;
return true;
}
break;
case ":appendAlloc":
mIsAppendAlloc = true;
case ":type":
switch (scope String(cmd[1]))
{
case "object":
mResultType |= WatchResultType.Object;
return true;
case ":stack":
mIsStackAlloc = true;
return true;
case ":deleted":
mIsDeleted = true;
case "pointer":
mResultType |= WatchResultType.Pointer;
return true;
case "class":
mResultType |= WatchResultType.TypeClass;
return true;
case "valuetype":
mResultType |= WatchResultType.TypeValueType;
return true;
case "namespace":
mResultType |= WatchResultType.Namespace;
return true;
case "int":
mResultType |= WatchResultType.Int;
return true;
case "float":
mResultType |= WatchResultType.Float;
return true;
case "mm128":
mResultType |= WatchResultType.MM128;
return true;
}
break;
case ":appendAlloc":
mIsAppendAlloc = true;
return true;
case ":stack":
mIsStackAlloc = true;
return true;
case ":deleted":
mIsDeleted = true;
return true;
}
return false;
@ -2626,34 +2630,32 @@ namespace IDE.ui
menuItem.mOnMenuItemSelected.Add(new (imenu) => action() ~ { delete action; });
}
public static void SetDisplayType(String referenceId, DebugManager.IntDisplayType intDisplayType, DebugManager.MmDisplayType mmDisplayType)
public static void SetDisplayType(String referenceId, DebugManager.IntDisplayType intDisplayType, DebugManager.MmDisplayType mmDisplayType, DebugManager.FloatDisplayType floatDisplayType)
{
var debugger = IDEApp.sApp.mDebugger;
debugger.SetDisplayTypes(referenceId, intDisplayType, mmDisplayType);
IDEApp.sApp.RefreshWatches();
gApp.mDebugger.SetDisplayTypes(referenceId, intDisplayType, mmDisplayType, floatDisplayType);
gApp.RefreshWatches();
}
public static bool AddDisplayTypeMenu(String label, Menu menu, WatchResultType watchResultType, String referenceId, bool includeDefault)
{
bool hasInt = watchResultType.HasFlag(WatchResultType.Int);
bool hasFloat = watchResultType.HasFlag(WatchResultType.Float);
bool hasMM128 = watchResultType.HasFlag(WatchResultType.MM128);
bool canSetFormat = hasInt || hasMM128;
bool canSetFormat = hasInt || hasFloat || hasMM128;
var debugger = IDEApp.sApp.mDebugger;
DebugManager.IntDisplayType intDisplayType;
DebugManager.MmDisplayType mmDisplayType;
bool foundSpecific = debugger.GetDisplayTypes(referenceId, out intDisplayType, out mmDisplayType);
bool foundSpecific = debugger.GetDisplayTypes(referenceId, var intDisplayType, var mmDisplayType, var floatDisplayType);
if ((referenceId != null) && (!foundSpecific))
{
intDisplayType = DebugManager.IntDisplayType.Default;
mmDisplayType = DebugManager.MmDisplayType.Default;
intDisplayType = .Default;
mmDisplayType = .Default;
floatDisplayType = .Default;
}
if (!canSetFormat)
return false;
Menu parentItem = menu.AddItem(label);
//anItem.mIconImage = DarkTheme.sDarkTheme.GetImage(DarkTheme.ImageIdx.Check);
if (hasInt)
{
for (DebugManager.IntDisplayType i = default; i < DebugManager.IntDisplayType.COUNT; i++)
@ -2667,17 +2669,34 @@ namespace IDE.ui
var toType = i;
AddSelectableMenuItem(parentItem, ToStackString!(i), intDisplayType == i,
new () => SetDisplayType(referenceId, toType, mmDisplayType));
new () => SetDisplayType(referenceId, toType, mmDisplayType, floatDisplayType));
}
}
if (hasFloat)
{
for (DebugManager.FloatDisplayType i = default; i < DebugManager.FloatDisplayType.COUNT; i++)
{
if ((i == 0) && (!includeDefault))
{
if (floatDisplayType == 0)
floatDisplayType = DebugManager.FloatDisplayType.Minimal;
continue;
}
var toType = i;
AddSelectableMenuItem(parentItem, ToStackString!(i), floatDisplayType == i,
new () => SetDisplayType(referenceId, intDisplayType, mmDisplayType, toType));
}
}
if (hasMM128)
{
for (DebugManager.MmDisplayType i = default; i < DebugManager.MmDisplayType.COUNT; i++)
{
var toType = i;
AddSelectableMenuItem(parentItem, ToStackString!(i), mmDisplayType == i,
new () => SetDisplayType(referenceId, intDisplayType, toType));
new () => SetDisplayType(referenceId, intDisplayType, toType, floatDisplayType));
}
}
return true;