delve/pkg/proc/native/nonative_darwin.go
Alessandro Arzilli 7f094c81e9
proc: refactorings to implement follow-exec mode on Windows (#3441)
Miscellaneous non-functional changes to prepare for adding support for
follow-exec mode on Windows:

- removed (*nativeProcess).wait function from Windows backend (unused).
- move close of ptraceDoneChan from release to handlePtraceFuncs, this
  makes postExit callable by a function executed by execPtraceFunc.
- change addTarget to detach before creating the target object if we
  don't actually want to attach to the child process, also moved the
  detach call to (*processGroup).add instead of having one in addTarget
  and one in the code that calls (*processGroup).add.
- changed Detach to be a method of TargetGroup/ProcessGroup, the
  Windows backend will need access to the process group to call
  WaitForDebugEvent.
- moved resume method to processGroup. First all threads stopped at a
  breakpoint need to be stepped, then all other threads can be resumed.
  This is true also for linux even though it didn't cause the current
  tests to fail.
2023-08-28 12:46:19 -07:00

150 lines
4.0 KiB
Go

//go:build darwin && !macnative
// +build darwin,!macnative
package native
import (
"errors"
"sync"
"github.com/go-delve/delve/pkg/dwarf/op"
"github.com/go-delve/delve/pkg/proc"
"github.com/go-delve/delve/pkg/proc/amd64util"
"github.com/go-delve/delve/pkg/proc/internal/ebpf"
)
var ErrNativeBackendDisabled = errors.New("native backend disabled during compilation")
// Launch returns ErrNativeBackendDisabled.
func Launch(_ []string, _ string, _ proc.LaunchFlags, _ []string, _ string, _ string, _ proc.OutputRedirect, _ proc.OutputRedirect) (*proc.TargetGroup, error) {
return nil, ErrNativeBackendDisabled
}
// Attach returns ErrNativeBackendDisabled.
func Attach(_ int, _ *proc.WaitFor, _ []string) (*proc.TargetGroup, error) {
return nil, ErrNativeBackendDisabled
}
func waitForSearchProcess(string, map[int]struct{}) (int, error) {
return 0, proc.ErrWaitForNotImplemented
}
// waitStatus is a synonym for the platform-specific WaitStatus
type waitStatus struct{}
// osSpecificDetails holds information specific to the OSX/Darwin
// operating system / kernel.
type osSpecificDetails struct{}
// osProcessDetails holds Darwin specific information.
type osProcessDetails struct{}
func (os *osProcessDetails) Close() {}
func killProcess(pid int) error {
panic(ErrNativeBackendDisabled)
}
func registers(thread *nativeThread) (proc.Registers, error) {
panic(ErrNativeBackendDisabled)
}
func (dbp *nativeProcess) loadProcessInformation(wg *sync.WaitGroup) {
panic(ErrNativeBackendDisabled)
}
func (dbp *nativeProcess) requestManualStop() (err error) {
panic(ErrNativeBackendDisabled)
}
func (*processGroup) resume() error {
panic(ErrNativeBackendDisabled)
}
func trapWait(procgrp *processGroup, pid int) (*nativeThread, error) {
panic(ErrNativeBackendDisabled)
}
func (*processGroup) stop(cctx *proc.ContinueOnceContext, trapthread *nativeThread) (*nativeThread, error) {
panic(ErrNativeBackendDisabled)
}
func (dbp *nativeProcess) updateThreadList() error {
panic(ErrNativeBackendDisabled)
}
func (*processGroup) kill(dbp *nativeProcess) (err error) {
panic(ErrNativeBackendDisabled)
}
func (dbp *nativeProcess) detach(kill bool) error {
panic(ErrNativeBackendDisabled)
}
// EntryPoint returns the entry point for the process,
// useful for PIEs.
func (dbp *nativeProcess) EntryPoint() (uint64, error) {
panic(ErrNativeBackendDisabled)
}
func (dbp *nativeProcess) SupportsBPF() bool {
panic(ErrNativeBackendDisabled)
}
func (dbp *nativeProcess) SetUProbe(fnName string, goidOffset int64, args []ebpf.UProbeArgMap) error {
panic(ErrNativeBackendDisabled)
}
func (dbp *nativeProcess) GetBufferedTracepoints() []ebpf.RawUProbeParams {
panic(ErrNativeBackendDisabled)
}
// SetPC sets the value of the PC register.
func (t *nativeThread) setPC(pc uint64) error {
panic(ErrNativeBackendDisabled)
}
// SetReg changes the value of the specified register.
func (thread *nativeThread) SetReg(regNum uint64, reg *op.DwarfRegister) error {
panic(ErrNativeBackendDisabled)
}
// ReadMemory reads len(buf) bytes at addr into buf.
func (t *nativeThread) ReadMemory(buf []byte, addr uint64) (int, error) {
panic(ErrNativeBackendDisabled)
}
// WriteMemory writes the contents of data at addr.
func (t *nativeThread) WriteMemory(addr uint64, data []byte) (int, error) {
panic(ErrNativeBackendDisabled)
}
func (t *nativeThread) resume() error {
panic(ErrNativeBackendDisabled)
}
func (t *nativeThread) singleStep() error {
panic(ErrNativeBackendDisabled)
}
func (t *nativeThread) restoreRegisters(sr proc.Registers) error {
panic(ErrNativeBackendDisabled)
}
func (t *nativeThread) withDebugRegisters(f func(*amd64util.DebugRegisters) error) error {
return proc.ErrHWBreakUnsupported
}
// Stopped returns whether the thread is stopped at
// the operating system level.
func (t *nativeThread) Stopped() bool {
panic(ErrNativeBackendDisabled)
}
// SoftExc returns true if this thread received a software exception during the last resume.
func (t *nativeThread) SoftExc() bool {
panic(ErrNativeBackendDisabled)
}
func initialize(dbp *nativeProcess) (string, error) { return "", nil }