本文整理汇总了C#中TargetAddress类的典型用法代码示例。如果您正苦于以下问题:C# TargetAddress类的具体用法?C# TargetAddress怎么用?C# TargetAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TargetAddress类属于命名空间,在下文中一共展示了TargetAddress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MonoGenericInstanceType
public MonoGenericInstanceType(MonoClassType container, TargetType[] type_args,
TargetAddress class_ptr)
: base(container.File.MonoLanguage)
{
this.Container = container;
this.type_args = type_args;
this.class_ptr = class_ptr;
struct_type = new MonoStructType (container.File, this, container.Type);
StringBuilder sb = new StringBuilder (container.BaseName);
sb.Append ('<');
for (int i = 0; i < type_args.Length; i++) {
if (i > 0)
sb.Append (',');
sb.Append (type_args [i].Name);
}
sb.Append ('>');
full_name = sb.ToString ();
bool is_compiler_generated;
DebuggerBrowsableState? browsable_state;
MonoSymbolFile.CheckCustomAttributes (container.Type,
out browsable_state,
out debugger_display,
out type_proxy,
out is_compiler_generated);
}
示例2: 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);
}
示例3: ReadString
internal static string ReadString(MonoLanguageBackend mono, TargetMemoryAccess target,
TargetAddress address)
{
if (address.IsNull)
return null;
TargetLocation location = new AbsoluteTargetLocation (address);
MonoStringObject so = new MonoStringObject (mono.BuiltinTypes.StringType, location);
return (string) so.DoGetObject (target);
}
示例4: MonoClassInfo
protected MonoClassInfo(MonoSymbolFile file, Cecil.TypeDefinition typedef,
TargetMemoryAccess target, TargetAddress klass)
{
this.SymbolFile = file;
this.KlassAddress = klass;
this.CecilType = typedef;
parent_klass = MetadataHelper.MonoClassGetParent (target, klass);
GenericClass = MetadataHelper.MonoClassGetGenericClass (target, klass);
GenericContainer = MetadataHelper.MonoClassGetGenericContainer (target, klass);
}
示例5: ReadClassInfo
public static MonoClassInfo ReadClassInfo(MonoLanguageBackend mono,
TargetMemoryAccess target,
TargetAddress klass)
{
TargetAddress image = mono.MetadataHelper.MonoClassGetMonoImage (target, klass);
MonoSymbolFile file = mono.GetImage (image);
if (file == null)
throw new InternalError ();
int token = mono.MetadataHelper.MonoClassGetToken (target, klass);
if ((token & 0xff000000) != 0x02000000)
throw new InternalError ();
Cecil.TypeDefinition typedef;
typedef = (Cecil.TypeDefinition) file.ModuleDefinition.LookupByToken (
Cecil.Metadata.TokenType.TypeDef, token & 0x00ffffff);
if (typedef == null)
throw new InternalError ();
MonoClassInfo info = new MonoClassInfo (file, typedef, target, klass);
if ((file == mono.BuiltinTypes.Corlib) &&
(typedef.FullName == "System.Decimal")) {
MonoFundamentalType ftype = mono.BuiltinTypes.DecimalType;
if (ftype.ClassType == null) {
MonoClassType ctype = new MonoClassType (file, typedef, info);
((IMonoStructType) ctype).ClassInfo = info;
ftype.SetClass (ctype);
}
info.struct_type = (IMonoStructType) ftype.ClassType;
info.type = ftype;
} else if (info.IsGenericClass) {
info.struct_type = (IMonoStructType)
file.MonoLanguage.ReadGenericClass (
target, info.GenericClass, false);
info.type = info.struct_type.Type;
} else {
info.type = file.LookupMonoType (typedef);
if (info.type is TargetClassType)
info.struct_type = (IMonoStructType) info.type;
else
info.struct_type = (IMonoStructType) info.type.ClassType;
}
info.struct_type.ClassInfo = info;
return info;
}
示例6: ReadInstruction
internal override Instruction ReadInstruction(TargetMemoryAccess memory,
TargetAddress address)
{
return X86_Instruction.DecodeInstruction (this, memory, address);
}
示例7: SimpleLookup
public Symbol SimpleLookup(TargetAddress address, bool exact_match)
{
foreach (SymbolFile symfile in symbol_files) {
Symbol name = symfile.SimpleLookup (address, exact_match);
if (name != null)
return name;
}
return null;
}
示例8: ReadInstruction
internal abstract Instruction ReadInstruction(TargetMemoryAccess memory,
TargetAddress address);
示例9: IsAlive
// <summary>
// Checks whether the variable is alive at @address, but without actually
// trying to access the variable. The implementation just checks the data
// from the symbol file and - if appropriate - from the JIT to find out
// whether the specified address is within the variable's live range.
// </summary>
public abstract bool IsAlive(TargetAddress address);
示例10: try_unwind_sigreturn
StackFrame try_unwind_sigreturn(StackFrame frame, TargetMemoryAccess memory)
{
byte[] data = memory.ReadMemory (frame.TargetAddress, 9).Contents;
/*
* Check for signal return trampolines:
*
* mov __NR_rt_sigreturn, %eax
* syscall
*/
if ((data [0] != 0x48) || (data [1] != 0xc7) ||
(data [2] != 0xc0) || (data [3] != 0x0f) ||
(data [4] != 0x00) || (data [5] != 0x00) ||
(data [6] != 0x00) || (data [7] != 0x0f) ||
(data [8] != 0x05))
return null;
TargetAddress stack = frame.StackPointer;
/* See `struct sigcontext' in <asm/sigcontext.h> */
int[] regoffsets = {
(int) X86_Register.R8, (int) X86_Register.R9,
(int) X86_Register.R10, (int) X86_Register.R11,
(int) X86_Register.R12, (int) X86_Register.R13,
(int) X86_Register.R14, (int) X86_Register.R15,
(int) X86_Register.RDI, (int) X86_Register.RSI,
(int) X86_Register.RBP, (int) X86_Register.RBX,
(int) X86_Register.RDX, (int) X86_Register.RAX,
(int) X86_Register.RCX, (int) X86_Register.RSP,
(int) X86_Register.RIP, (int) X86_Register.EFLAGS
};
Registers regs = CopyRegisters (frame.Registers);
int offset = 0x28;
/* The stack contains the `struct ucontext' from <asm/ucontext.h>; the
* `struct sigcontext' starts at offset 0x28 in it. */
foreach (int regoffset in regoffsets) {
TargetAddress new_value = memory.ReadAddress (stack + offset);
regs [regoffset].SetValue (new_value);
offset += 8;
}
TargetAddress rip = new TargetAddress (
memory.AddressDomain, regs [(int) X86_Register.RIP].GetValue ());
TargetAddress rsp = new TargetAddress (
memory.AddressDomain, regs [(int) X86_Register.RSP].GetValue ());
TargetAddress rbp = new TargetAddress (
memory.AddressDomain, regs [(int) X86_Register.RBP].GetValue ());
Symbol name = new Symbol ("<signal handler>", rip, 0);
return new StackFrame (
frame.Thread, FrameType.Signal, rip, rsp, rbp, regs, frame.Thread.NativeLanguage, name);
}
示例11: IsDelegateTrampoline
internal bool IsDelegateTrampoline(TargetAddress address)
{
if (global_data_table == null)
return false;
return global_data_table.IsDelegateInvoke (address);
}
示例12: IsRetInstruction
internal override bool IsRetInstruction(TargetMemoryAccess memory,
TargetAddress address)
{
return memory.ReadByte (address) == 0xc3;
}
示例13: IsSyscallInstruction
internal override bool IsSyscallInstruction(TargetMemoryAccess memory,
TargetAddress address)
{
try {
return (memory.ReadByte (address - 2) == 0x0f) &&
(memory.ReadByte (address - 1) == 0x05);
} catch {
return false;
}
}
示例14: IsTrampolineAddress
internal bool IsTrampolineAddress(TargetAddress address)
{
foreach (TargetAddress trampoline in trampolines) {
if (address == trampoline)
return true;
}
return false;
}
示例15: unwind_method
StackFrame unwind_method(StackFrame frame, TargetMemoryAccess memory, byte[] code,
int pos, int offset)
{
Registers old_regs = frame.Registers;
Registers regs = CopyRegisters (old_regs);
if (!old_regs [(int) X86_Register.RBP].Valid)
return null;
TargetAddress rbp = new TargetAddress (
memory.AddressDomain, old_regs [(int) X86_Register.RBP].Value);
int addr_size = TargetAddressSize;
TargetAddress new_rbp = memory.ReadAddress (rbp);
regs [(int) X86_Register.RBP].SetValue (rbp, new_rbp);
TargetAddress new_rip = memory.ReadAddress (rbp + addr_size);
regs [(int) X86_Register.RIP].SetValue (rbp + addr_size, new_rip);
TargetAddress new_rsp = rbp + 2 * addr_size;
regs [(int) X86_Register.RSP].SetValue (rbp, new_rsp);
rbp -= addr_size;
int length = System.Math.Min (code.Length, offset);
while (pos < length) {
byte opcode = code [pos++];
long value;
if ((opcode == 0x41) && (pos < length)) {
byte opcode2 = code [pos++];
if ((opcode2 < 0x50) || (opcode2 > 0x57))
break;
switch (opcode2) {
case 0x50: /* r8 */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.R8].SetValue (rbp, value);
break;
case 0x51: /* r9 */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.R9].SetValue (rbp, value);
break;
case 0x52: /* r10 */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.R10].SetValue (rbp, value);
break;
case 0x53: /* r11 */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.R11].SetValue (rbp, value);
break;
case 0x54: /* r12 */
value = (long) memory.ReadAddress (rbp).Address;
regs [(int) X86_Register.R12].SetValue (rbp, value);
break;
case 0x55: /* r13 */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.R13].SetValue (rbp, value);
break;
case 0x56: /* r14 */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.R14].SetValue (rbp, value);
break;
case 0x57: /* r15 */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.R15].SetValue (rbp, value);
break;
}
} else {
if ((opcode < 0x50) || (opcode > 0x57))
break;
switch (opcode) {
case 0x50: /* rax */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.RAX].SetValue (rbp, value);
break;
case 0x51: /* rcx */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.RCX].SetValue (rbp, value);
break;
case 0x52: /* rdx */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.RDX].SetValue (rbp, value);
break;
case 0x53: /* rbx */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.RBX].SetValue (rbp, value);
break;
case 0x56: /* rsi */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.RSI].SetValue (rbp, value);
break;
case 0x57: /* rdi */
value = memory.ReadLongInteger (rbp);
regs [(int) X86_Register.RDI].SetValue (rbp, value);
break;
}
}
//.........这里部分代码省略.........