diff options
Diffstat (limited to 'src/pkg/debug/gosym/pclntab.go')
| -rw-r--r-- | src/pkg/debug/gosym/pclntab.go | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/pkg/debug/gosym/pclntab.go b/src/pkg/debug/gosym/pclntab.go index 6c6a18868..9d7b0d15f 100644 --- a/src/pkg/debug/gosym/pclntab.go +++ b/src/pkg/debug/gosym/pclntab.go @@ -11,9 +11,9 @@ package gosym import "encoding/binary" type LineTable struct { - Data []byte; - PC uint64; - Line int; + Data []byte + PC uint64 + Line int } // TODO(rsc): Need to pull in quantum from architecture definition. @@ -28,49 +28,49 @@ func (t *LineTable) parse(targetPC uint64, targetLine int) (b []byte, pc uint64, // // Here we process each update individually, which simplifies // the code, but makes the corner cases more confusing. - b, pc, line = t.Data, t.PC, t.Line; + b, pc, line = t.Data, t.PC, t.Line for pc <= targetPC && line != targetLine && len(b) > 0 { - code := b[0]; - b = b[1:]; + code := b[0] + b = b[1:] switch { case code == 0: if len(b) < 4 { - b = b[0:0]; - break; + b = b[0:0] + break } - val := binary.BigEndian.Uint32(b); - b = b[4:]; - line += int(val); + val := binary.BigEndian.Uint32(b) + b = b[4:] + line += int(val) case code <= 64: line += int(code) case code <= 128: line -= int(code - 64) default: - pc += quantum * uint64(code-128); - continue; + pc += quantum * uint64(code-128) + continue } - pc += quantum; + pc += quantum } - return b, pc, line; + return b, pc, line } func (t *LineTable) slice(pc uint64) *LineTable { - data, pc, line := t.parse(pc, -1); - return &LineTable{data, pc, line}; + data, pc, line := t.parse(pc, -1) + return &LineTable{data, pc, line} } func (t *LineTable) PCToLine(pc uint64) int { - _, _, line := t.parse(pc, -1); - return line; + _, _, line := t.parse(pc, -1) + return line } func (t *LineTable) LineToPC(line int, maxpc uint64) uint64 { - _, pc, line1 := t.parse(maxpc, line); + _, pc, line1 := t.parse(maxpc, line) if line1 != line { return 0 } // Subtract quantum from PC to account for post-line increment - return pc - quantum; + return pc - quantum } // NewLineTable returns a new PC/line table |
