Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
17e93b8f
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,发现更多精彩内容 >>
提交
17e93b8f
编写于
8月 21, 2019
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Disable ELF on Mac OS #6429
上级
f277d0eb
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
52 addition
and
31 deletion
+52
-31
dbms/src/Common/Dwarf.cpp
dbms/src/Common/Dwarf.cpp
+4
-0
dbms/src/Common/Dwarf.h
dbms/src/Common/Dwarf.h
+4
-0
dbms/src/Common/Elf.cpp
dbms/src/Common/Elf.cpp
+4
-0
dbms/src/Common/Elf.h
dbms/src/Common/Elf.h
+4
-31
dbms/src/Common/StackTrace.cpp
dbms/src/Common/StackTrace.cpp
+13
-0
dbms/src/Common/SymbolIndex.cpp
dbms/src/Common/SymbolIndex.cpp
+4
-0
dbms/src/Common/SymbolIndex.h
dbms/src/Common/SymbolIndex.h
+4
-0
dbms/src/Common/tests/symbol_index.cpp
dbms/src/Common/tests/symbol_index.cpp
+7
-0
dbms/src/Functions/addressToLine.cpp
dbms/src/Functions/addressToLine.cpp
+4
-0
dbms/src/Functions/addressToSymbol.cpp
dbms/src/Functions/addressToSymbol.cpp
+4
-0
未找到文件。
dbms/src/Common/Dwarf.cpp
浏览文件 @
17e93b8f
#ifdef __ELF__
/*
* Copyright 2012-present Facebook, Inc.
*
...
...
@@ -1031,3 +1033,5 @@ bool Dwarf::LineNumberVM::findAddress(uintptr_t target, Path & file, uint64_t &
}
}
#endif
dbms/src/Common/Dwarf.h
浏览文件 @
17e93b8f
#pragma once
#ifdef __ELF__
/*
* Copyright 2012-present Facebook, Inc.
*
...
...
@@ -285,3 +287,5 @@ private:
};
}
#endif
dbms/src/Common/Elf.cpp
浏览文件 @
17e93b8f
#ifdef __ELF__
#include <Common/Elf.h>
#include <Common/Exception.h>
...
...
@@ -128,3 +130,5 @@ size_t Elf::Section::size() const
}
}
#endif
dbms/src/Common/Elf.h
浏览文件 @
17e93b8f
#pragma once
#ifdef __ELF__
#include <IO/MMapReadBufferFromFile.h>
#include <string>
#include <optional>
#include <functional>
#ifdef __APPLE__
#include <libelf/gelf.h>
typedef
Elf64_Addr
GElf_Addr
;
typedef
Elf64_Half
GElf_Half
;
typedef
Elf64_Off
GElf_Off
;
typedef
Elf64_Sword
GElf_Sword
;
typedef
Elf64_Word
GElf_Word
;
typedef
Elf64_Sxword
GElf_Sxword
;
typedef
Elf64_Xword
GElf_Xword
;
typedef
Elf64_Ehdr
GElf_Ehdr
;
typedef
Elf64_Phdr
GElf_Phdr
;
typedef
Elf64_Shdr
GElf_Shdr
;
typedef
Elf64_Dyn
GElf_Dyn
;
typedef
Elf64_Rel
GElf_Rel
;
typedef
Elf64_Rela
GElf_Rela
;
typedef
Elf64_Sym
GElf_Sym
;
#define DT_GNU_HASH 0x6ffffef5
/* GNU-style hash table. */
#define __ELF_NATIVE_CLASS __WORDSIZE
#define ElfW(type) _ElfW(Elf, __ELF_NATIVE_CLASS, type)
#define _ElfW(e, w, t) _ElfW_1(e, w, _##t)
#define _ElfW_1(e, w, t) e##w##t
#else
#include <elf.h>
#include <link.h>
#endif
using
ElfAddr
=
ElfW
(
Addr
);
using
ElfEhdr
=
ElfW
(
Ehdr
);
...
...
@@ -92,3 +63,5 @@ private:
};
}
#endif
dbms/src/Common/StackTrace.cpp
浏览文件 @
17e93b8f
...
...
@@ -250,6 +250,7 @@ static void toStringEveryLineImpl(const StackTrace::Frames & frames, size_t offs
if
(
size
==
0
)
return
callback
(
"<Empty trace>"
);
#ifdef __ELF__
const
DB
::
SymbolIndex
&
symbol_index
=
DB
::
SymbolIndex
::
instance
();
std
::
unordered_map
<
std
::
string
,
DB
::
Dwarf
>
dwarfs
;
...
...
@@ -290,6 +291,18 @@ static void toStringEveryLineImpl(const StackTrace::Frames & frames, size_t offs
callback
(
out
.
str
());
out
.
str
({});
}
#else
std
::
stringstream
out
;
for
(
size_t
i
=
offset
;
i
<
size
;
++
i
)
{
const
void
*
addr
=
frames
[
i
];
out
<<
i
<<
". "
<<
addr
;
callback
(
out
.
str
());
out
.
str
({});
}
#endif
}
static
std
::
string
toStringImpl
(
const
StackTrace
::
Frames
&
frames
,
size_t
offset
,
size_t
size
)
...
...
dbms/src/Common/SymbolIndex.cpp
浏览文件 @
17e93b8f
#ifdef __ELF__
#include <Common/SymbolIndex.h>
#include <algorithm>
...
...
@@ -316,3 +318,5 @@ const SymbolIndex::Object * SymbolIndex::findObject(const void * address) const
}
}
#endif
dbms/src/Common/SymbolIndex.h
浏览文件 @
17e93b8f
#pragma once
#ifdef __ELF__
#include <vector>
#include <string>
#include <ext/singleton.h>
...
...
@@ -53,3 +55,5 @@ private:
};
}
#endif
dbms/src/Common/tests/symbol_index.cpp
浏览文件 @
17e93b8f
...
...
@@ -16,6 +16,7 @@ using namespace DB;
int
main
(
int
argc
,
char
**
argv
)
{
#ifdef __ELF__
if
(
argc
<
2
)
{
std
::
cerr
<<
"Usage: ./symbol_index address
\n
"
;
...
...
@@ -53,6 +54,12 @@ int main(int argc, char ** argv)
std
::
cerr
<<
"
\n
"
;
std
::
cerr
<<
StackTrace
().
toString
()
<<
"
\n
"
;
#else
(
void
)
argc
;
(
void
)
argv
;
std
::
cerr
<<
"This test does not make sense for non-ELF objects.
\n
"
;
#endif
return
0
;
}
dbms/src/Functions/addressToLine.cpp
浏览文件 @
17e93b8f
#ifdef __ELF__
#include <Common/Elf.h>
#include <Common/Dwarf.h>
#include <Common/SymbolIndex.h>
...
...
@@ -149,3 +151,5 @@ void registerFunctionAddressToLine(FunctionFactory & factory)
}
}
#endif
dbms/src/Functions/addressToSymbol.cpp
浏览文件 @
17e93b8f
#ifdef __ELF__
#include <Common/SymbolIndex.h>
#include <Columns/ColumnString.h>
#include <Columns/ColumnsNumber.h>
...
...
@@ -92,3 +94,5 @@ void registerFunctionAddressToSymbol(FunctionFactory & factory)
}
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录