Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
c826f835
E
engine
项目概览
liujiuri
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c826f835
编写于
8月 07, 2017
作者:
J
Jason Simmons
提交者:
GitHub
8月 07, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve support for x86 and x86_64 devices in flutter_gdb (#3953)
上级
b08167ba
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
6 deletion
+35
-6
sky/tools/flutter_gdb
sky/tools/flutter_gdb
+35
-6
未找到文件。
sky/tools/flutter_gdb
浏览文件 @
c826f835
...
...
@@ -26,6 +26,7 @@ previous run for a given device, then you can skip this step by passing
ADB_LOCAL_PATH
=
'third_party/android_tools/sdk/platform-tools/adb'
def
_get_flutter_root
():
path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
while
os
.
path
.
basename
(
path
)
!=
'src'
:
...
...
@@ -43,6 +44,24 @@ def _find_package_pid(adb_path, package):
return
int
(
ps_match
.
group
(
1
))
def
_get_device_abi
(
adb_path
):
abi_output
=
subprocess
.
check_output
(
[
adb_path
,
'shell'
,
'getprop'
,
'ro.product.cpu.abi'
]).
strip
()
if
abi_output
.
startswith
(
'arm'
):
return
'arm'
return
abi_output
def
_default_local_engine
(
abi
):
"""Return the default Flutter build output directory for a given target ABI."""
if
abi
==
'x86'
:
return
'android_debug_unopt_x86'
elif
abi
==
'x86_64'
:
return
'android_debug_unopt_x64'
else
:
return
'android_debug_unopt'
class
GdbClient
(
object
):
SYSTEM_LIBS_PATH
=
'/tmp/flutter_gdb_device_libs'
...
...
@@ -57,7 +76,7 @@ class GdbClient(object):
parser
=
subparsers
.
add_parser
(
'client'
,
help
=
'run a GDB client'
)
parser
.
add_argument
(
'package'
,
type
=
str
)
parser
.
add_argument
(
'--local-engine'
,
type
=
str
,
default
=
'android_debug_unopt'
)
parser
.
add_argument
(
'--local-engine'
,
type
=
str
)
parser
.
add_argument
(
'--gdb-port'
,
type
=
int
,
default
=
8888
)
parser
.
add_argument
(
'--no-pull-libs'
,
action
=
"store_false"
,
default
=
True
,
dest
=
"pull_libs"
,
...
...
@@ -81,11 +100,13 @@ class GdbClient(object):
device_libs
=
set
((
lib
,
lib
[
1
:])
for
lib
in
proc_libs
)
device_libs
.
add
((
'/system/bin/linker'
,
'system/bin/linker'
))
device_libs
.
add
((
'/system/bin/app_process32'
,
'system/bin/app_process32'
))
device_libs
.
add
((
'/system/bin/app_process64'
,
'system/bin/app_process64'
))
else
:
device_libs
=
set
((
lib
,
os
.
path
.
basename
(
lib
))
for
lib
in
proc_libs
)
device_libs
.
add
((
'/system/bin/linker'
,
'linker'
))
shutil
.
rmtree
(
GdbClient
.
SYSTEM_LIBS_PATH
)
if
os
.
path
.
isdir
(
GdbClient
.
SYSTEM_LIBS_PATH
):
shutil
.
rmtree
(
GdbClient
.
SYSTEM_LIBS_PATH
)
dev_null
=
open
(
os
.
devnull
,
'w'
)
for
lib
,
local_path
in
sorted
(
device_libs
):
...
...
@@ -93,7 +114,7 @@ class GdbClient(object):
local_path
=
os
.
path
.
join
(
GdbClient
.
SYSTEM_LIBS_PATH
,
local_path
)
if
not
os
.
path
.
exists
(
os
.
path
.
dirname
(
local_path
)):
os
.
makedirs
(
os
.
path
.
dirname
(
local_path
))
subprocess
.
c
heck_c
all
([
adb_path
,
'pull'
,
lib
,
local_path
],
stderr
=
dev_null
)
subprocess
.
call
([
adb_path
,
'pull'
,
lib
,
local_path
],
stderr
=
dev_null
)
return
True
...
...
@@ -111,7 +132,13 @@ class GdbClient(object):
subprocess
.
check_call
(
[
adb_path
,
'forward'
,
'tcp:%d'
%
args
.
gdb_port
,
'tcp:%d'
%
args
.
gdb_port
])
debug_out_path
=
os
.
path
.
join
(
flutter_root
,
'out/%s'
%
args
.
local_engine
)
if
args
.
local_engine
is
None
:
abi
=
_get_device_abi
(
adb_path
)
local_engine
=
_default_local_engine
(
abi
)
else
:
local_engine
=
args
.
local_engine
debug_out_path
=
os
.
path
.
join
(
flutter_root
,
'out/%s'
%
local_engine
)
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
debug_out_path
,
'libflutter.so'
)):
print
'Unable to find libflutter.so. Make sure you have completed a %s build'
%
args
.
local_engine
return
1
...
...
@@ -131,7 +158,6 @@ class GdbClient(object):
class
GdbServer
(
object
):
GDB_SERVER_LOCAL_PATH
=
'third_party/android_tools/ndk/prebuilt/android-arm/gdbserver/gdbserver'
GDB_SERVER_DEVICE_TMP_PATH
=
'/data/local/tmp/gdbserver'
def
add_subparser
(
self
,
subparsers
):
...
...
@@ -152,9 +178,12 @@ class GdbServer(object):
if
package_pid
is
None
:
return
1
abi
=
_get_device_abi
(
adb_path
)
gdb_server_local_path
=
'third_party/android_tools/ndk/prebuilt/android-%s/gdbserver/gdbserver'
%
abi
# Copy gdbserver to the package's data directory.
subprocess
.
check_call
([
adb_path
,
'push'
,
os
.
path
.
join
(
flutter_root
,
GdbServer
.
GDB_SERVER_LOCAL_PATH
),
os
.
path
.
join
(
flutter_root
,
gdb_server_local_path
),
GdbServer
.
GDB_SERVER_DEVICE_TMP_PATH
])
gdb_server_device_path
=
'/data/data/%s/gdbserver'
%
args
.
package
subprocess
.
check_call
([
adb_path
,
'shell'
,
'run-as'
,
args
.
package
,
'cp'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录