aboutcode-org / aboutcode-org/elf-inspector

Ignore "fake" symbols

未關閉
#7 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
1
分支
0
PR 合併指標
30 天內沒有已合併 PR

描述

These are builtin and related:
This is a small function worked out in go-inspector:
```Python
def is_fake_path(path):
"""
Return True if a ``path`` string is for a fake path injected by the linker or compiler in the binary.
See:
https://github.com/smoofra/elfutils/blob/53b6f190892c738f28840e7481a09c7ee19b6720/src/srcfiles.cxx#L160

For example:
>>> is_fake_symbol("")
True
>>> is_fake_symbol("foo/bar/")
True
>>> is_fake_symbol("")
True
>>> is_fake_symbol("/artificial/asdasdas/adsd")
False
>>> is_fake_symbol("")
False
>>> is_fake_symbol("/sdfsdfsdf/zffd")
Trye

"""
fake_paths = (
#gcc intrinsics
"", "",
# seen in Go and C++
"",
"",
)
return isinstance(path, str) and any(fs in path for fs in fake_paths)
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。