summaryrefslogtreecommitdiff
path: root/devdocs/go/debug%2Fgosym%2Findex.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/go/debug%2Fgosym%2Findex.html
new repository
Diffstat (limited to 'devdocs/go/debug%2Fgosym%2Findex.html')
-rw-r--r--devdocs/go/debug%2Fgosym%2Findex.html133
1 files changed, 133 insertions, 0 deletions
diff --git a/devdocs/go/debug%2Fgosym%2Findex.html b/devdocs/go/debug%2Fgosym%2Findex.html
new file mode 100644
index 00000000..3b5510a0
--- /dev/null
+++ b/devdocs/go/debug%2Fgosym%2Findex.html
@@ -0,0 +1,133 @@
+<h1> Package gosym </h1> <ul id="short-nav">
+<li><code>import "debug/gosym"</code></li>
+<li><a href="#pkg-overview" class="overviewLink">Overview</a></li>
+<li><a href="#pkg-index" class="indexLink">Index</a></li>
+</ul> <h2 id="pkg-overview">Overview </h2> <p>Package gosym implements access to the Go symbol and line number tables embedded in Go binaries generated by the gc compilers. </p> <h2 id="pkg-index">Index </h2> <ul id="manual-nav">
+<li><a href="#DecodingError">type DecodingError</a></li>
+<li> <a href="#DecodingError.Error">func (e *DecodingError) Error() string</a>
+</li>
+<li><a href="#Func">type Func</a></li>
+<li><a href="#LineTable">type LineTable</a></li>
+<li> <a href="#NewLineTable">func NewLineTable(data []byte, text uint64) *LineTable</a>
+</li>
+<li> <a href="#LineTable.LineToPC">func (t *LineTable) LineToPC(line int, maxpc uint64) uint64</a>
+</li>
+<li> <a href="#LineTable.PCToLine">func (t *LineTable) PCToLine(pc uint64) int</a>
+</li>
+<li><a href="#Obj">type Obj</a></li>
+<li><a href="#Sym">type Sym</a></li>
+<li> <a href="#Sym.BaseName">func (s *Sym) BaseName() string</a>
+</li>
+<li> <a href="#Sym.PackageName">func (s *Sym) PackageName() string</a>
+</li>
+<li> <a href="#Sym.ReceiverName">func (s *Sym) ReceiverName() string</a>
+</li>
+<li> <a href="#Sym.Static">func (s *Sym) Static() bool</a>
+</li>
+<li><a href="#Table">type Table</a></li>
+<li> <a href="#NewTable">func NewTable(symtab []byte, pcln *LineTable) (*Table, error)</a>
+</li>
+<li> <a href="#Table.LineToPC">func (t *Table) LineToPC(file string, line int) (pc uint64, fn *Func, err error)</a>
+</li>
+<li> <a href="#Table.LookupFunc">func (t *Table) LookupFunc(name string) *Func</a>
+</li>
+<li> <a href="#Table.LookupSym">func (t *Table) LookupSym(name string) *Sym</a>
+</li>
+<li> <a href="#Table.PCToFunc">func (t *Table) PCToFunc(pc uint64) *Func</a>
+</li>
+<li> <a href="#Table.PCToLine">func (t *Table) PCToLine(pc uint64) (file string, line int, fn *Func)</a>
+</li>
+<li> <a href="#Table.SymByAddr">func (t *Table) SymByAddr(addr uint64) *Sym</a>
+</li>
+<li><a href="#UnknownFileError">type UnknownFileError</a></li>
+<li> <a href="#UnknownFileError.Error">func (e UnknownFileError) Error() string</a>
+</li>
+<li><a href="#UnknownLineError">type UnknownLineError</a></li>
+<li> <a href="#UnknownLineError.Error">func (e *UnknownLineError) Error() string</a>
+</li>
+</ul> <h3>Package files</h3> <p> <span>pclntab.go</span> <span>symtab.go</span> </p> <h2 id="DecodingError">type <span>DecodingError</span> </h2> <p>DecodingError represents an error during the decoding of the symbol table. </p>
+<pre data-language="go">type DecodingError struct {
+ // contains filtered or unexported fields
+}
+</pre> <h3 id="DecodingError.Error">func (*DecodingError) <span>Error</span> </h3> <pre data-language="go">func (e *DecodingError) Error() string</pre> <h2 id="Func">type <span>Func</span> </h2> <p>A Func collects information about a single function. </p>
+<pre data-language="go">type Func struct {
+ Entry uint64
+ *Sym
+ End uint64
+ Params []*Sym // nil for Go 1.3 and later binaries
+ Locals []*Sym // nil for Go 1.3 and later binaries
+ FrameSize int
+ LineTable *LineTable
+ Obj *Obj
+}
+</pre> <h2 id="LineTable">type <span>LineTable</span> </h2> <p>A LineTable is a data structure mapping program counters to line numbers. </p>
+<p>In Go 1.1 and earlier, each function (represented by a <a href="#Func">Func</a>) had its own LineTable, and the line number corresponded to a numbering of all source lines in the program, across all files. That absolute line number would then have to be converted separately to a file name and line number within the file. </p>
+<p>In Go 1.2, the format of the data changed so that there is a single LineTable for the entire program, shared by all Funcs, and there are no absolute line numbers, just line numbers within specific files. </p>
+<p>For the most part, LineTable's methods should be treated as an internal detail of the package; callers should use the methods on <a href="#Table">Table</a> instead. </p>
+<pre data-language="go">type LineTable struct {
+ Data []byte
+ PC uint64
+ Line int
+ // contains filtered or unexported fields
+}
+</pre> <h3 id="NewLineTable">func <span>NewLineTable</span> </h3> <pre data-language="go">func NewLineTable(data []byte, text uint64) *LineTable</pre> <p>NewLineTable returns a new PC/line table corresponding to the encoded data. Text must be the start address of the corresponding text segment. </p>
+<h3 id="LineTable.LineToPC">func (*LineTable) <span>LineToPC</span> </h3> <pre data-language="go">func (t *LineTable) LineToPC(line int, maxpc uint64) uint64</pre> <p>LineToPC returns the program counter for the given line number, considering only program counters before maxpc. </p>
+<p>Deprecated: Use Table's LineToPC method instead. </p>
+<h3 id="LineTable.PCToLine">func (*LineTable) <span>PCToLine</span> </h3> <pre data-language="go">func (t *LineTable) PCToLine(pc uint64) int</pre> <p>PCToLine returns the line number for the given program counter. </p>
+<p>Deprecated: Use Table's PCToLine method instead. </p>
+<h2 id="Obj">type <span>Obj</span> </h2> <p>An Obj represents a collection of functions in a symbol table. </p>
+<p>The exact method of division of a binary into separate Objs is an internal detail of the symbol table format. </p>
+<p>In early versions of Go each source file became a different Obj. </p>
+<p>In Go 1 and Go 1.1, each package produced one Obj for all Go sources and one Obj per C source file. </p>
+<p>In Go 1.2, there is a single Obj for the entire program. </p>
+<pre data-language="go">type Obj struct {
+ // Funcs is a list of functions in the Obj.
+ Funcs []Func
+
+ // In Go 1.1 and earlier, Paths is a list of symbols corresponding
+ // to the source file names that produced the Obj.
+ // In Go 1.2, Paths is nil.
+ // Use the keys of Table.Files to obtain a list of source files.
+ Paths []Sym // meta
+}
+</pre> <h2 id="Sym">type <span>Sym</span> </h2> <p>A Sym represents a single symbol table entry. </p>
+<pre data-language="go">type Sym struct {
+ Value uint64
+ Type byte
+ Name string
+ GoType uint64
+ // If this symbol is a function symbol, the corresponding Func
+ Func *Func
+ // contains filtered or unexported fields
+}
+</pre> <h3 id="Sym.BaseName">func (*Sym) <span>BaseName</span> </h3> <pre data-language="go">func (s *Sym) BaseName() string</pre> <p>BaseName returns the symbol name without the package or receiver name. </p>
+<h3 id="Sym.PackageName">func (*Sym) <span>PackageName</span> </h3> <pre data-language="go">func (s *Sym) PackageName() string</pre> <p>PackageName returns the package part of the symbol name, or the empty string if there is none. </p>
+<h3 id="Sym.ReceiverName">func (*Sym) <span>ReceiverName</span> </h3> <pre data-language="go">func (s *Sym) ReceiverName() string</pre> <p>ReceiverName returns the receiver type name of this symbol, or the empty string if there is none. A receiver name is only detected in the case that s.Name is fully-specified with a package name. </p>
+<h3 id="Sym.Static">func (*Sym) <span>Static</span> </h3> <pre data-language="go">func (s *Sym) Static() bool</pre> <p>Static reports whether this symbol is static (not visible outside its file). </p>
+<h2 id="Table">type <span>Table</span> </h2> <p>Table represents a Go symbol table. It stores all of the symbols decoded from the program and provides methods to translate between symbols, names, and addresses. </p>
+<pre data-language="go">type Table struct {
+ Syms []Sym // nil for Go 1.3 and later binaries
+ Funcs []Func
+ Files map[string]*Obj // for Go 1.2 and later all files map to one Obj
+ Objs []Obj // for Go 1.2 and later only one Obj in slice
+ // contains filtered or unexported fields
+}
+</pre> <h3 id="NewTable">func <span>NewTable</span> </h3> <pre data-language="go">func NewTable(symtab []byte, pcln *LineTable) (*Table, error)</pre> <p>NewTable decodes the Go symbol table (the ".gosymtab" section in ELF), returning an in-memory representation. Starting with Go 1.3, the Go symbol table no longer includes symbol data. </p>
+<h3 id="Table.LineToPC">func (*Table) <span>LineToPC</span> </h3> <pre data-language="go">func (t *Table) LineToPC(file string, line int) (pc uint64, fn *Func, err error)</pre> <p>LineToPC looks up the first program counter on the given line in the named file. It returns <a href="#UnknownFileError">UnknownFileError</a> or <a href="#UnknownLineError">UnknownLineError</a> if there is an error looking up this line. </p>
+<h3 id="Table.LookupFunc">func (*Table) <span>LookupFunc</span> </h3> <pre data-language="go">func (t *Table) LookupFunc(name string) *Func</pre> <p>LookupFunc returns the text, data, or bss symbol with the given name, or nil if no such symbol is found. </p>
+<h3 id="Table.LookupSym">func (*Table) <span>LookupSym</span> </h3> <pre data-language="go">func (t *Table) LookupSym(name string) *Sym</pre> <p>LookupSym returns the text, data, or bss symbol with the given name, or nil if no such symbol is found. </p>
+<h3 id="Table.PCToFunc">func (*Table) <span>PCToFunc</span> </h3> <pre data-language="go">func (t *Table) PCToFunc(pc uint64) *Func</pre> <p>PCToFunc returns the function containing the program counter pc, or nil if there is no such function. </p>
+<h3 id="Table.PCToLine">func (*Table) <span>PCToLine</span> </h3> <pre data-language="go">func (t *Table) PCToLine(pc uint64) (file string, line int, fn *Func)</pre> <p>PCToLine looks up line number information for a program counter. If there is no information, it returns fn == nil. </p>
+<h3 id="Table.SymByAddr">func (*Table) <span>SymByAddr</span> </h3> <pre data-language="go">func (t *Table) SymByAddr(addr uint64) *Sym</pre> <p>SymByAddr returns the text, data, or bss symbol starting at the given address. </p>
+<h2 id="UnknownFileError">type <span>UnknownFileError</span> </h2> <p>UnknownFileError represents a failure to find the specific file in the symbol table. </p>
+<pre data-language="go">type UnknownFileError string</pre> <h3 id="UnknownFileError.Error">func (UnknownFileError) <span>Error</span> </h3> <pre data-language="go">func (e UnknownFileError) Error() string</pre> <h2 id="UnknownLineError">type <span>UnknownLineError</span> </h2> <p>UnknownLineError represents a failure to map a line to a program counter, either because the line is beyond the bounds of the file or because there is no code on the given line. </p>
+<pre data-language="go">type UnknownLineError struct {
+ File string
+ Line int
+}
+</pre> <h3 id="UnknownLineError.Error">func (*UnknownLineError) <span>Error</span> </h3> <pre data-language="go">func (e *UnknownLineError) Error() string</pre><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br>
+ <a href="http://golang.org/pkg/debug/gosym/" class="_attribution-link">http://golang.org/pkg/debug/gosym/</a>
+ </p>
+</div>