linux debugger: pascal type names

This commit is contained in:
Ivan Bondarev 2023-09-19 21:10:57 +02:00
parent d6bfc2ecc2
commit ddd5cb862a
3 changed files with 55 additions and 34 deletions

View file

@ -1097,7 +1097,6 @@ namespace VisualPascalABC
bool in_comm = false;
bool beg = false;
bool in_str = false;
Console.WriteLine("2 jump to " + stackFrame.SourceLocation.FileName + ":" + stackFrame.SourceLocation.Line);
for (int i = 0; i < lseg.Words.Count; i++)
{

View file

@ -67,11 +67,29 @@ namespace Mono.Debugging.Client
[NonSerialized]
StackFrame parentFrame;
static ObjectValue Create (IObjectValueSource source, ObjectPath path, string typeName)
static ObjectValue Create(IObjectValueSource source, ObjectPath path, string typeName)
{
var val = new ObjectValue ();
var val = new ObjectValue();
val.typeName = typeName;
int ptr_ind = val.typeName.IndexOf('*');
string ptr = "";
if (ptr_ind != -1)
ptr = val.typeName.Substring(ptr_ind).Replace('*', '^');
switch (val.typeName.Replace("*",""))
{
case "int": val.typeName = "integer"; break;
case "double": val.typeName = "real"; break;
case "float": val.typeName = "single"; break;
case "uint": val.typeName = "longword"; break;
case "long": val.typeName = "int64"; break;
case "ulong": val.typeName = "uint64"; break;
case "short": val.typeName = "smallint"; break;
case "ushort": val.typeName = "word"; break;
case "sbyte": val.typeName = "shortint"; break;
case "bool": val.typeName = "boolean"; break;
}
val.typeName = ptr+val.typeName.Replace("*", "");
val.source = source;
val.path = path;
return val;

View file

@ -1875,36 +1875,40 @@ namespace Mono.Debugger.Soft
return res;
}
static ElementType TypeCodeToElementType (TypeCode c, Type t) {
switch (c) {
case TypeCode.Boolean:
return ElementType.Boolean;
case TypeCode.Char:
return ElementType.Char;
case TypeCode.SByte:
return ElementType.I1;
case TypeCode.Byte:
return ElementType.U1;
case TypeCode.Int16:
return ElementType.I2;
case TypeCode.UInt16:
return ElementType.U2;
case TypeCode.Int32:
return ElementType.I4;
case TypeCode.UInt32:
return ElementType.U4;
case TypeCode.Int64:
return ElementType.I8;
case TypeCode.UInt64:
return ElementType.U8;
case TypeCode.Single:
return ElementType.R4;
case TypeCode.Double:
return ElementType.R8;
case TypeCode.Object:
return TypeCodeToElementType(Type.GetTypeCode (t.GetElementType()), t.GetElementType());
default:
throw new NotImplementedException ();
static ElementType TypeCodeToElementType(TypeCode c, Type t)
{
switch (c)
{
case TypeCode.Boolean:
return ElementType.Boolean;
case TypeCode.Char:
return ElementType.Char;
case TypeCode.SByte:
return ElementType.I1;
case TypeCode.Byte:
return ElementType.U1;
case TypeCode.Int16:
return ElementType.I2;
case TypeCode.UInt16:
return ElementType.U2;
case TypeCode.Int32:
return ElementType.I4;
case TypeCode.UInt32:
return ElementType.U4;
case TypeCode.Int64:
return ElementType.I8;
case TypeCode.UInt64:
return ElementType.U8;
case TypeCode.Single:
return ElementType.R4;
case TypeCode.Double:
return ElementType.R8;
case TypeCode.String:
return ElementType.String;
case TypeCode.Object:
return TypeCodeToElementType(Type.GetTypeCode(t.GetElementType()), t.GetElementType());
default:
throw new NotImplementedException();
}
}