symg

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbgSymbol        dbgFlags = 1 << iota
	DbgParseIsMethod          //print parse.go isMethod debug log info
	DbgFlagAll       = DbgSymbol | DbgParseIsMethod
)

Variables

This section is empty.

Functions

func AddSymbolPrefixUnder

func AddSymbolPrefixUnder(name string, isCpp bool) string

For mutiple os test,the nm output's symbol name is different.

func Do

func Do(conf *Config) error

func GenSymbolTableData

func GenSymbolTableData(commonSymbols []*llcppg.SymbolInfo) ([]byte, error)

func GenerateSymTable

func GenerateSymTable(symbols []*nm.Symbol, headerInfos map[string]*SymbolInfo) ([]byte, error)

func GetCommonSymbols

func GetCommonSymbols(dylibSymbols []*nm.Symbol, headerSymbols map[string]*SymbolInfo) []*llcppg.SymbolInfo

finds the intersection of symbols from the dynamic library's symbol table and the symbols parsed from header files. It returns a list of symbols that can be externally linked.

func GetIncludePaths

func GetIncludePaths() []string

func GetLibPaths

func GetLibPaths() []string

func ParseClangIncOutput

func ParseClangIncOutput(output string) []string

func ParseDylibSymbols

func ParseDylibSymbols(lib string) ([]*nm.Symbol, error)

ParseDylibSymbols parses symbols from dynamic libraries specified in the lib string. It handles multiple libraries (e.g., -L/opt/homebrew/lib -llua -lm) and returns symbols if at least one library is successfully parsed. Errors from inaccessible libraries (like standard libs) are logged as warnings.

Returns symbols and nil error if any symbols are found, or nil and error if none found.

func ParseHeaderFile

func ParseHeaderFile(files []string, prefixes []string, cflags []string, symMap map[string]string, isCpp bool, isTemp bool) (map[string]*SymbolInfo, error)

func ParseLdOutput

func ParseLdOutput(output string) []string

Note:this function is only use in this package The public function name is for llgo test

func SetDebug

func SetDebug(flags dbgFlags)

Types

type Collect

type Collect struct {
	SymName    string             // symbol name
	GetSymInfo func() *SymbolInfo // get symbol info
}

type Config

type Config struct {
	Conf *llcppg.Config
}

type SymbolInfo

type SymbolInfo struct {
	GoName    string
	ProtoName string
}

type SymbolProcessor

type SymbolProcessor struct {
	Files      []string
	Prefixes   []string
	SymbolMap  map[string]*SymbolInfo
	NameCounts map[string]int
	// custom symbol map like:
	// "sqlite3_finalize":".Close" -> method
	// "sqlite3_open":"Open" -> function
	CustomSymMap map[string]string
	// contains filtered or unexported fields
}

func NewSymbolProcessor

func NewSymbolProcessor(Files []string, Prefixes []string, SymMap map[string]string) *SymbolProcessor

func (*SymbolProcessor) AddSuffix

func (p *SymbolProcessor) AddSuffix(name string) string

func (*SymbolProcessor) GenMethodName

func (p *SymbolProcessor) GenMethodName(class, name string, isDestructor bool, isPointer bool) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL