Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
7cab9af6
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
403
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7cab9af6
编写于
12月 01, 2022
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(debug): skip load user gdb script if
gdb is build with python2 GitOrigin-RevId: 816a15d774183aefd1dabfea8a1726f6bc4edf74
上级
5f02245c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
24 deletion
+34
-24
scripts/gdb/commands.py
scripts/gdb/commands.py
+12
-9
scripts/gdb/pretty_printers.py
scripts/gdb/pretty_printers.py
+19
-14
scripts/gdb/xmethods.py
scripts/gdb/xmethods.py
+3
-1
未找到文件。
scripts/gdb/commands.py
浏览文件 @
7cab9af6
import
sys
import
gdb
import
re
...
...
@@ -199,12 +200,14 @@ class MegengineInfo(gdb.Command):
return
[
"opr"
,
"trf"
]
MegengineBacktrace
()
MegengineBreakApply
()
MegengineUp
()
MegengineDown
()
MegengineInfo
()
MegengineWatch
()
gdb
.
Breakpoint
(
"mgb::imperative::debug::notify_event(char const*)"
)
\ No newline at end of file
if
sys
.
version_info
.
major
>
2
:
MegengineBacktrace
()
MegengineBreakApply
()
MegengineUp
()
MegengineDown
()
MegengineInfo
()
MegengineWatch
()
gdb
.
Breakpoint
(
"mgb::imperative::debug::notify_event(char const*)"
)
else
:
print
(
"skip import commands"
)
scripts/gdb/pretty_printers.py
浏览文件 @
7cab9af6
import
sys
import
gdb
import
gdb.printing
import
gdb.types
...
...
@@ -170,23 +171,26 @@ class SpanPrinter:
yield
"[{}]"
.
format
(
i
),
(
self
.
begin
+
i
).
dereference
()
pp
=
gdb
.
printing
.
RegexpCollectionPrettyPrinter
(
"MegEngine"
)
if
sys
.
version_info
.
major
>
2
:
pp
=
gdb
.
printing
.
RegexpCollectionPrettyPrinter
(
"MegEngine"
)
# megdnn
pp
.
add_printer
(
'megdnn::SmallVectorImpl'
,
'^megdnn::SmallVector(Impl)?<.*>$'
,
SmallVectorPrinter
)
pp
.
add_printer
(
'megdnn::TensorLayout'
,
'^megdnn::TensorLayout$'
,
ToStringPrinter
)
pp
.
add_printer
(
'megdnn::TensorShape'
,
'^megdnn::TensorShape$'
,
ToStringPrinter
)
pp
.
add_printer
(
'megdnn::SmallVectorImpl'
,
'^megdnn::SmallVector(Impl)?<.*>$'
,
SmallVectorPrinter
)
pp
.
add_printer
(
'megdnn::TensorLayout'
,
'^megdnn::TensorLayout$'
,
ToStringPrinter
)
pp
.
add_printer
(
'megdnn::TensorShape'
,
'^megdnn::TensorShape$'
,
ToStringPrinter
)
# megbrain
pp
.
add_printer
(
'mgb::CompNode'
,
'^mgb::CompNode$'
,
ToStringPrinter
)
pp
.
add_printer
(
'mgb::Maybe'
,
'^mgb::Maybe<.*>$'
,
MaybePrinter
)
pp
.
add_printer
(
'mgb::CompNode'
,
'^mgb::CompNode$'
,
ToStringPrinter
)
pp
.
add_printer
(
'mgb::Maybe'
,
'^mgb::Maybe<.*>$'
,
MaybePrinter
)
# imperative
pp
.
add_printer
(
'mgb::imperative::LogicalTensorDesc'
,
'^mgb::imperative::LogicalTensorDesc$'
,
LogicalTensorDescPrinter
)
pp
.
add_printer
(
'mgb::imperative::OpDef'
,
'^mgb::imperative::OpDef$'
,
OpDefPrinter
)
pp
.
add_printer
(
'mgb::imperative::Subgraph'
,
'^mgb::imperative::Subgraph$'
,
ReprPrinter
)
pp
.
add_printer
(
'mgb::imperative::EncodedSubgraph'
,
'^mgb::imperative::EncodedSubgraph$'
,
ReprPrinter
)
pp
.
add_printer
(
'mgb::imperative::LogicalTensorDesc'
,
'^mgb::imperative::LogicalTensorDesc$'
,
LogicalTensorDescPrinter
)
pp
.
add_printer
(
'mgb::imperative::OpDef'
,
'^mgb::imperative::OpDef$'
,
OpDefPrinter
)
pp
.
add_printer
(
'mgb::imperative::Subgraph'
,
'^mgb::imperative::Subgraph$'
,
ReprPrinter
)
pp
.
add_printer
(
'mgb::imperative::EncodedSubgraph'
,
'^mgb::imperative::EncodedSubgraph$'
,
ReprPrinter
)
# imperative dispatch
pp
.
add_printer
(
'mgb::imperative::ValueRef'
,
'^mgb::imperative::ValueRef$'
,
ToStringPrinter
)
pp
.
add_printer
(
'mgb::imperative::Span'
,
'^mgb::imperative::Span<.*>$'
,
SpanPrinter
)
gdb
.
printing
.
register_pretty_printer
(
gdb
.
current_objfile
(),
pp
)
pp
.
add_printer
(
'mgb::imperative::ValueRef'
,
'^mgb::imperative::ValueRef$'
,
ToStringPrinter
)
pp
.
add_printer
(
'mgb::imperative::Span'
,
'^mgb::imperative::Span<.*>$'
,
SpanPrinter
)
gdb
.
printing
.
register_pretty_printer
(
gdb
.
current_objfile
(),
pp
)
else
:
print
(
"skip import pretty printers"
)
def
override_pretty_printer_for
(
val
):
...
...
@@ -201,4 +205,5 @@ def override_pretty_printer_for(val):
return
HandlePrinter
(
val
)
gdb
.
pretty_printers
.
append
(
override_pretty_printer_for
)
if
sys
.
version_info
.
major
>
2
:
gdb
.
pretty_printers
.
append
(
override_pretty_printer_for
)
scripts/gdb/xmethods.py
浏览文件 @
7cab9af6
import
sys
import
re
import
gdb
...
...
@@ -48,4 +49,5 @@ class SmallVectorImplMatcher(gdb.xmethod.XMethodMatcher):
return
SmallVectorImplWorker_size
(
class_type
.
template_argument
(
0
))
gdb
.
xmethod
.
register_xmethod_matcher
(
None
,
SmallVectorImplMatcher
())
if
sys
.
version_info
.
major
>
2
:
gdb
.
xmethod
.
register_xmethod_matcher
(
None
,
SmallVectorImplMatcher
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录