mirror of
https://github.com/imcarlost/pidcat-repl.git
synced 2026-08-08 23:17:43 -04:00
Handle alternative log format for process start
Some phones (like my samsung) do not log the 'Start proc ...' line in logcat to indicate process start. In my case it does log a line like E/dalvikvm(pid): >>>>>> com.my.package [ more stuff ] This commit adds support for that format to pidcat.
This commit is contained in:
@@ -139,7 +139,8 @@ TAGTYPES = {
|
|||||||
'F': colorize(' F ', fg=BLACK, bg=RED),
|
'F': colorize(' F ', fg=BLACK, bg=RED),
|
||||||
}
|
}
|
||||||
|
|
||||||
PID_START = re.compile(r'^Start proc ([a-zA-Z0-9._:]+) for ([a-z]+ [^:]+): pid=(\d+) uid=(\d+) gids=(.*)$')
|
PID_START = re.compile(r'^.*: Start proc ([a-zA-Z0-9._:]+) for ([a-z]+ [^:]+): pid=(\d+) uid=(\d+) gids=(.*)$')
|
||||||
|
PID_START_DALVIK = re.compile(r'^E/dalvikvm\((\d+)\): >>>>> ([a-zA-Z0-9._:]+) \[ userId:0 \| appId:(\d+) \]$')
|
||||||
PID_KILL = re.compile(r'^Killing (\d+):([a-zA-Z0-9._:]+)/[^:]+: (.*)$')
|
PID_KILL = re.compile(r'^Killing (\d+):([a-zA-Z0-9._:]+)/[^:]+: (.*)$')
|
||||||
PID_LEAVE = re.compile(r'^No longer want ([a-zA-Z0-9._:]+) \(pid (\d+)\): .*$')
|
PID_LEAVE = re.compile(r'^No longer want ([a-zA-Z0-9._:]+) \(pid (\d+)\): .*$')
|
||||||
PID_DEATH = re.compile(r'^Process ([a-zA-Z0-9._:]+) \(pid (\d+)\) has died.?$')
|
PID_DEATH = re.compile(r'^Process ([a-zA-Z0-9._:]+) \(pid (\d+)\) has died.?$')
|
||||||
@@ -211,6 +212,17 @@ def parse_death(tag, message):
|
|||||||
return pid, package_line
|
return pid, package_line
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
|
def parse_start_proc(line):
|
||||||
|
start = PID_START.match(line)
|
||||||
|
if start is not None:
|
||||||
|
line_package, target, line_pid, line_uid, line_gids = start.groups()
|
||||||
|
return line_package, target, line_pid, line_uid, line_gids
|
||||||
|
start = PID_START_DALVIK.match(line)
|
||||||
|
if start is not None:
|
||||||
|
line_pid, line_package, line_uid = start.groups()
|
||||||
|
return line_package, '', line_pid, line_uid, ''
|
||||||
|
return None
|
||||||
|
|
||||||
while adb.poll() is None:
|
while adb.poll() is None:
|
||||||
try:
|
try:
|
||||||
line = adb.stdout.readline().decode('utf-8', 'replace').strip()
|
line = adb.stdout.readline().decode('utf-8', 'replace').strip()
|
||||||
@@ -228,11 +240,9 @@ while adb.poll() is None:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
level, tag, owner, message = log_line.groups()
|
level, tag, owner, message = log_line.groups()
|
||||||
|
start = parse_start_proc(line)
|
||||||
start = PID_START.match(message)
|
if start:
|
||||||
if start is not None:
|
line_package, target, line_pid, line_uid, line_gids = start
|
||||||
line_package, target, line_pid, line_uid, line_gids = start.groups()
|
|
||||||
|
|
||||||
if match_packages(line_package):
|
if match_packages(line_package):
|
||||||
pids.add(line_pid)
|
pids.add(line_pid)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user