/*
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnSpy. If not, see .
*/
namespace dnSpy.Contracts.Debugger.Evaluation {
///
/// Result of evaluating an expression
///
public abstract class DbgValue : DbgObject {
///
/// Gets the process
///
public DbgProcess Process => Runtime.Process;
///
/// Gets the runtime
///
public abstract DbgRuntime Runtime { get; }
///
/// Gets the value object created by the debug engine
///
public abstract object InternalValue { get; }
///
/// Type of the value
///
public abstract DbgSimpleValueType ValueType { get; }
///
/// true if is valid
///
public abstract bool HasRawValue { get; }
///
/// The value. It's only valid if is true. A null value is a valid value.
/// If it's an enum value, it's stored as the enum's underlying type (eg. )
///
public abstract object? RawValue { get; }
///
/// Gets the address of the value or null if there's no address available.
/// The returned address gets invalid when the runtime continues.
///
/// If true and if it's a supported type (eg. a simple type such as integers,
/// floating point values, strings or byte arrays) the returned object contains the address of the actual
/// value, else the returned address and length covers the whole object including vtable, method table or other
/// special data.
///
public abstract DbgRawAddressValue? GetRawAddressValue(bool onlyDataAddress);
///
/// Closes this instance
///
public abstract void Close();
}
///
/// Type of value
///
public enum DbgSimpleValueType {
///
/// Some other type
///
Other,
///
/// There's no value
///
Void,
///
/// Boolean, is a boxed
///
Boolean,
///
/// 1-byte char, is a boxed
///
Char1,
///
/// Char, is a boxed
///
CharUtf16,
///
/// 8-bit signed int, is a boxed
///
Int8,
///
/// 16-bit signed int, is a boxed
///
Int16,
///
/// 32-bit signed int, is a boxed
///
Int32,
///
/// 64-bit signed int, is a boxed
///
Int64,
///
/// 8-bit unsigned int, is a boxed
///
UInt8,
///
/// 16-bit unsigned int, is a boxed
///
UInt16,
///
/// 32-bit unsigned int, is a boxed
///
UInt32,
///
/// 64-bit unsigned int, is a boxed
///
UInt64,
///
/// 32-bit floating point number, is a boxed
///
Float32,
///
/// 64-bit floating point number, is a boxed
///
Float64,
///
/// Decimal, is a boxed
///
Decimal,
///
/// 32-bit pointer, is a boxed
///
Ptr32,
///
/// 64-bit pointer, is a boxed
///
Ptr64,
///
/// UTF-16 string, is a or null
///
StringUtf16,
///
/// A , is a boxed
///
DateTime,
}
///
/// Contains the address and length of a value
///
public readonly struct DbgRawAddressValue {
///
/// Gets the address
///
public ulong Address { get; }
///
/// Gets the length
///
public ulong Length { get; }
///
/// Constructor
///
/// Address
/// Length
public DbgRawAddressValue(ulong address, ulong length) {
Address = address;
Length = length;
}
}
}