Functions
Decode
method
#
Decode disassembles the text segment range [start, end), calling f for each instruction.
func (d *Disasm) Decode(start uint64, end uint64, relocs []objfile.Reloc, gnuAsm bool, f func(pc uint64, size uint64, file string, line int, text string))
DisasmForFile
function
#
DisasmForFile returns a disassembler for the file f.
func DisasmForFile(f *objfile.File) (*Disasm, error)
Line
method
#
Line returns the source code line for the given file and line number.
If the file is not already cached, reads it, inserts it into the cache,
and removes the least recently used file if necessary.
If the file is in cache, it is moved to the front of the list.
func (fc *FileCache) Line(filename string, line int) ([]byte, error)
NewFileCache
function
#
NewFileCache returns a FileCache which can contain up to maxLen cached file contents.
func NewFileCache(maxLen int) *FileCache
Print
method
#
Print prints a disassembly of the file to w.
If filter is non-nil, the disassembly only includes functions with names matching filter.
If printCode is true, the disassembly includes corresponding source lines.
The disassembly only includes functions that overlap the range [start, end).
func (d *Disasm) Print(w io.Writer, filter *regexp.Regexp, start uint64, end uint64, printCode bool, gnuAsm bool)
ReadAt
method
#
func (r textReader) ReadAt(data []byte, off int64) (n int, err error)
base
function
#
base returns the final element in the path.
It works on both Windows and Unix paths,
regardless of host operating system.
func base(path string) string
disasmForEntry
function
#
func disasmForEntry(e *objfile.Entry) (*Disasm, error)
disasm_386
function
#
func disasm_386(code []byte, pc uint64, lookup lookupFunc, _ binary.ByteOrder, gnuAsm bool) (string, int)
disasm_amd64
function
#
func disasm_amd64(code []byte, pc uint64, lookup lookupFunc, _ binary.ByteOrder, gnuAsm bool) (string, int)
disasm_arm
function
#
func disasm_arm(code []byte, pc uint64, lookup lookupFunc, _ binary.ByteOrder, gnuAsm bool) (string, int)
disasm_arm64
function
#
func disasm_arm64(code []byte, pc uint64, lookup lookupFunc, byteOrder binary.ByteOrder, gnuAsm bool) (string, int)
disasm_loong64
function
#
func disasm_loong64(code []byte, pc uint64, lookup lookupFunc, byteOrder binary.ByteOrder, gnuAsm bool) (string, int)
disasm_ppc64
function
#
func disasm_ppc64(code []byte, pc uint64, lookup lookupFunc, byteOrder binary.ByteOrder, gnuAsm bool) (string, int)
disasm_riscv64
function
#
func disasm_riscv64(code []byte, pc uint64, lookup lookupFunc, byteOrder binary.ByteOrder, gnuAsm bool) (string, int)
disasm_s390x
function
#
func disasm_s390x(code []byte, pc uint64, lookup lookupFunc, _ binary.ByteOrder, gnuAsm bool) (string, int)
disasm_x86
function
#
func disasm_x86(code []byte, pc uint64, lookup lookupFunc, arch int, gnuAsm bool) (string, int)
lookup
method
#
lookup finds the symbol name containing addr.
func (d *Disasm) lookup(addr uint64) (name string, base uint64)