/// <summary> /// Convert a class signature to a name. /// </summary> public static string ClrNameToSignature(this DalvikProcess process, string clrName) { string className = null; var typeMap = process.Debugger.FrameworkTypeMap; if (typeMap != null) { FrameworkTypeMap.TypeEntry entry; if (typeMap.TryGetFromClrName(clrName, out entry)) { className = entry.ClassName; } } if (className == null) { var entry = process.MapFile.GetTypeBySignature(clrName); if (entry != null && entry.DexSignature != null) { return(entry.DexSignature); } } // I'm sure this name conversion is somewhere centralized. but where? if (className == null) { className = char.ToLower(clrName[0]) + clrName.Substring(1); } className = className.Replace("+", "$").Replace(".", "/"); return("L" + className + ";"); }
/// <summary> /// Status notification /// </summary> private void OnDebuggerConnectedChanged(object sender, System.EventArgs e) { if (InvokeRequired) { Invoke(new EventHandler(OnDebuggerConnectedChanged), sender, e); } else { if (debugger.Connected && (lastProcess != debugger.Process)) { lastProcess = debugger.Process; var ui = TaskScheduler.FromCurrentSynchronizationContext(); debugger.Process.IsSuspendedChanged += (s, x) => Task.Factory.StartNew(RefreshThreads, CancellationToken.None, TaskCreationOptions.None, ui); } treeView.Nodes.Clear(); UpdateStatus(); } }
/// <summary> /// Convert a class signature to a name. /// </summary> public static string SignatureToClrName(this DalvikProcess process, string signature) { var typeReference = Descriptors.ParseClassType(signature); var typeMap = process.Debugger.FrameworkTypeMap; if (typeMap != null) { FrameworkTypeMap.TypeEntry entry; if (typeMap.TryGetFromClassName(typeReference.ClassName, out entry)) { return(entry.FullName); } } var e = process.MapFile.GetTypeBySignature(signature); if (e != null) { return(e.Name); } return(typeReference.ClrTypeName); }
/// <summary> /// Connect to the VM in the given process id on the given device. /// </summary> public void Connect(IDevice device, int pid, MapFile mapFile) { // Disconnect any pending connections Disconnect(); // Cleanup process = null; this.mapFile = mapFile; this.pid = pid; // Setup forward var port = GetFreePort(); var adb = new Adb(); adb.ForwardJdwp(device, port, pid); // Establish connection connection = new JdwpConnection(new IPEndPoint(IPAddress.Parse("127.0.0.1"), port), ChunkHandler, pid, PacketHandler); connection.Disconnect += OnConnectionDisconnect; // Notify ConnectedChanged.Fire(this); }
protected DalvikProcessChild(DalvikProcess process) { this.process = process; }
/// <summary> /// Default ctor /// </summary> public DalvikStackFrameValue(Value value, VariableInfo variable, bool isParameter, DalvikProcess process) : base(value, process) { IsParameter = isParameter; Variable = variable; }
/// <summary> /// Default ctor /// </summary> protected DalvikValue(Value value, DalvikProcess process) { tag = value.Tag; this.value = value.IsPrimitive ? value.ValueObject : new DalvikObjectReference((ObjectId)value.ValueObject, process); }
public DalvikExceptionValue(Value value, DalvikProcess process) : base(value, process) { }
/// <summary> /// Default ctor /// </summary> public DalvikStackFrameValue(Value value, VariableInfo variable, DalvikProcess process) : base(value, process) { Variable = variable; }
/// <summary> /// Default ctor /// </summary> public DalvikFieldValue(Value value, DalvikField field, DalvikProcess process) : base(value, process) { Field = field; }
/// <summary> /// Default ctor /// </summary> public DalvikArrayElementValue(Value value, int index, DalvikProcess process) : base(value, process) { this.index = index; }
/// <summary> /// Try to bind this breakpoint to an actual breakpoint in the VM. /// </summary> internal abstract void TryBind(DalvikProcess process);
/// <summary> /// Try to bind this breakpoint to an actual breakpoint in the VM. /// </summary> /// <returns>true if bound successful, false if binding will occur /// when the class is loaded</returns> internal abstract bool TryBind(DalvikProcess process);