elf2sql

package
v0.0.0-...-f610534 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DFText      DisplayFormat = 0 // Plain text
	DFPretty                  = 1 // Unicode output
	DFPrettyCol               = 2 // Unicode color output
	DFCSV                     = 3 // Comm-separated output
	DFMarkdown                = 4 // Markdown table output
	DFHtml                    = 5 // HTML table output
	DFJson                    = 6 // JSON output
)

Display format options

View Source
const (
	StbLocal  SymBinding = 0  // Local symbol
	StbGlobal            = 1  // Global symbol
	StbWeak              = 2  // Weak global symbol
	StbLoOs              = 10 // Reserved for OS-specific semantics
	StbHiOs              = 12 // Reserved for OS-specific semantics
	StbLoProc            = 13 // Reserved for processor-specific semantics
	StbHiProc            = 15 // Reserved for processor-specific semantics
)

Symbolic table binding value definitions

View Source
const (
	SttNoType  SymType = 0  // Not specified
	SttObject          = 1  // Data object (variable, array, etc.)
	SttFunc            = 2  // Function or executable code
	SttSection         = 3  // Section
	SttFile            = 4  // Name of source file
	SttCommon          = 5  // Uninitalised common block
	SttTLS             = 6  // Thread-local storage entity
	SttLoOs            = 10 // Reserved for OS-specific semantics
	SttHiOs            = 12 // Reserved for OS-specific semantics
	SttLoProc          = 13 // Reserved for processor-specific semantics
	SttHiProc          = 15 // Reserved for processor-specific semantics
)

ELF

View Source
const (
	SymVisDefault   SymVisibility = 0 // Default
	SymVisInternal                = 1 // Reserved value
	SymVisHidden                  = 2 // Not visible to other components
	SymVisProtected               = 3 // Visible but can't be preeùpted
	SymVisExported                = 4 // Global
	SymVisSingleton               = 5 // Global, singleton
	SymVisEliminate               = 6 // Extends hidden
)

ELF

View Source
const (
	PrettyASCII    PrettyFormat = 0 // ASCII table
	PrettyUnicode               = 1 // Unicode table
	PrettyColor                 = 2 // Unicode color table
	PrettyMarkdown              = 3 // Markdown table
	PrettyHTML                  = 4 // HTML table
	PrettyCSV                   = 5 // CSV table
)

Pretty format values

Variables

View Source
var (
	// DBCon provides access to the shared database
	DBCon *sql.DB
)

Functions

func CloseDB

func CloseDB()

CloseDB closes the shared database connection

func InitDB

func InitDB(filename string) error

InitDB loads the specified ELF file into a memory-based SQLite database. The database contains two tables: 'sections' and 'symbols'.

func RenderJSON

func RenderJSON(rows *sql.Rows) (string, error)

RenderJSON takes an SQL result and converts it to a nice JSON form. Source: https://stackoverflow.com/a/60386531/12849275

func RunQuery

func RunQuery(query string, format DisplayFormat) (string, error)

RunQuery runs the specified SQL query against the database.

Types

type DisplayFormat

type DisplayFormat uint8

DisplayFormat is used with the Render function to determine how rows are rendered.

type PrettyFormat

type PrettyFormat uint8

PrettyFormat represents the various pretty output options

type Section

type Section struct {
	// contains filtered or unexported fields
}

Section encapsulates a section entry in the DB

type SymBinding

type SymBinding uint8

SymBinding represents symbolic table binding values

type SymType

type SymType uint8

SymType represents ELF symbol types

type SymVisibility

type SymVisibility uint8

SymVisibility represents ELF symbol visibility values

type Symbol

type Symbol struct {
	// contains filtered or unexported fields
}

Symbol encapsulates a symbol entry in the DB

Jump to

Keyboard shortcuts

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