addr2line

package module
v0.0.0-...-edf762f Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: MIT Imports: 6 Imported by: 0

README

Addr2line package implemented in golang

GNU addr2line과 동일한 기능을 하는 golang package입니다.

필요사항

addr2line package는 demangle 기능을 지원하기 위해서 ianlancetaylor/demangle package를 사용합니다. ianlancetaylor/demangle package를 먼저 설치해야 합니다.

go get -u github.com/ianlancetaylor/demangle

사용법

addr2line package는 쉽게 사용할 수 있습니다. package를 설치한 뒤에 import하고 GetAddr2LineEntry 함수만 호출하면 됩니다.

go get -u github.com/daludaluking/addr2line
import "github.com/daludaluking/addr2line"

e, err := addr2line.GetAddr2LineEntry(soFilePathWithDebugSymbols, address, true)
if err != nil {
	fmt.Println(err)
} else {
	//t.Logf("%v\n", e)
	fmt.Printf("library  : %s\n", e.SoPath)
	fmt.Printf("address  : 0x%xu\n", e.Address)
	fmt.Printf("function : %s\n", e.Func)
	fmt.Printf("file     : %s\n", e.File)
	fmt.Printf("line     : %d\n", e.Line)
}

보다 자세한 예제는 addr2line_test.go를 참고하세요.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr2LineEntry

type Addr2LineEntry struct {
	//Address in an executable or an offset in a section of a relocatable object
	Address uint

	//SoPath is the name of the library for which addresses should be translated
	SoPath string

	//Func is the name of function at Addr2LineEntry.Address in Addr2LineEntry.SoPath
	Func string

	//File is the name of the soure file
	//in which the Func is located in Addr2LineEntry.Address of Addr2LineEntry.SoPath library.
	File string

	//Line is the number of line in Addr2LineEntry.File at Address
	Line uint

	Inline bool
}

Addr2LineEntry represents debug information for a address in the debug symbol.

func GetAddr2LineEntry

func GetAddr2LineEntry(soPath string, address uint, doDemangle bool) (*Addr2LineEntry, error)

GetAddr2LineEntry function A returns a structure Addr2LineEntry with a function name and a file name line number at address in so file with a debug symbol.

Jump to

Keyboard shortcuts

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