nm

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Undefined = SymbolType('U') // Undefined
	Text      = SymbolType('T') // Text (code) section symbol
	Data      = SymbolType('D') // Data (global var) section symbol
	Rodata    = SymbolType('R') // Read-only data (rodata) section symbol
	BSS       = SymbolType('B') // BSS (uninitialized global var) section symbol

	LocalText = SymbolType('t') // Local text (code) section symbol
	LocalData = SymbolType('d') // Local data (local var) section symbol
	LocalBSS  = SymbolType('b') // Local BSS (uninitialized local var) section symbol
	LocalASym = SymbolType('s') // Local symbol in an assembler source file
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

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

Cmd represents a nm command.

func New

func New(app string) *Cmd

New creates a new nm command.

func (*Cmd) List

func (p *Cmd) List(arfile string, options ...string) (items []*ObjectFile, err error)

List lists symbols in an archive file accepts optional nm command flags. Note: The available flags may vary depending on the operating system. On Linux, the -D flag is used to display dynamic symbols from the dynamic symbol table. On macOS, there's no -D flag. The nm command displays all symbols (including dynamic ones) by default. This difference is due to the distinct ways Linux (using ELF format) and macOS (using Mach-O format) When working with dynamic libraries: On Linux: Use 'nm -D /path/to/library.so' On macOS: Simply use 'nm /path/to/library.dylib'

type ObjectFile

type ObjectFile struct {
	File    string    // file name
	Symbols []*Symbol // symbols
}

ObjectFile represents an object file.

type Symbol

type Symbol struct {
	Name        string      // symbol name
	Addr        uint64      // symbol address
	Type        SymbolType  // symbol type
	FAddr       bool        // address is valid
	VersionType VersionType // version type of the symbol
	Version     string      // version information of the symbol
}

Symbol represents a symbol in an object file.

type SymbolType

type SymbolType uint8

SymbolType represents a symbol type.

type VersionType added in v0.9.8

type VersionType int

VersionType represents the version type of a symbol. This is specific to Linux systems. On macOS , this will always be VersionNone. https://sourceware.org/binutils/docs/binutils/nm.html

const (
	VersionNone     VersionType = iota // No version information
	VersionSpecific                    // Specific version (@)
	VersionDefault                     // Default version (@@)
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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