C. Coelho

15 papers Journal 9Unranked 6
YearRankTypeTitle / Venue / Authors
2025 J jnl
Expert Syst. Appl.
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2024 J jnl
CoRR
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2024 J jnl
CoRR
C. Coelho, M. Jing, M. Fernanda P. Costa, Luís L. Ferrás
2024 J jnl
Appl. Math. Comput.
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2024 J jnl
CoRR
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2024 conf
Tiny Papers @ ICLR
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2023 conf
PKDD/ECML Workshops (3)
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2023 J jnl
CoRR
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2023 J jnl
CoRR
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2023 J jnl
CoRR
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2023 conf
Tiny Papers @ ICLR
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2023 conf
AI4KMES@ECAI
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2023 J jnl
CoRR
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás
2021 conf
ICCSA (2)
C. Coelho, M. Fernanda P. Costa, Luís L. Ferrás, Ana Jacinta Soares
2021 conf
ICCSA (4)
M. Fernanda P. Costa, C. Coelho, Luís L. Ferrás
redb/extractors/decompiler/bninja/function_type.py
← Index redb/extractors/decompiler/bninja/function_type.py python
from enum import Enum

import binaryninja


class FunctionType(Enum):
    USER = "USER"
    LIBRARY = "LIBRARY"
    EXTERNAL = "EXTERNAL"
    THUNK = "THUNK"
    UNKNOWN = "UNKNOWN"


class FunctionTypeAnalysis:
    """Get the function kind based on the symbol type associated to this function"""

    def __init__(self, function):
        """Sets the function type dependent on the symbol type associated to this function. If
        any errors occur, then returns UNKNOWN
        """
        self.func_type = FunctionType.USER

        try:
            symbol_type = function.symbol.type
            # Check if it's an external function (there should not be, already skipping these)
            if symbol_type == binaryninja.enums.SymbolType.ImportedFunctionSymbol:
                self.func_type = FunctionType.EXTERNAL

            # Library functions detected by Binary Ninja
            if symbol_type == binaryninja.enums.SymbolType.LibraryFunctionSymbol:
                self.func_type = FunctionType.LIBRARY

            # Check if it's a thunk function
            if function.is_thunk:
                self.func_type = FunctionType.THUNK

        except Exception as _:
            self.func_type = FunctionType.UNKNOWN

    def get_function_type(self):
        return self.func_type