Working with MS VM
 In this topic

*IRemoteField : IUnknown

*IRemoteDataField : IRemoteField

*IRemoteArrayField : IRemoteDataField

*IRemoteContainerField : IRemoteField

*IRemoteClassField : IRemoteContainerField

*IRemoteMethodField : IRemoteContainerField

*IEnumRemoteField : IUnknown

*IEnumLINEINFO : IUnknown

 

Microsoft VM    PreviousVMNext
Java Debugger Interfaces     Previous VM Next

 


Static Information Interfaces

Use these interfaces to retrieve information about classes, methods, and fields.

IRemoteField : IUnknown

The IRemoteField hierarchy of interfaces represents fields that are members of classes. These fields can be methods, objects, or nested class definitions. You can think of global classes (classes not defined within other classes) as being fields of a global class. For example:

class <globals>					// FIELD_KIND_CLASS
{
	class FooClass				// FIELD_KIND_CLASS
	{
		boolean m_i;			// FIELD_KIND_DATA

		class BarClass			// FIELD_KIND_CLASS
		{
			String m_rgstr[5];	// FIELD_KIND_ARRAY
		};

		BarClass m_bar;			// FIELD_KIND_DATA

		int Method();			// FIELD_KIND_METHOD
	};
};

Since all the attributes of a field are constant during that field's lifetime, the debugger can cache this information.

GetName

HRESULT GetName(LPOLESTR *ppszName)

ParameterDescription
[out] ppszName Returns the identifier for this field; for example, "FooClass", "m_i", "m_bar", "Method", and so on.

GetKind

HRESULT GetKind(FIELDKIND *pKind)

ParameterDescription
[out] pKind Returns the kind of this field.
typedef enum fieldkind {
	FIELD_KIND_DATA_OBJECT		= 0x0001,
	FIELD_KIND_DATA_PRIMITIVE	= 0x0002,
	FIELD_KIND_ARRAY			= 0x0004,
	FIELD_KIND_CLASS			= 0x0008,
	FIELD_KIND_METHOD			= 0x0010,
	FIELD_KIND_LOCAL			= 0x1000,
	FIELD_KIND_PARAM			= 0x2000,
	FIELD_KIND_THIS			= 0x4000,
} FIELDKIND;

GetType

HRESULT GetType(IRemoteField **ppType)

ParameterDescription
[out] ppType Returns the type of this field.

Remarks:

The relationship between a field and its type depends on the "kind" of the field. This relationship is defined in the interfaces derived from IRemoteField.

GetContainer

HRESULT GetContainer(IRemoteContainerField **ppContainer)

ParameterDescription
[out] ppContainer Returns the field representing the class that contains the field. For example, calling this method on the field that represents "m_rgstr" in the preceding example will return the field for its containing class "BarClass".

GetModifiers

HRESULT GetModifiers(ULONG *pulModifiers)

ParameterDescription
[out] pulModifiers Returns a bitmask of flags containing the modifiers for this type.

Remarks:

If a bit is set then the type is modified in that way. The modifier bits are the same as those used in the access_flags field of the .class file header.

typedef enum fieldmodifiers
{
	FIELD_ACC_PUBLIC		= 0x0001,
	FIELD_ACC_PRIVATE		= 0x0002,
	FIELD_ACC_PROTECTED	= 0x0004,
	FIELD_ACC_STATIC		= 0x0008,
	FIELD_ACC_FINAL		= 0x0010,
	FIELD_ACC_SYNCHRONIZED	= 0x0020,
	FIELD_ACC_VOLATILE	= 0x0040,
	FIELD_ACC_TRANSIENT	= 0x0080,
	FIELD_ACC_NATIVE		= 0x0100,
	FIELD_ACC_INTERFACE	= 0x0200,
	FIELD_ACC_ABSTRACT	= 0x0400,
}
FIELDMODIFIERS;

IRemoteDataField : IRemoteField

Represents a field that is not a method (FIELD_KIND_METHOD), or a class definition (FIELD_KIND_CLASS).

GetKind

HRESULT GetKind(UINT *piKind)

ParameterDescription
[out] piKind Returns FIELD_KIND_DATA.

GetType

HRESULT GetType(IRemoteField **ppType)

ParameterDescription
[out] ppType Returns the type of the data field.

Remarks:

The type will always be a class (built-in types also have IRemoteClassField objects that represent them). For the previous example, calling this method on the field representing "m_bar" will return the IRemoteClassField that represents the class "BarClass". Calling this method for "m_b" will return the IRemoteClassField representing the built-in class "boolean".

IRemoteArrayField : IRemoteDataField

Represents special data fields—arrays. The only major difference between data fields and arrays is that arrays have a size. You cannot access the elements of an array through its field because the field is not bound to an instance of the array. You can use the IRemoteArrayObject interface to extract the elements from an instance of an array.

GetKind

HRESULT GetKind(UINT *piKind)

ParameterDescription
[out] piKind Returns FIELD_KIND_ARRAY.

GetType

HRESULT GetType(IRemoteField **ppType)

ParameterDescription
[out] ppType Returns the type of the array's elements.

GetSize

HRESULT GetSize(UINT *pcElements)

ParameterDescription
[out] pcElements Returns the number of elements in the array.

IRemoteContainerField : IRemoteField

