public static List<MyProcessModule> GetProcessModules(LinuxProcess process) { Debug.Print("Linux.GetProcessModules"); List<MyProcessModule> mpm = new List<MyProcessModule>(); string txt = File.ReadAllText(process.path + "/maps"); string[] lines = txt.Split('\n'); foreach (string l in lines) { MyProcessModule mo = new MyProcessModule(); Debug.Print("{0}", l); Regex r = new Regex("^([a-f0-9]+)-([a-f0-9]+) +.{4} +[a-f0-9]+ +[0-9:]+ +[0-9]+ +(.+)$"); if (r.IsMatch(l)) { Match m = r.Match(l); Debug.Print("-->{0} {1} {2}<--", m.Groups[1].Value, m.Groups[2].Value, m.Groups[3].Value); mo.BaseAddress = (IntPtr)Convert.ToInt32(m.Groups[1].Value, 16); mo.ModuleMemorySize = (int)(Convert.ToUInt32(m.Groups[2].Value, 16) - (long)mo.BaseAddress); mo.ModuleName = Path.GetFileName(m.Groups[3].Value); } else { mo.ModuleName = "empty"; } mpm.Add(mo); } Debug.Print("{0} Modules found.", mpm.Count); return mpm; }
public MyProcess(LinuxProcess p) { this.Handle = p.Handle; this.LinuxProcess = p; }