public void ToStringTest() { AndroidProcess p = new AndroidProcess(); p.ProcessId = 1; p.Name = "init"; Assert.AreEqual("init (1)", p.ToString()); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public DebuggeeProcess(DebuggeePort port, AndroidProcess androidProcess) { m_debuggeePort = port; DebuggeeProgram = new DebuggeeProgram(this); Guid = Guid.NewGuid(); NativeProcess = androidProcess; }
public void ParseWithSpaceTest() { string line = @"194(irq/432-mdm sta) S 2 0 0 0 - 1 2130240 0 0 0 0 0 1 0 0 - 51 0 1 0 172 0 0 4294967295 0 0 0 0 0 0 0 2147483647 0 4294967295 0 0 17 1 50 1 0 0 0 0 0 0 0 0 0 0 0"; var process = AndroidProcess.Parse(line); Assert.AreEqual(194, process.ProcessId); Assert.AreEqual(2, process.ParentProcessId); Assert.AreEqual(0ul, process.VirtualSize); Assert.AreEqual(172, process.ResidentSetSize); Assert.AreEqual(2147483647ul, process.WChan); Assert.AreEqual(AndroidProcessState.S, process.State); Assert.AreEqual("irq/432-mdm sta", process.Name); }
public void ParseTest() { string line = @"1 (init) S 0 0 0 0 -1 1077936384 1467 168323 0 38 12 141 863 249 20 0 1 0 4 2535424 245 4294967295 1 1 0 0 0 0 0 0 65536 4294967295 0 0 17 3 0 0 0 0 0 0 0 0 0 0 0 0 0"; var process = AndroidProcess.Parse(line); Assert.AreEqual(1, process.ProcessId); Assert.AreEqual(0, process.ParentProcessId); Assert.AreEqual(2535424ul, process.VirtualSize); Assert.AreEqual(245, process.ResidentSetSize); Assert.AreEqual(0ul, process.WChan); Assert.AreEqual(AndroidProcessState.S, process.State); Assert.AreEqual("init", process.Name); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void Refresh(ref MiResultValue threadData) { LoggingUtils.PrintFunction(); if (threadData.HasField("name")) { m_threadDisplayName = threadData ["name"] [0].GetString(); // user-specified name } else if (threadData.HasField("target-id")) { uint threadPid; m_threadDisplayName = threadData ["target-id"] [0].GetString(); // usually the raw name, i.e. 'Thread 18771' if (m_threadDisplayName.StartsWith("Thread ") && uint.TryParse(m_threadDisplayName.Substring("Thread ".Length), out threadPid)) { AndroidDevice hostDevice = NativeProgram.DebugProgram.DebugProcess.NativeProcess.HostDevice; AndroidProcess threadProcess = hostDevice.GetProcessFromPid(threadPid); if (threadProcess != null) { m_threadDisplayName = threadProcess.Name; } } } if (threadData.HasField("frame")) { MiResultValueTuple frameTuple = threadData ["frame"] [0] as MiResultValueTuple; uint stackLevel = frameTuple ["level"] [0].GetUnsignedInt(); string stackFrameId = m_threadName + "#" + stackLevel; CLangDebuggeeStackFrame stackFrame = new CLangDebuggeeStackFrame(m_debugger, this, frameTuple, stackFrameId); lock (m_threadStackFrames) { m_threadStackFrames.Add(stackFrame); } } RequiresRefresh = false; }
/// <inheritdoc/> protected override void ProcessNewLines(IEnumerable <string> lines) { foreach (var line in lines) { // Process has already died (e.g. the cat process itself) if (line.Contains("No such file or directory")) { continue; } try { this.Processes.Add(AndroidProcess.Parse(line)); } catch (Exception) { // Swallow } } }
public void ParseTest3() { var p = AndroidProcess.Parse("be.xx.yy.android.test\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\04212 (le.android.test) S 2088 2088 0 0 -1 1077944640 10251 1315 2 0 10 8 0 1 20 0 10 0 15838 1062567936 12163 18446744073709551615 4152340480 4152354824 4289177024 4289174228 4147921093 0 4612 0 38136 18446744073709551615 0 0 17 1 0 0 0 0 0 4152360256 4152360952 4157476864 4289182806 4289182882 4289182882 4289183712 0", true); Assert.AreEqual("be.xx.yy.android.test", p.Name); }
public void ParseTest2() { var p = AndroidProcess.Parse("10 (rcu_sched) S 2 0 0 0 -1 2129984 0 0 0 0 0 0 0 0 20 0 1 0 9 0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744071579565281 0 0 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0", true); Assert.AreEqual("rcu_sched", p.Name); }
public void ParseTest() { var p = AndroidProcess.Parse("/init\0--second-stage\01 (init) S 0 0 0 0 -1 1077944576 5343 923316 0 1221 2 48 357 246 20 0 1 0 3 24002560 201 18446744073709551615 134512640 135874648 4293296896 4293296356 135412421 0 0 0 65536 18446744071580341721 0 0 17 3 0 0 0 0 0 135882176 135902816 152379392 4293300171 4293300192 4293300192 4293300210 0", true); Assert.AreEqual("/init", p.Name); }
public void ParseTooFewPartsTest() { AndroidProcess.Parse("1 (init) S 0 0 0 0 -1 1077944576 2680 83280 0 179 0 67 16 39 20 0 1 0 2 17735680 143 18446744073709551615 134512640 135145076 "); }
public void ParseNullTest() { AndroidProcess.Parse(null); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int RefreshProcesses() { // // Check which processes are currently running on the target device (port). // LoggingUtils.PrintFunction(); try { m_portDevice.RefreshProcesses(); m_portProcesses.Clear(); // // Register a new process with this port if it was spawned by 'zygote'. // uint [] zygotePids = m_portDevice.GetPidsFromName("zygote"); if (zygotePids.Length > 0) { uint [] activeZygoteSpawnedPids = m_portDevice.GetChildPidsFromPpid(zygotePids [0]); for (int i = 0; i < activeZygoteSpawnedPids.Length; ++i) { uint pid = activeZygoteSpawnedPids [i]; AndroidProcess nativeProcess = m_portDevice.GetProcessFromPid(pid); m_portProcesses.Add(pid, new DebuggeeProcess(this, nativeProcess)); } } // // Register a new process with this port if it was spawned by 'zygote64' (it's a 64-bit process). // uint [] zygote64Pids = m_portDevice.GetPidsFromName("zygote64"); if (zygote64Pids.Length > 0) { uint [] activeZygote64SpawnedPids = m_portDevice.GetChildPidsFromPpid(zygote64Pids [0]); for (int i = 0; i < activeZygote64SpawnedPids.Length; ++i) { uint pid = activeZygote64SpawnedPids [i]; AndroidProcess nativeProcess = m_portDevice.GetProcessFromPid(pid); m_portProcesses.Add(pid, new DebuggeeProcess(this, nativeProcess)); } } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
public void ParseTests(string line) { var process = AndroidProcess.Parse(line, true); }
public void ParseNullTest() { Assert.Throws <ArgumentNullException>(() => AndroidProcess.Parse(null)); }
public void ParseTooFewPartsTest() { Assert.Throws <ArgumentOutOfRangeException>(() => AndroidProcess.Parse("1 (init) S 0 0 0 0 -1 1077944576 2680 83280 0 179 0 67 16 39 20 0 1 0 2 17735680 143 18446744073709551615 134512640 135145076 ")); }