Skip to content

Commit

Permalink
Make it actually compile
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Apr 18, 2021
1 parent 3433286 commit 933e539
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Documentation/usage/dlv_backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Help about the --backend flag.
The --backend flag specifies which backend should be used, possible values
are:

default Uses lldb on macOS (amd64), native everywhere else.
default Uses lldb on macOS, native everywhere else.
native Native backend.
lldb Uses lldb-server or debugserver.
rr Uses mozilla rr (https://github.com/mozilla/rr).
Expand Down
2 changes: 1 addition & 1 deletion _scripts/make.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func installedExecutablePath() string {
// i.e. cgo enabled and the legacy SDK headers:
// https://forums.developer.apple.com/thread/104296
func canMacnative() bool {
if !(runtime.GOOS == "darwin" && runtime.GOARCH == "amd64") {
if !(runtime.GOOS == "darwin") {
return false
}
if strings.TrimSpace(getoutput("go", "env", "CGO_ENABLED")) != "1" {
Expand Down
12 changes: 11 additions & 1 deletion pkg/proc/native/registers_darwin_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"errors"
"fmt"

"github.com/go-delve/delve/pkg/dwarf/op"
"github.com/go-delve/delve/pkg/dwarf/regnum"
"github.com/go-delve/delve/pkg/proc"
"golang.org/x/arch/arm64/arm64asm"
)
Expand Down Expand Up @@ -134,14 +136,22 @@ func (r *Regs) GAddr() (uint64, bool) {
}

// SetPC sets the RIP register to the value specified by `pc`.
func (thread *nativeThread) SetPC(pc uint64) error {
func (thread *nativeThread) setPC(pc uint64) error {
kret := C.set_pc(thread.os.threadAct, C.uint64_t(pc))
if kret != C.KERN_SUCCESS {
return fmt.Errorf("could not set pc")
}
return nil
}

// SetReg changes the value of the specified register.
func (thread *nativeThread) SetReg(regNum uint64, reg *op.DwarfRegister) error {
if regNum != regnum.ARM64_PC {
return fmt.Errorf("changing register %d not implemented", regNum)
}
return thread.setPC(reg.Uint64Val)
}

// SetSP sets the RSP register to the value specified by `pc`.
func (thread *nativeThread) SetSP(sp uint64) error {
return errors.New("not implemented")
Expand Down

0 comments on commit 933e539

Please sign in to comment.