Xiaojun Ma

14 papers A 1Misc 1Journal 6Unranked 6
YearRankTypeTitle / Venue / Authors
2010 conf
ACM Great Lakes Symposium on VLSI
Xiaojun Ma, Masoud Hashempour, Lei Wang, Fabrizio Lombardi
2009 J jnl
J. Electron. Test.
Xiaojun Ma, Jing Huang, Cecilia Metra, Fabrizio Lombardi
2009 conf
DFT
Xiaojun Ma, Masoud Hashempour, Yong-Bin Kim, Fabrizio Lombardi
2009 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Xiaojun Ma, Fabrizio Lombardi
2008 J jnl
ACM J. Emerg. Technol. Comput. Syst.
Xiaojun Ma, Jing Huang, Fabrizio Lombardi
2008 conf
DFT
Xiaojun Ma, Fabrizio Lombardi
2008 J jnl
J. Electron. Test.
Xiaojun Ma, Jing Huang, Cecilia Metra, Fabrizio Lombardi
2008 J jnl
J. Electron. Test.
Xiaojun Ma, Fabrizio Lombardi
2008 J jnl
IEEE Trans. Comput. Aided Des. Integr. Circuits Syst.
Xiaojun Ma, Fabrizio Lombardi
2007 Misc conf
VTS
Xiaojun Ma, Jing Huang, Fabrizio Lombardi
2007 A conf
ITC
Xiaojun Ma, Jing Huang, Fabrizio Lombardi
2007 conf
DFT
Jing Huang, Xiaojun Ma, Cecilia Metra, Fabrizio Lombardi
2006 conf
DFT
Xiaojun Ma, Fabrizio Lombardi
2006 conf
DFT
Xiaojun Ma, Jing Huang, Cecilia Metra, Fabrizio Lombardi
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