diff --git a/pkg/dwarf/util/buf.go b/pkg/dwarf/util/buf.go index 12899f8a..ddb97958 100644 --- a/pkg/dwarf/util/buf.go +++ b/pkg/dwarf/util/buf.go @@ -36,7 +36,7 @@ type dataFormat interface { addrsize() int } -// Some parts of DWARF have no data format, e.g., abbrevs. +// UnknownFormat is a struct for some parts of DWARF that have no data format, e.g., abbrevs. type UnknownFormat struct{} func (u UnknownFormat) version() int { @@ -66,7 +66,7 @@ func (b *buf) Uint8() uint8 { return val } -// Read a varint, which is 7 bits per byte, little endian. +// Varint reads a varint, which is 7 bits per byte, little endian. // the 0x80 bit means read another byte. func (b *buf) Varint() (c uint64, bits uint) { for i := 0; i < len(b.data); i++ { @@ -82,13 +82,13 @@ func (b *buf) Varint() (c uint64, bits uint) { return 0, 0 } -// Unsigned int is just a varint. +// Uint is just a varint. func (b *buf) Uint() uint64 { x, _ := b.Varint() return x } -// Signed int is a sign-extended varint. +// Int is a sign-extended varint. func (b *buf) Int() int64 { ux, bits := b.Varint() x := int64(ux) diff --git a/pkg/locspec/locations.go b/pkg/locspec/locations.go index b3c6710f..fd01f4a2 100644 --- a/pkg/locspec/locations.go +++ b/pkg/locspec/locations.go @@ -491,8 +491,8 @@ func SubstitutePath(path string, rules [][2]string) string { // On windows paths returned from headless server are as c:/dir/dir // though os.PathSeparator is '\\' - separator := "/" //make it default - if strings.Contains(path, "\\") { //dependent on the path + separator := "/" // make it default + if strings.Contains(path, "\\") { // dependent on the path separator = "\\" } for _, r := range rules { diff --git a/pkg/proc/arm64_arch.go b/pkg/proc/arm64_arch.go index 580539ff..01272e69 100644 --- a/pkg/proc/arm64_arch.go +++ b/pkg/proc/arm64_arch.go @@ -223,7 +223,7 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool it.atend = true return true case "crosscall2": - //The offsets get from runtime/cgo/asm_arm64.s:10 + // The offsets get from runtime/cgo/asm_arm64.s:10 bpoff := uint64(14) lroff := uint64(15) if producer := it.bi.Producer(); producer != "" && goversion.ProducerAfterOrEqual(producer, 1, 19) { diff --git a/pkg/proc/arm64_disasm.go b/pkg/proc/arm64_disasm.go index bd918f4a..517c9a25 100644 --- a/pkg/proc/arm64_disasm.go +++ b/pkg/proc/arm64_disasm.go @@ -43,7 +43,7 @@ func arm64AsmDecode(asmInst *AsmInstruction, mem []byte, regs *op.DwarfRegisters func resolveCallArgARM64(inst *arm64asm.Inst, instAddr uint64, currentGoroutine bool, regs *op.DwarfRegisters, mem MemoryReadWriter, bininfo *BinaryInfo) *Location { switch inst.Op { case arm64asm.BL, arm64asm.BLR, arm64asm.B, arm64asm.BR: - //ok + // ok default: return nil } diff --git a/pkg/proc/core/core.go b/pkg/proc/core/core.go index 561b0096..148d3405 100644 --- a/pkg/proc/core/core.go +++ b/pkg/proc/core/core.go @@ -396,7 +396,7 @@ func (t *thread) SetDX(uint64) error { return ErrChangeRegisterCore } -// ChangeRegs will always return an error, you cannot +// SetReg will always return an error, you cannot // change register values when debugging core files. func (t *thread) SetReg(regNum uint64, reg *op.DwarfRegister) error { return ErrChangeRegisterCore diff --git a/pkg/proc/interface.go b/pkg/proc/interface.go index 2f845211..4027b40e 100644 --- a/pkg/proc/interface.go +++ b/pkg/proc/interface.go @@ -64,7 +64,7 @@ type RecordingManipulation interface { // Recorded returns true if the current process is a recording and the path // to the trace directory. Recorded() (recorded bool, tracedir string) - // Direction changes execution direction. + // ChangeDirection changes execution direction. ChangeDirection(Direction) error // GetDirection returns the current direction of execution. GetDirection() Direction diff --git a/pkg/proc/linutil/doc.go b/pkg/proc/linutil/doc.go index c126c672..b4bea589 100644 --- a/pkg/proc/linutil/doc.go +++ b/pkg/proc/linutil/doc.go @@ -1,4 +1,4 @@ -// This package contains functions and data structures used by both the +// Package linutil contains functions and data structures used by both the // linux implementation of the native backend and the core backend to deal // with structures used by the linux kernel. package linutil diff --git a/pkg/proc/linutil/regs_arm64_arch.go b/pkg/proc/linutil/regs_arm64_arch.go index 5e9243a9..05fb48e9 100644 --- a/pkg/proc/linutil/regs_arm64_arch.go +++ b/pkg/proc/linutil/regs_arm64_arch.go @@ -10,11 +10,11 @@ import ( // ARM64Registers is a wrapper for sys.PtraceRegs. type ARM64Registers struct { - Regs *ARM64PtraceRegs //general-purpose registers + Regs *ARM64PtraceRegs // general-purpose registers iscgo bool tpidr_el0 uint64 - Fpregs []proc.Register //Formatted floating point registers - Fpregset []byte //holding all floating point register values + Fpregs []proc.Register // Formatted floating point registers + Fpregset []byte // holding all floating point register values loadFpRegs func(*ARM64Registers) error } diff --git a/pkg/proc/proc_test.go b/pkg/proc/proc_test.go index 02d8d833..2af4e672 100644 --- a/pkg/proc/proc_test.go +++ b/pkg/proc/proc_test.go @@ -1047,7 +1047,7 @@ func TestKill(t *testing.T) { } if runtime.GOOS == "linux" { if runtime.GOARCH == "arm64" { - //there is no any sync between signal sended(tracee handled) and open /proc/%d/. It may fail on arm64 + // there is no any sync between signal sended(tracee handled) and open /proc/%d/. It may fail on arm64 return } _, err := os.Open(fmt.Sprintf("/proc/%d/", p.Pid())) @@ -4693,7 +4693,7 @@ func TestPluginStepping(t *testing.T) { func TestIssue1601(t *testing.T) { protest.MustHaveCgo(t) - //Tests that recursive types involving C qualifiers and typedefs are parsed correctly + // Tests that recursive types involving C qualifiers and typedefs are parsed correctly withTestProcess("issue1601", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue") evalVariable(p, t, "C.globalq") diff --git a/pkg/proc/variables.go b/pkg/proc/variables.go index 7d063e95..45b946bc 100644 --- a/pkg/proc/variables.go +++ b/pkg/proc/variables.go @@ -81,7 +81,7 @@ const ( // the variable is the return value of a function call and allocated on a // frame that no longer exists) VariableFakeAddress - // VariableCPrt means the variable is a C pointer + // VariableCPtr means the variable is a C pointer VariableCPtr // VariableCPURegister means this variable is a CPU register. VariableCPURegister