aboutcode-org / aboutcode-org/elf-inspector

Ignore "fake" symbols

Offen
#7 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
1
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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)
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.