Ejemplo n.º 1
0
        /// <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 + ";");
        }
Ejemplo n.º 2
0
 /// <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();
     }
 }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
 protected DalvikProcessChild(DalvikProcess process)
 {
     this.process = process;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public DalvikStackFrameValue(Value value, VariableInfo variable, bool isParameter, DalvikProcess process)
     : base(value, process)
 {
     IsParameter = isParameter;
     Variable    = variable;
 }
Ejemplo n.º 7
0
 protected DalvikProcessChild(DalvikProcess process)
 {
     this.process = process;
 }
Ejemplo n.º 8
0
 /// <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);
 }
Ejemplo n.º 9
0
 public DalvikExceptionValue(Value value, DalvikProcess process)
     : base(value, process)
 {
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public DalvikStackFrameValue(Value value, VariableInfo variable, DalvikProcess process)
     : base(value, process)
 {
     Variable = variable;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public DalvikFieldValue(Value value, DalvikField field, DalvikProcess process)
     : base(value, process)
 {
     Field = field;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public DalvikFieldValue(Value value, DalvikField field, DalvikProcess process)
     : base(value, process)
 {
     Field = field;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public DalvikArrayElementValue(Value value, int index, DalvikProcess process)
     : base(value, process)
 {
     this.index = index;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public DalvikArrayElementValue(Value value, int index, DalvikProcess process)
     : base(value, process)
 {
     this.index = index;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Try to bind this breakpoint to an actual breakpoint in the VM.
 /// </summary>
 internal abstract void TryBind(DalvikProcess process);
Ejemplo n.º 16
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public DalvikStackFrameValue(Value value, VariableInfo variable, DalvikProcess process)
     : base(value, process)
 {
     Variable = variable;
 }
Ejemplo n.º 17
0
 /// <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);
Ejemplo n.º 18
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public DalvikStackFrameValue(Value value, VariableInfo variable, bool isParameter, DalvikProcess process)
     : base(value, process)
 {
     IsParameter = isParameter;
     Variable = variable;
 }
Ejemplo n.º 19
0
 /// <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);
Ejemplo n.º 20
0
 public DalvikExceptionValue(Value value, DalvikProcess process)
     : base(value, process)
 {
 }
Ejemplo n.º 21
0
 /// <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);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Try to bind this breakpoint to an actual breakpoint in the VM.
 /// </summary>
 internal abstract void TryBind(DalvikProcess process);