Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
80f42a1f
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
80f42a1f
编写于
12月 24, 2019
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Show physical addresses in StackTrace
上级
d029ee3d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
10 deletion
+14
-10
dbms/src/Common/Dwarf.h
dbms/src/Common/Dwarf.h
+2
-2
dbms/src/Common/StackTrace.cpp
dbms/src/Common/StackTrace.cpp
+10
-7
dbms/src/Common/SymbolIndex.h
dbms/src/Common/SymbolIndex.h
+1
-0
dbms/src/Common/tests/symbol_index.cpp
dbms/src/Common/tests/symbol_index.cpp
+1
-1
未找到文件。
dbms/src/Common/Dwarf.h
浏览文件 @
80f42a1f
...
...
@@ -127,8 +127,8 @@ public:
uint64_t
line
=
0
;
};
/**
*
Find the file and line number information corresponding to address
.
/**
Find the file and line number information corresponding to address.
*
The address must be physical - offset in object file without offset in virtual memory where the object is loaded
.
*/
bool
findAddress
(
uintptr_t
address
,
LocationInfo
&
info
,
LocationInfoMode
mode
)
const
;
...
...
dbms/src/Common/StackTrace.cpp
浏览文件 @
80f42a1f
...
...
@@ -258,10 +258,14 @@ static void toStringEveryLineImpl(const StackTrace::Frames & frames, size_t offs
for
(
size_t
i
=
offset
;
i
<
size
;
++
i
)
{
const
void
*
addr
=
frames
[
i
];
const
void
*
virtual_addr
=
frames
[
i
];
auto
object
=
symbol_index
.
findObject
(
virtual_addr
);
uintptr_t
virtual_offset
=
object
?
uintptr_t
(
object
->
address_begin
)
:
0
;
const
void
*
physical_addr
=
reinterpret_cast
<
const
void
*>
(
uintptr_t
(
virtual_addr
)
-
virtual_offset
);
out
<<
i
<<
". "
<<
physical_addr
<<
" "
;
out
<<
i
<<
". "
<<
addr
<<
" "
;
auto
symbol
=
symbol_index
.
findSymbol
(
addr
);
auto
symbol
=
symbol_index
.
findSymbol
(
virtual_addr
);
if
(
symbol
)
{
int
status
=
0
;
...
...
@@ -272,18 +276,17 @@ static void toStringEveryLineImpl(const StackTrace::Frames & frames, size_t offs
out
<<
" "
;
if
(
auto
object
=
symbol_index
.
findObject
(
addr
)
)
if
(
object
)
{
if
(
std
::
filesystem
::
exists
(
object
->
name
))
{
auto
dwarf_it
=
dwarfs
.
try_emplace
(
object
->
name
,
*
object
->
elf
).
first
;
DB
::
Dwarf
::
LocationInfo
location
;
if
(
dwarf_it
->
second
.
findAddress
(
uintptr_t
(
addr
)
-
uintptr_t
(
object
->
address_begin
),
location
,
DB
::
Dwarf
::
LocationInfoMode
::
FAST
))
if
(
dwarf_it
->
second
.
findAddress
(
uintptr_t
(
physical_addr
),
location
,
DB
::
Dwarf
::
LocationInfoMode
::
FAST
))
out
<<
location
.
file
.
toString
()
<<
":"
<<
location
.
line
;
else
out
<<
object
->
name
;
}
out
<<
" in "
<<
object
->
name
;
}
else
out
<<
"?"
;
...
...
dbms/src/Common/SymbolIndex.h
浏览文件 @
80f42a1f
...
...
@@ -38,6 +38,7 @@ public:
std
::
unique_ptr
<
Elf
>
elf
;
};
/// Address in virtual memory should be passed. These addresses include offset where the object is loaded in memory.
const
Symbol
*
findSymbol
(
const
void
*
address
)
const
;
const
Object
*
findObject
(
const
void
*
address
)
const
;
...
...
dbms/src/Common/tests/symbol_index.cpp
浏览文件 @
80f42a1f
...
...
@@ -49,7 +49,7 @@ int main(int argc, char ** argv)
Dwarf
dwarf
(
*
object
->
elf
);
Dwarf
::
LocationInfo
location
;
if
(
dwarf
.
findAddress
(
uintptr_t
(
address
),
location
,
Dwarf
::
LocationInfoMode
::
FAST
))
if
(
dwarf
.
findAddress
(
uintptr_t
(
address
)
-
uintptr_t
(
info
.
dli_fbase
)
,
location
,
Dwarf
::
LocationInfoMode
::
FAST
))
std
::
cerr
<<
location
.
file
.
toString
()
<<
":"
<<
location
.
line
<<
"
\n
"
;
else
std
::
cerr
<<
"Dwarf: Not found
\n
"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录