Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
ndk
Commits
b778482a
Commit
b778482a
authored
9 years ago
by
Josh Gao
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Download
Plain Diff
Merge "[ndk-gdb.py] Select which ps command to run on the device."
parents
ce64ba12
70af7d0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
ndk-gdb.py
ndk-gdb.py
+16
-7
No files found.
ndk-gdb.py
View file @
b778482a
...
...
@@ -451,13 +451,22 @@ def get_pid_of(package_name):
package names like com.exampleisverylongtoolongbyfar.plasma
exceed the limit.
'''
ps_command
=
'ps'
retcode
,
output
=
adb_cmd
(
False
,
[
'shell'
,
'readlink $(which ps)'
])
if
output
:
output
=
output
.
replace
(
'
\r
'
,
''
).
splitlines
()[
0
]
if
output
==
'busybox'
:
ps_command
=
'ps -w'
retcode
,
output
=
adb_cmd
(
False
,[
'shell'
,
ps_command
])
# Perform the check on the device to avoid an adb roundtrip
# Some devices might not have readlink or which, so we need to check for
# them.
ps_script
=
'''
if [ ! -x /system/bin/readlink -o ! -x /system/bin/which ]; then
ps;
elif [ $(readlink $(which ps)) == "toolbox" ]; then
ps;
else
ps -w;
fi
'''
ps_script
=
" "
.
join
([
line
.
strip
()
for
line
in
ps_script
.
splitlines
()])
retcode
,
output
=
adb_cmd
(
False
,
[
'shell'
,
ps_script
])
output
=
output
.
replace
(
'
\r
'
,
''
).
splitlines
()
columns
=
output
.
pop
(
0
).
split
()
try
:
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment