Skip to content

Commit

Permalink
Fix breakpoint instruction and remove patch
Browse files Browse the repository at this point in the history
This can only be use with a patched Go version with the correct breakpoint instruction.
  • Loading branch information
alexsaezm committed Jun 3, 2022
1 parent 46de2b4 commit 0a79c04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions pkg/proc/native/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ func (dbp *nativeProcess) initialize(path string, debugInfoDirs []string) (*proc
if err != nil {
return nil, err
}
// TODO(alexsaezm) Verify if I need to run IsCgo for ppc64le too
if dbp.bi.Arch.Name == "arm64" {
if dbp.bi.Arch.Name == "arm64" || dbp.bi.Arch.Name == "ppc64le" {
dbp.iscgo = tgt.IsCgo()
}
return tgt, nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/proc/native/proc_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ func (dbp *nativeProcess) trapWaitInternal(pid int, options trapWaitOptions) (*n
// Sometimes we get an unknown thread, ignore it?
continue
}
if (halt && status.StopSignal() == sys.SIGSTOP) || (status.StopSignal() == sys.SIGTRAP) || (status.StopSignal() == sys.SIGSEGV) {
if (halt && status.StopSignal() == sys.SIGSTOP) || (status.StopSignal() == sys.SIGTRAP) {
th.os.running = false
if status.StopSignal() == sys.SIGTRAP || status.StopSignal() == sys.SIGSEGV {
if status.StopSignal() == sys.SIGTRAP {
th.os.setbp = true
}
return th, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/proc/ppc64le_arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/go-delve/delve/pkg/dwarf/regnum"
)

//var ppc64leBreakInstruction = []byte{0xfc, 0x00, 0x07, 0xfe}

var ppc64leBreakInstruction = []byte{0x0, 0x0, 0x20, 0xd4} // TODO(alexsaezm) Verify if this is the correct break instruction
// This is the unconditional trap, the same mnemonic that both clang and gcc use
// It's documented in Section C.6 Trap Mnemonics in the Power ISA Book 3
var ppc64leBreakInstruction = []byte{0x08, 0x00, 0xe0, 0x7d}

func PPC64LEArch(goos string) *Arch {
return &Arch{
Expand Down

0 comments on commit 0a79c04

Please sign in to comment.