本文整理汇总了C#中TargetMemoryAccess.ReadMemory方法的典型用法代码示例。如果您正苦于以下问题:C# TargetMemoryAccess.ReadMemory方法的具体用法?C# TargetMemoryAccess.ReadMemory怎么用?C# TargetMemoryAccess.ReadMemory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TargetMemoryAccess
的用法示例。
在下文中一共展示了TargetMemoryAccess.ReadMemory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAppDomainInfo
public AppDomainInfo GetAppDomainInfo(MonoLanguageBackend mono, TargetMemoryAccess memory,
TargetAddress address)
{
int addr_size = memory.TargetMemoryInfo.TargetAddressSize;
TargetReader reader = new TargetReader (memory.ReadMemory (address, 12 * addr_size));
return new AppDomainInfo (mono, memory, reader);
}
示例2: read_range_entry
Method read_range_entry(TargetMemoryAccess target, TargetAddress address)
{
int size = target.ReadInteger (address);
TargetReader reader = new TargetReader (target.ReadMemory (address, size));
byte[] contents = reader.BinaryReader.PeekBuffer (size);
reader.BinaryReader.ReadInt32 ();
int file_idx = reader.BinaryReader.ReadInt32 ();
MonoSymbolFile file = (MonoSymbolFile) symfile_by_index [file_idx];
return file.ReadRangeEntry (target, reader, contents);
}
示例3: do_read_symbol_table
// This method reads the MonoDebuggerSymbolTable structure
// (struct definition is in mono-debug-debugger.h)
void do_read_symbol_table(TargetMemoryAccess memory)
{
TargetAddress symtab_address = memory.ReadAddress (info.SymbolTable);
if (symtab_address.IsNull)
throw new SymbolTableException ("Symbol table is null.");
TargetReader header = new TargetReader (
memory.ReadMemory (symtab_address, info.SymbolTableSize));
long magic = header.BinaryReader.ReadInt64 ();
if (magic != MonoDebuggerInfo.DynamicMagic)
throw new SymbolTableException (
"Debugger symbol table has unknown magic {0:x}.", magic);
int version = header.ReadInteger ();
if (version < MonoDebuggerInfo.MinDynamicVersion)
throw new SymbolTableException (
"Debugger symbol table has version {0}, but " +
"expected at least {1}.", version,
MonoDebuggerInfo.MinDynamicVersion);
if (version > MonoDebuggerInfo.MaxDynamicVersion)
throw new SymbolTableException (
"Debugger symbol table has version {0}, but " +
"expected at most {1}.", version,
MonoDebuggerInfo.MaxDynamicVersion);
int total_size = header.ReadInteger ();
if (total_size != info.SymbolTableSize)
throw new SymbolTableException (
"Debugger symbol table has size {0}, but " +
"expected {1}.", total_size, info.SymbolTableSize);
TargetAddress corlib_address = header.ReadAddress ();
TargetAddress global_data_table_ptr = header.ReadAddress ();
TargetAddress data_table_list = header.ReadAddress ();
TargetAddress symfile_by_index = header.ReadAddress ();
if (corlib_address.IsNull)
throw new SymbolTableException ("Corlib address is null.");
corlib = load_symfile (memory, corlib_address);
if (corlib == null)
throw new SymbolTableException ("Cannot read corlib!");
TargetAddress ptr = symfile_by_index;
while (!ptr.IsNull) {
TargetAddress next_ptr = memory.ReadAddress (ptr);
TargetAddress address = memory.ReadAddress (
ptr + memory.TargetMemoryInfo.TargetAddressSize);
ptr = next_ptr;
load_symfile (memory, address);
}
ptr = data_table_list;
while (!ptr.IsNull) {
TargetAddress next_ptr = memory.ReadAddress (ptr);
TargetAddress address = memory.ReadAddress (
ptr + memory.TargetMemoryInfo.TargetAddressSize);
ptr = next_ptr;
add_data_table (memory, address);
}
global_data_table = new GlobalDataTable (this, global_data_table_ptr);
}
示例4: create_appdomain
void create_appdomain(TargetMemoryAccess memory, TargetAddress address)
{
int addr_size = memory.TargetMemoryInfo.TargetAddressSize;
TargetReader reader = new TargetReader (
memory.ReadMemory (address, 8 + 3 * addr_size));
int id = reader.BinaryReader.ReadInt32 ();
int shadow_path_len = reader.BinaryReader.ReadInt32 ();
TargetAddress shadow_path_addr = reader.ReadAddress ();
string shadow_path = null;
if (!shadow_path_addr.IsNull) {
byte[] buffer = memory.ReadBuffer (shadow_path_addr, shadow_path_len);
char[] cbuffer = new char [buffer.Length];
for (int i = 0; i < buffer.Length; i++)
cbuffer [i] = (char) buffer [i];
shadow_path = new String (cbuffer);
}
TargetAddress domain = reader.ReadAddress ();
TargetAddress setup = reader.ReadAddress ();
MetadataHelper.AppDomainInfo info = MetadataHelper.GetAppDomainInfo (this, memory, setup);
info.ShadowCopyPath = shadow_path;
appdomain_info.Add (id, info);
}
示例5: add_data_table
void add_data_table(TargetMemoryAccess memory, TargetAddress ptr)
{
int table_size = 8 + 2 * memory.TargetMemoryInfo.TargetAddressSize;
TargetReader reader = new TargetReader (memory.ReadMemory (ptr, table_size));
int domain = reader.ReadInteger ();
reader.Offset += 4;
DomainDataTable table = (DomainDataTable) data_tables [domain];
if (table == null) {
TargetAddress first_chunk = reader.ReadAddress ();
table = new DomainDataTable (this, domain, ptr, first_chunk);
data_tables.Add (domain, table);
}
}
示例6: GetMonoTrampoline
protected override bool GetMonoTrampoline(TargetMemoryAccess memory,
TargetAddress call_target,
out TargetAddress trampoline)
{
TargetBinaryReader reader = memory.ReadMemory (call_target, 14).GetReader ();
byte opcode = reader.ReadByte ();
if (opcode != 0xe8) {
trampoline = TargetAddress.Null;
return false;
}
TargetAddress call = call_target + reader.ReadInt32 () + 5;
if (!Opcodes.Process.MonoLanguage.IsTrampolineAddress (call)) {
trampoline = TargetAddress.Null;
return false;
}
trampoline = call_target;
return true;
}
示例7: GetGenericParameter
public GenericParamInfo GetGenericParameter(TargetMemoryAccess memory,
TargetAddress address)
{
int addr_size = memory.TargetMemoryInfo.TargetAddressSize;
TargetReader reader = new TargetReader (
memory.ReadMemory (address, 4 * addr_size + 4));
TargetAddress container = reader.ReadAddress ();
TargetAddress klass = reader.ReadAddress ();
TargetAddress name_addr = reader.ReadAddress ();
reader.BinaryReader.ReadInt16 (); /* flags */
int pos = reader.BinaryReader.ReadInt16 ();
string name;
if (!name_addr.IsNull)
name = memory.ReadString (name_addr);
else
name = String.Format ("!{0}", pos);
return new GenericParamInfo (container, klass, name, pos);
}
示例8: GetLMF
internal override StackFrame GetLMF(ThreadServant thread, TargetMemoryAccess memory, ref TargetAddress lmf_address)
{
TargetAddress lmf = lmf_address;
TargetBinaryReader reader = memory.ReadMemory (lmf_address, 88).GetReader ();
lmf_address = reader.ReadTargetAddress (); // prev
reader.ReadTargetAddress ();
reader.ReadTargetAddress (); // method
TargetAddress rip = reader.ReadTargetAddress ();
if (lmf_address.IsNull)
return null;
TargetAddress rbx = reader.ReadTargetAddress ();
TargetAddress rbp = reader.ReadTargetAddress ();
TargetAddress rsp = reader.ReadTargetAddress ();
TargetAddress r12 = reader.ReadTargetAddress ();
TargetAddress r13 = reader.ReadTargetAddress ();
TargetAddress r14 = reader.ReadTargetAddress ();
TargetAddress r15 = reader.ReadTargetAddress ();
Registers regs = new Registers (this);
if ((lmf_address.Address & 1) == 0) {
rip = memory.ReadAddress (rsp - 8);
regs [(int) X86_Register.RIP].SetValue (rsp - 8, rip);
regs [(int) X86_Register.RBP].SetValue (lmf + 40, rbp);
} else {
TargetAddress new_rbp = memory.ReadAddress (rbp);
regs [(int) X86_Register.RIP].SetValue (lmf + 24, rip);
regs [(int) X86_Register.RBP].SetValue (rbp, new_rbp);
rbp = new_rbp;
lmf_address--;
}
regs [(int) X86_Register.RBX].SetValue (lmf + 32, rbx);
regs [(int) X86_Register.RSP].SetValue (lmf + 48, rsp);
regs [(int) X86_Register.R12].SetValue (lmf + 56, r12);
regs [(int) X86_Register.R13].SetValue (lmf + 64, r13);
regs [(int) X86_Register.R14].SetValue (lmf + 72, r14);
regs [(int) X86_Register.R15].SetValue (lmf + 80, r15);
return CreateFrame (thread.Client, FrameType.LMF, memory, rip, rsp, rbp, regs);
}
示例9: DoGetArrayBounds
protected override void DoGetArrayBounds(TargetMemoryAccess target)
{
TargetBinaryReader reader = Location.ReadMemory (target, type.Size).GetReader ();
reader.Position = 3 * reader.TargetMemoryInfo.TargetAddressSize;
int length = reader.ReadInt32 ();
if (Rank == 1) {
bounds = TargetArrayBounds.MakeSimpleArray (length);
return;
}
reader.Position = 2 * reader.TargetMemoryInfo.TargetAddressSize;
TargetAddress bounds_address = new TargetAddress (
target.AddressDomain, reader.ReadAddress ());
TargetBinaryReader breader = target.ReadMemory (
bounds_address, 8 * Rank).GetReader ();
int[] lower = new int [Rank];
int[] upper = new int [Rank];
for (int i = 0; i < Rank; i++) {
int b_length = breader.ReadInt32 ();
int b_lower = breader.ReadInt32 ();
lower [i] = b_lower;
upper [i] = b_lower + b_length - 1;
}
bounds = TargetArrayBounds.MakeMultiArray (lower, upper);
}
示例10: GetLMF
internal override StackFrame GetLMF(ThreadServant thread, TargetMemoryAccess memory,
ref TargetAddress lmf_address)
{
TargetAddress lmf = lmf_address;
TargetBinaryReader reader = memory.ReadMemory (lmf, 36).GetReader ();
lmf_address = reader.ReadTargetAddress (); // prev
reader.Position = 16;
TargetAddress ebx = reader.ReadTargetAddress ();
TargetAddress edi = reader.ReadTargetAddress ();
TargetAddress esi = reader.ReadTargetAddress ();
TargetAddress ebp = reader.ReadTargetAddress ();
TargetAddress eip = reader.ReadTargetAddress ();
Registers regs = new Registers (this);
regs [(int) X86_Register.RBX].SetValue (lmf + 16, ebx);
regs [(int) X86_Register.RDI].SetValue (lmf + 20, edi);
regs [(int) X86_Register.RSI].SetValue (lmf + 24, esi);
regs [(int) X86_Register.RBP].SetValue (lmf + 28, ebp);
regs [(int) X86_Register.RIP].SetValue (lmf + 32, eip);
TargetAddress new_ebp = memory.ReadAddress (ebp);
regs [(int) X86_Register.RBP].SetValue (ebp, new_ebp);
TargetAddress new_esp = ebp + 8;
regs [(int) X86_Register.RSP].SetValue (ebp, new_esp);
return CreateFrame (thread.Client, FrameType.LMF, memory, eip, new_esp, new_ebp, regs);
}
示例11: MetadataInfo
public MetadataInfo(TargetMemoryAccess memory, TargetAddress address)
{
int size = memory.ReadInteger (address);
TargetBinaryReader reader = memory.ReadMemory (address, size).GetReader ();
reader.ReadInt32 ();
MonoDefaultsSize = reader.ReadInt32 ();
MonoDefaultsAddress = new TargetAddress (
memory.AddressDomain, reader.ReadAddress ());
TypeSize = reader.ReadInt32 ();
ArrayTypeSize = reader.ReadInt32 ();
KlassSize = reader.ReadInt32 ();
ThreadSize = reader.ReadInt32 ();
ThreadTidOffset = reader.ReadInt32 ();
ThreadStackPtrOffset = reader.ReadInt32 ();
ThreadEndStackOffset = reader.ReadInt32 ();
KlassImageOffset = reader.ReadInt32 ();
KlassInstanceSizeOffset = reader.ReadInt32 ();
KlassParentOffset = reader.ReadInt32 ();
KlassTokenOffset = reader.ReadInt32 ();
KlassFieldOffset = reader.ReadInt32 ();
KlassMethodsOffset = reader.ReadInt32 ();
KlassMethodCountOffset = reader.ReadInt32 ();
KlassThisArgOffset = reader.ReadInt32 ();
KlassByValArgOffset = reader.ReadInt32 ();
KlassGenericClassOffset = reader.ReadInt32 ();
KlassGenericContainerOffset = reader.ReadInt32 ();
KlassVTableOffset = reader.ReadInt32 ();
FieldInfoSize = reader.ReadInt32 ();
FieldInfoTypeOffset = reader.ReadInt32 ();
FieldInfoOffsetOffset = reader.ReadInt32 ();
KlassFieldCountOffset = KlassMethodCountOffset - 8;
MonoDefaultsCorlibOffset = reader.ReadInt32 ();
MonoDefaultsObjectOffset = reader.ReadInt32 ();
MonoDefaultsByteOffset = reader.ReadInt32 ();
MonoDefaultsVoidOffset = reader.ReadInt32 ();
MonoDefaultsBooleanOffset = reader.ReadInt32 ();
MonoDefaultsSByteOffset = reader.ReadInt32 ();
MonoDefaultsInt16Offset = reader.ReadInt32 ();
MonoDefaultsUInt16Offset = reader.ReadInt32 ();
MonoDefaultsInt32Offset = reader.ReadInt32 ();
MonoDefaultsUInt32Offset = reader.ReadInt32 ();
MonoDefaultsIntOffset = reader.ReadInt32 ();
MonoDefaultsUIntOffset = reader.ReadInt32 ();
MonoDefaultsInt64Offset = reader.ReadInt32 ();
MonoDefaultsUInt64Offset = reader.ReadInt32 ();
MonoDefaultsSingleOffset = reader.ReadInt32 ();
MonoDefaultsDoubleOffset = reader.ReadInt32 ();
MonoDefaultsCharOffset = reader.ReadInt32 ();
MonoDefaultsStringOffset = reader.ReadInt32 ();
MonoDefaultsEnumOffset = reader.ReadInt32 ();
MonoDefaultsArrayOffset = reader.ReadInt32 ();
MonoDefaultsDelegateOffset = reader.ReadInt32 ();
MonoDefaultsExceptionOffset = reader.ReadInt32 ();
MonoMethodKlassOffset = reader.ReadInt32 ();
MonoMethodTokenOffset = reader.ReadInt32 ();
MonoMethodFlagsOffset = reader.ReadInt32 ();
MonoMethodInflatedOffset = reader.ReadInt32 ();
MonoVTableKlassOffset = reader.ReadInt32 ();
MonoVTableVTableOffset = reader.ReadInt32 ();
}
示例12: MonoArrayTypeGetBounds
internal void MonoArrayTypeGetBounds(TargetMemoryAccess memory,
TargetAddress data)
{
//
// FIXME: Only check whether the low bounds are all zero
//
int num_sizes = memory.ReadByte (data + memory.TargetAddressSize + 1);
if (num_sizes != 0)
throw new InternalError ();
int num_lobounds = memory.ReadByte (data + memory.TargetAddressSize + 2);
if (num_lobounds == 0)
return;
TargetAddress array = memory.ReadAddress (data + 3 * memory.TargetAddressSize);
TargetBinaryReader bounds = memory.ReadMemory (array, num_lobounds * 4).GetReader ();
for (int i = 0; i < num_lobounds; i++) {
int bound = bounds.ReadInt32 ();
if (bound != 0)
throw new InternalError ();
}
}
示例13: GetMethodSignature
public MonoMethodSignature GetMethodSignature(MonoLanguageBackend mono,
TargetMemoryAccess memory,
TargetAddress signature)
{
int count = memory.ReadInteger (signature + 4) & 0x0000ffff;
int offset = memory.TargetAddressSize == 8 ? 16 : 12;
TargetAddress ret = memory.ReadAddress (signature + offset);
TargetType ret_type = mono.ReadType (memory, ret);
if (count == 0)
return new MonoMethodSignature (ret_type, new TargetType [0]);
offset += memory.TargetAddressSize;
TargetReader reader = new TargetReader (
memory.ReadMemory (signature + offset, count * memory.TargetAddressSize));
TargetType[] param_types = new TargetType [count];
for (int i = 0; i < count; i++)
param_types [i] = mono.ReadType (memory, reader.ReadAddress ());
return new MonoMethodSignature (ret_type, param_types);
}
示例14: Read
public void Read(TargetMemoryAccess memory)
{
int address_size = memory.TargetMemoryInfo.TargetAddressSize;
int header_size = 16 + address_size;
if (first_chunk.IsNull) {
first_chunk = memory.ReadAddress (TableAddress + 8);
current_chunk = first_chunk;
}
if (current_chunk.IsNull)
return;
again:
TargetReader reader = new TargetReader (
memory.ReadMemory (current_chunk, header_size));
reader.ReadInteger (); /* size */
int allocated_size = reader.ReadInteger ();
int current_offset = reader.ReadInteger ();
reader.ReadInteger (); /* dummy */
TargetAddress next = reader.ReadAddress ();
read_data_items (memory, current_chunk + header_size,
last_offset, current_offset);
last_offset = current_offset;
if (!next.IsNull && (current_offset == allocated_size)) {
current_chunk = next;
last_offset = 0;
goto again;
}
}
示例15: ReadMemory
internal virtual TargetBlob ReadMemory(TargetMemoryAccess target, int size)
{
return target.ReadMemory (GetAddress (target), size);
}