Represents fields that contain other fields. IRemoteContainerField is an abstract interface.

GetFields

HRESULT GetFields(IEnumRemoteField **ppEnum, FIELDKIND ulKind, FIELDMODIFIERS ulModifiers, LPCOLESTR lpcszName)

ParameterDescription
[out] ppEnum Returns an enumerator for the fields that are contained by this field and match the given characteristics.
[in] ulKind Bitmask of flags indicating the kinds of fields to be included in the enumeration. Use zero to include all kinds.
[in] ulModifiers Bitmask of flags indicating the modifiers of fields to be included in the enumeration. Use zero to include all modifiers.
[in] lpcszName Name of the field to be included in the enumeration. Use NULL to include all names.

IRemoteClassField : IRemoteContainerField

Represents a class definition.

GetKind

HRESULT GetKind(UINT *piKind)

ParameterDescription
[out] piKind Returns FIELD_KIND_CLASS.

GetType

HRESULT GetType(IRemoteField **ppType)

ParameterDescription
[out] ppType Returns NULL.

GetFileName

HRESULT GetFileName(LPOLESTR *ppszFileName)

ParameterDescription
[out] ppszFileName Returns the full path of the file that contains this class if it is available; for example, "c:\classes\HelloWorld.class".

GetSourceFileName

HRESULT GetSourceFileName(LPOLESTR *ppszSourceFileName)

ParameterDescription
[out] ppszSourceFileName Returns the name of the source file used to create this class; for example, "HelloWorld.java".

GetSuperclass

HRESULT GetSuperclass(IRemoteClassField **ppSuperclass)

ParameterDescription
[out] ppSuperclass Returns the class from which this class is derived.

GetInterfaces

HRESULT GetInterfaces(IEnumRemoteField **ppEnum)

ParameterDescription
[out] ppEnum Returns an enumerator for the interfaces that this class implements.

GetConstantPoolItem

HRESULT GetConstantPoolItem(ULONG indexCP, BYTE **ppCPBytes, ULONG *plength)

ParameterDescription
[in] indexCP Index in the constant pool of this class of the entry to be retrieved.
[out] ppCPBytes Returns the constant pool data of the requested entry.
[out] plength Returns the length of the returned constant pool entry, in bytes.

IRemoteMethodField : IRemoteContainerField

Represents a method within a class.

GetKind

HRESULT GetKind(UINT *piKind)

ParameterDescription
[out] piKind Returns FIELD_KIND_METHOD.

GetType

HRESULT GetType(IRemoteField **ppType)

ParameterDescription
[out] ppType Returns the return type of this method.

SetBreakpoint

HRESULT SetBreakpoint(UINT offPC)

Sets a code breakpoint at a given byte offset from the start of the method.

ParameterDescription
[in] offPC Byte offset within this method.

ClearBreakpoint

HRESULT ClearBreakpoint(UINT offPC)

Clears a code breakpoint at a given byte offset from the start of the method.

ParameterDescription
[in] offPC Byte offset within this method.

GetLineInfo

HRESULT GetLineInfo(IEnumLINEINFO **ppEnum)

ParameterDescription
[out] ppEnum Returns an enumerator of LINEINFO structures describing the mapping between source lines and byte offset within this method. This mapping is in order of increasing offsets. The last element in the list is a dummy node with the line number field set to (the last line of the method + 1) and the offset field set to (the last offset in the method + 1).

GetBytes

HRESULT GetBytes(ILockBytes **ppLockBytes)

ParameterDescription
[out] ppLockBytes Returns an ILockBytes interface that you can use to access this method's bytecode.

GetScope

HRESULT GetScope(IRemoteField *pField, ULONG *poffStart, ULONG *pcbScope)

ParameterDescription
[in] pField Field whose scope within this method is to be determined.
[out] poffStart Byte offset within this method where the scope of the given field begins.
[out] pcbScope Length of the scope of the given field in this method, in bytes.

GetIndexedField

HRESULT GetIndexedField(ULONG slot, ULONG offPC,  IRemoteField **ppField)

ParameterDescription
[in] slot Slot in this method of the field to be retrieved.
[in] offPC Byte offset within this method indicating the given slot's execution context.
[out] ppField Field contained by the given slot at the given byte offset.

IEnumRemoteField : IUnknown

Enumerates fields.

Next

HRESULT Next(ULONG celt, IRemoteField *rgelt[], ULONG *pceltFetched)

Skip

HRESULT Skip(ULONG celt)

Reset

HRESULT Reset(void)

Clone

HRESULT Clone(IEnumRemoteField **ppEnum)

IEnumLINEINFO : IUnknown

Enumerates line number information for a method.

Next

HRESULT Next(ULONG celt, LPLINEINFO rgelt, ULONG *pceltFetched)

Remarks:

typedef struct lineinfo {
	USHORT iLine;		// line number
	USHORT offPC;		// byte offset in method
} LINEINFO;

Skip

HRESULT Skip(ULONG celt)

Reset

HRESULT Reset(void)

Clone

HRESULT Clone(IEnumLINEINFO **ppEnum)

GetCount

HRESULT GetCount(ULONG *pcelt)

ParameterDescription
[out] pcelt Returns the number of elements available through this enumerator.

Top © 1998 Microsoft Corporation. All rights reserved. Terms of use.