diff options
| author | Keith Randall <khr@golang.org> | 2016-07-02 17:19:25 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2016-08-24 17:36:59 +0000 |
| commit | a99f812cba4c5a5207fed9be5488312a44a5df34 (patch) | |
| tree | d529f4e86495db40844a6640477deefea4f7c349 /src/debug | |
| parent | 873dca4c17437d07ae97ef4f9e9a8e8c93d88bd7 (diff) | |
| download | go-a99f812cba4c5a5207fed9be5488312a44a5df34.tar.xz | |
cmd/objdump: implement objdump of .o files
Update goobj reader so it can provide all the information
necessary to disassemble .o (and .a) files.
Grab architecture of .o files from header.
.o files have relocations in them. This CL also contains a simple
mechanism to disassemble relocations and add relocation info as an extra
column in the output.
Fixes #13862
Change-Id: I608fd253ff1522ea47f18be650b38d528dae9054
Reviewed-on: https://go-review.googlesource.com/24818
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/debug')
| -rw-r--r-- | src/debug/gosym/pclntab.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/debug/gosym/pclntab.go b/src/debug/gosym/pclntab.go index e859d5aed5..e94ed19d7d 100644 --- a/src/debug/gosym/pclntab.go +++ b/src/debug/gosym/pclntab.go @@ -291,13 +291,17 @@ func (t *LineTable) step(p *[]byte, pc *uint64, val *int32, first bool) bool { return true } +// PCValue looks up the given PC in a pc value table. target is the +// offset of the pc from the entry point. +func PCValue(tab []byte, target uint64, quantum int) int { + t := LineTable{Data: tab, quantum: uint32(quantum)} + return int(t.pcvalue(0, 0, target)) +} + // pcvalue reports the value associated with the target pc. // off is the offset to the beginning of the pc-value table, // and entry is the start PC for the corresponding function. func (t *LineTable) pcvalue(off uint32, entry, targetpc uint64) int32 { - if off == 0 { - return -1 - } p := t.Data[off:] val := int32(-1) |
