Skip to content

Commit

Permalink
*: Change comments to match common Go standarts (go-delve#3221)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored Dec 14, 2022
1 parent 753cb4c commit 9523849
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions pkg/dwarf/util/buf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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++ {
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pkg/locspec/locations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/proc/arm64_arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/proc/arm64_disasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/proc/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/proc/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/proc/linutil/doc.go
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions pkg/proc/linutil/regs_arm64_arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/proc/proc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion pkg/proc/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9523849

Please sign in to comment.