Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore "fake" symbols #7

Open
pombredanne opened this issue Jul 25, 2024 · 0 comments
Open

Ignore "fake" symbols #7

pombredanne opened this issue Jul 25, 2024 · 0 comments

Comments

@pombredanne
Copy link
Member

These are builtin and related:
This is a small function worked out in go-inspector:

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("<built-in>")
    True
    >>> is_fake_symbol("foo/bar/<builtin>")
    True
    >>> is_fake_symbol("<artificial>")
    True
    >>> is_fake_symbol("/artificial/asdasdas/adsd")
    False
    >>> is_fake_symbol("<foo-bar>")
    False
    >>> is_fake_symbol("/sdfsdfsdf<unknown>/zffd")
    Trye

    """
    fake_paths = (
        #gcc intrinsics
        "<built-in>", "<builtin>",
        # seen in Go and C++
        "<artificial>",
        "<unknown>",
    )
    return isinstance(path, str) and any(fs in path for fs in fake_paths)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant