Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
2590e343
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
大约 1 年 前同步成功
通知
454
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2590e343
编写于
8月 23, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 23, 2022
浏览文件
操作
浏览文件
下载
差异文件
!969 编译构建规范优化
Merge pull request !969 from Hongjin Li/dev
上级
44ec1994
660b314f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
106 addition
and
115 deletion
+106
-115
OAT.xml
OAT.xml
+1
-0
tools/scripts/make_rootfs/rootfsdir.sh
tools/scripts/make_rootfs/rootfsdir.sh
+1
-1
tools/scripts/parse_exc/parse_excinfo.py
tools/scripts/parse_exc/parse_excinfo.py
+96
-107
tools/scripts/parse_memory/parse_mem_info.sh
tools/scripts/parse_memory/parse_mem_info.sh
+8
-7
未找到文件。
OAT.xml
浏览文件 @
2590e343
...
...
@@ -23,6 +23,7 @@
<licensefile></licensefile>
<policylist>
<policy
name=
"projectPolicy"
desc=
""
>
<policyitem
type=
"copyright"
name=
"Huawei Technologies Co., Ltd. All rights reserved."
path=
".*"
desc=
"original liteos copyright"
/>
<policyitem
type=
"copyright"
name=
"Huawei Device Co., Ltd. All rights reserved."
path=
".*"
desc=
"original liteos copyright"
/>
<policyitem
type=
"license"
name=
"BSD-3-Clause"
path=
".*"
desc=
"Liteos kernel use bsd3 license"
/>
</policy>
...
...
tools/scripts/make_rootfs/rootfsdir.sh
浏览文件 @
2590e343
...
...
@@ -44,6 +44,6 @@ if [ -d "${BIN_DIR}" ] && [ "$(ls -A "${BIN_DIR}")" != "" ]; then
fi
cp
-f
${
LIB_DIR
}
/
*
${
ROOTFS_DIR
}
/lib
if
[
-e
${
ETC_DIR
}
/.mkshrc
]
;
then
if
[
-e
"
${
ETC_DIR
}
"
/.mkshrc
]
;
then
cp
-f
${
ETC_DIR
}
/.mkshrc
${
ROOTFS_DIR
}
/etc
fi
tools/scripts/parse_exc/parse_excinfo.py
浏览文件 @
2590e343
#!/usr/bin/env python
2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2020-202
2
Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
...
...
@@ -66,7 +66,7 @@ def parse_string_line(excinfo_file, string):
def
parse_kernel_pc_klr
(
excinfo_file
,
ohos_image_file
,
string
,
addr2line_cmd
,
objdump_cmd
):
#parse pc
f
=
open
(
excinfo_file
,
'r+'
)
with
open
(
excinfo_file
,
'r+'
)
as
f
:
start
=
0
for
lines
in
f
.
readlines
():
if
'excFrom: kernel'
in
lines
:
...
...
@@ -76,20 +76,18 @@ def parse_kernel_pc_klr(excinfo_file, ohos_image_file, string, addr2line_cmd, ob
if
start
and
string
in
lines
:
lines
=
lines
[
lines
.
find
(
string
):]
strlist
=
lines
.
split
()
cmd
=
objdump_cmd
+
ohos_image_file
+
' | grep '
+
strlist
[
2
][
2
:]
+
': -B 10 -A 5 -w'
cmd
=
"%s%s | grep %s: -B 10 -A 5 -w"
%
(
objdump_cmd
,
ohos_image_file
,
strlist
[
2
][
2
:])
ret
=
commands
.
getoutput
(
cmd
)
print
(
ret
)
cmd
=
addr2line_cmd
+
ohos_image_file
+
' '
+
strlist
[
2
]
cmd
=
"%s%s %s"
%
(
addr2line_cmd
,
ohos_image_file
,
strlist
[
2
])
ret
=
commands
.
getoutput
(
cmd
)
ret
=
ret
.
split
(
'
\n
'
)
print
(
'<'
+
string
+
'>'
+
ret
[
0
]
+
' <'
+
strlist
[
2
]
+
'>
\n
'
)
f
.
close
()
print
(
"<%s>%s<%s>
\n
"
)
%
(
string
,
ret
[
0
],
strlist
[
2
])
return
0
f
.
close
()
return
-
1
def
parse_kernel_lr
(
excinfo_file
,
ohos_image_file
,
addr2line_cmd
):
f
=
open
(
excinfo_file
,
'r+'
)
with
open
(
excinfo_file
,
'r+'
)
as
f
:
start
=
0
index
=
1
for
lines
in
f
.
readlines
():
...
...
@@ -100,14 +98,12 @@ def parse_kernel_lr(excinfo_file, ohos_image_file, addr2line_cmd):
if
start
and
'lr ='
in
lines
:
lines
=
lines
[
lines
.
find
(
'lr ='
):]
strlist
=
lines
.
split
()
cmd
=
addr2line_cmd
+
ohos_image_file
+
' '
+
strlist
[
2
]
cmd
=
"%s%s %s"
%
(
addr2line_cmd
,
ohos_image_file
,
strlist
[
2
])
ret
=
commands
.
getoutput
(
cmd
)
ret
=
ret
.
split
(
'
\n
'
)
print
(
'<%.2d'
%
index
+
'>'
+
ret
[
0
]
+
' <'
+
strlist
[
2
]
+
'>'
)
print
(
"<%.2d>%s<%s>"
%
(
index
,
ret
[
0
],
strlist
[
2
])
)
index
=
index
+
1
f
.
close
()
def
parse_kernel_exc
(
excinfo_file
,
ohos_image_file
,
addr2line_cmd
,
objdump_cmd
):
#parse pc, klr
ret1
=
parse_kernel_pc_klr
(
excinfo_file
,
ohos_image_file
,
'pc'
,
addr2line_cmd
,
objdump_cmd
)
...
...
@@ -118,7 +114,7 @@ def parse_kernel_exc(excinfo_file, ohos_image_file, addr2line_cmd, objdump_cmd):
def
parse_user_pc_ulr
(
excinfo_file
,
rootfs_dir
,
string
,
addr2line_cmd
,
objdump_cmd
):
#parse pc
f
=
open
(
excinfo_file
,
'r+'
)
with
open
(
excinfo_file
,
'r+'
)
as
f
:
start
=
0
for
lines
in
f
.
readlines
():
if
'excFrom: User'
in
lines
:
...
...
@@ -130,23 +126,20 @@ def parse_user_pc_ulr(excinfo_file, rootfs_dir, string, addr2line_cmd, objdump_c
strlist
=
lines
.
split
()
if
len
(
strlist
)
<
7
:
print
(
'%s is error'
%
string
)
f
.
close
()
return
0
cmd
=
objdump_cmd
+
rootfs_dir
+
strlist
[
4
]
+
' | grep '
+
strlist
[
6
][
2
:]
+
': -B 10 -A 5 -w'
cmd
=
"%s%s%s | grep %s: -B 10 -A 5 -w"
%
(
objdump_cmd
,
rootfs_dir
,
strlist
[
4
],
strlist
[
6
][
2
:])
ret
=
commands
.
getoutput
(
cmd
)
print
(
ret
)
cmd
=
addr2line_cmd
+
rootfs_dir
+
strlist
[
4
]
+
' '
+
strlist
[
6
]
cmd
=
"%s%s%s %s"
%
(
addr2line_cmd
,
rootfs_dir
,
strlist
[
4
],
strlist
[
6
])
#print(cmd)
ret
=
commands
.
getoutput
(
cmd
)
ret
=
ret
.
split
(
'
\n
'
)
print
(
'<'
+
string
+
'>'
+
ret
[
0
]
+
' <'
+
strlist
[
6
]
+
'>'
+
'<'
+
strlist
[
4
]
+
'>
\n
'
)
f
.
close
()
print
(
"<%s>%s<%s><%s>
\n
"
%
(
string
,
ret
[
0
],
strlist
[
6
],
strlist
[
4
]))
return
0
f
.
close
()
return
-
1
def
parse_user_lr
(
excinfo_file
,
rootfs_dir
,
addr2line_cmd
):
f
=
open
(
excinfo_file
,
'r+'
)
with
open
(
excinfo_file
,
'r+'
)
as
f
:
start
=
0
index
=
1
for
lines
in
f
.
readlines
():
...
...
@@ -158,17 +151,14 @@ def parse_user_lr(excinfo_file, rootfs_dir, addr2line_cmd):
lines
=
lines
[
lines
.
find
(
'lr ='
):]
strlist
=
lines
.
split
()
if
len
(
strlist
)
<
11
:
print
(
'%s is error'
%
strlist
)
f
.
close
()
print
(
'%s is error'
%
strlist
)
return
cmd
=
addr2line_cmd
+
rootfs_dir
+
strlist
[
8
]
+
' '
+
strlist
[
10
]
cmd
=
"%s%s%s %s"
%
(
addr2line_cmd
,
rootfs_dir
,
strlist
[
8
],
strlist
[
10
])
res
=
commands
.
getoutput
(
cmd
)
res
=
res
.
split
(
'
\n
'
)
print
(
'<%.2d>'
%
index
+
res
[
0
]
+
' <'
+
strlist
[
10
]
+
'>'
+
'<'
+
strlist
[
8
]
+
'>'
)
print
(
"<%.2d>%s<%s><%s>"
%
(
index
,
res
[
0
],
strlist
[
10
],
strlist
[
8
])
)
index
=
index
+
1
f
.
close
()
def
parse_user_exc
(
excinfo_file
,
rootfs_dir
,
addr2line_cmd
,
objdump_cmd
):
#parse pc ulr
ret1
=
parse_user_pc_ulr
(
excinfo_file
,
rootfs_dir
,
'pc'
,
addr2line_cmd
,
objdump_cmd
)
...
...
@@ -178,7 +168,7 @@ def parse_user_exc(excinfo_file, rootfs_dir, addr2line_cmd, objdump_cmd):
return
ret1
and
ret2
def
parse_backtrace
(
backtrace_file
,
ohos_image_file
,
addr2line_cmd
):
f
=
open
(
backtrace_file
,
'r+'
)
with
open
(
backtrace_file
,
'r+'
)
as
f
:
find
=
-
1
start
=
0
index
=
1
...
...
@@ -190,18 +180,17 @@ def parse_backtrace(backtrace_file, ohos_image_file, addr2line_cmd):
if
start
and
'lr ='
in
lines
:
lines
=
lines
[
lines
.
find
(
'lr ='
):]
strlist
=
lines
.
split
()
cmd
=
addr2line_cmd
+
ohos_image_file
+
' '
+
strlist
[
2
]
cmd
=
"%s%s %s"
%
(
addr2line_cmd
,
ohos_image_file
,
strlist
[
2
])
ret
=
commands
.
getoutput
(
cmd
)
ret
=
ret
.
split
(
'
\n
'
)
print
(
'
\n
<%.2d'
%
index
+
'>'
+
ret
[
0
]
+
' <'
+
strlist
[
2
]
+
'>'
)
print
(
"
\n
<%.2d>%s<%s>"
%
(
index
,
ret
[
0
],
strlist
[
2
])
)
index
=
index
+
1
find
=
0
f
.
close
()
return
find
def
parse_excinfo
(
excinfo_file
,
ohos_image_file
,
rootfs_dir
,
addr2line_cmd
,
objdump_cmd
):
cmd
=
'dos2unix '
+
excinfo_file
cmd
=
"dos2unix %s"
%
(
excinfo_file
)
commands
.
getoutput
(
cmd
)
kernel_exc
=
is_kernel_exc
(
excinfo_file
)
user_exc
=
is_user_exc
(
excinfo_file
)
...
...
@@ -225,7 +214,7 @@ def parse_compiler(compiler):
addr2line_cmd
=
''
objdump
=
''
objdump_cmd
=
''
cmd
=
'which '
+
compiler
cmd
=
"which %s"
%
(
compiler
)
ret
=
commands
.
getoutput
(
cmd
)
if
ret
==
''
:
print
(
'%s is not exist'
%
compiler
)
...
...
tools/scripts/parse_memory/parse_mem_info.sh
浏览文件 @
2590e343
#!/bin/bash
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2020-202
2
Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
...
...
@@ -28,6 +28,7 @@
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set
-e
LOAD_BASE
=
"0x2000000"
LLVM_ADDR2LINE
=
llvm-addr2line
...
...
@@ -36,12 +37,12 @@ GCC_ADDR2LINE=addr2line
get_line
()
{
SYM_ADDR
=
$(
echo
$1
|
awk
'{print $2}'
)
ELF_OFFSET
=
`
echo
${
SYM_ADDR
}
|
cut
-d
'['
-f2
|
cut
-d
']'
-f1
`
FILE_LINE
=
`
${
ADDR2LINE
}
-f
-e
$2
${
ELF_OFFSET
}
|
awk
'NR==2'
`
ELF_OFFSET
=
$(
echo
${
SYM_ADDR
}
|
cut
-d
'['
-f2
|
cut
-d
']'
-f1
)
FILE_LINE
=
$(
${
ADDR2LINE
}
-f
-e
$2
${
ELF_OFFSET
}
|
awk
'NR==2'
`
)
if
[[
"
${
FILE_LINE
}
"
==
*
"?"
*
]]
;
then
typeset
ELF_OFFSET
=
$((
ELF_OFFSET+LOAD_BASE
))
ELF_OFFSET
=
$(
echo
"obase=16;
${
ELF_OFFSET
}
"
| bc
)
FILE_LINE
=
`
${
ADDR2LINE
}
-f
-e
$2
${
ELF_OFFSET
}
|
awk
'NR==2'
`
FILE_LINE
=
$(
${
ADDR2LINE
}
-f
-e
$2
${
ELF_OFFSET
}
|
awk
'NR==2'
)
fi
echo
${
FILE_LINE
}
}
...
...
@@ -58,12 +59,12 @@ parse_line()
echo
"Error: no such file:
$i
"
exit
1
fi
FILE_LINE
=
`
get_line
"
$1
"
$i
`
FILE_LINE
=
$(
get_line
"
$1
"
$i
)
if
[[
"
${
FILE_LINE
}
"
==
*
"?"
*
]]
||
[
-z
"
${
FILE_LINE
}
"
]
;
then
echo
" * Error: you need ensure whether file: "
$i
" was compiled with -g or not! *"
exit
1
fi
LINE
=
`
echo
$1
|
tr
-d
'\r'
`
LINE
=
$(
echo
$1
|
tr
-d
'\r'
)
LINE
=
$(
echo
${
LINE
}
|
awk
'{print $1,$2}'
)
echo
" "
${
LINE
}
" at "
${
FILE_LINE
}
FLAG
=
true
...
...
@@ -81,7 +82,7 @@ if [ $# -le 1 ]; then
fi
read
-n5
-p
"Compiler is [gcc/llvm]: "
ANSWER
case
${
ANSWER
}
in
case
"
${
ANSWER
}
"
in
(
gcc
|
GCC
)
which
${
GCC_ADDR2LINE
}
>
/dev/null 2>&1
if
[
$?
-eq
0
]
;
then
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录