Skip to content

Ignore "fake" symbols #7

@pombredanne

Description

@pombredanne

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions