This commit is contained in:
aarzilli 2016-01-24 17:30:23 +01:00
parent afe77160b0
commit 91743d9472
6 changed files with 9 additions and 11 deletions

@ -47,7 +47,7 @@ func (a *AMD64) SetGStructOffset(ver GoVersion, isextld bool) {
a.gStructOffset += 8 a.gStructOffset += 8
} }
case "windows": case "windows":
// Use ArbitraryUserPointer (0x28) as pointer to pointer // Use ArbitraryUserPointer (0x28) as pointer to pointer
// to G struct per: // to G struct per:
// https://golang.org/src/runtime/cgo/gcc_windows_amd64.c // https://golang.org/src/runtime/cgo/gcc_windows_amd64.c
a.gStructOffset = 0x28 a.gStructOffset = 0x28

@ -255,7 +255,6 @@ func (dbp *Process) ClearBreakpoint(addr uint64) (*Breakpoint, error) {
return bp, nil return bp, nil
} }
// Status returns the status of the current main thread context. // Status returns the status of the current main thread context.
func (dbp *Process) Status() *WaitStatus { func (dbp *Process) Status() *WaitStatus {
return dbp.CurrentThread.Status return dbp.CurrentThread.Status

@ -369,7 +369,6 @@ func (dbp *Process) wait(pid, options int) (int, *sys.WaitStatus, error) {
return wpid, &status, err return wpid, &status, err
} }
func killProcess(pid int) error { func killProcess(pid int) error {
return sys.Kill(pid, sys.SIGINT) return sys.Kill(pid, sys.SIGINT)
} }

@ -1,4 +1,4 @@
package proc package proc
// #include "threads_windows.h" // #include "threads_windows.h"
import "C" import "C"

@ -17,11 +17,11 @@ import (
// a whole, and Status represents the last result of a `wait` call // a whole, and Status represents the last result of a `wait` call
// on this thread. // on this thread.
type Thread struct { type Thread struct {
ID int // Thread ID or mach port ID int // Thread ID or mach port
Status *WaitStatus // Status returned from last wait call Status *WaitStatus // Status returned from last wait call
CurrentBreakpoint *Breakpoint // Breakpoint thread is currently stopped at CurrentBreakpoint *Breakpoint // Breakpoint thread is currently stopped at
BreakpointConditionMet bool // Output of evaluating the breakpoint's condition BreakpointConditionMet bool // Output of evaluating the breakpoint's condition
BreakpointConditionError error // Error evaluating the breakpoint's condition BreakpointConditionError error // Error evaluating the breakpoint's condition
dbp *Process dbp *Process
singleStepping bool singleStepping bool
@ -267,8 +267,8 @@ func (thread *Thread) getGVariable() (*Variable, error) {
return nil, err return nil, err
} }
gaddr := uintptr(binary.LittleEndian.Uint64(gaddrbs)) gaddr := uintptr(binary.LittleEndian.Uint64(gaddrbs))
// On Windows, the value at TLS()+GStructOffset() is a // On Windows, the value at TLS()+GStructOffset() is a
// pointer to the G struct. // pointer to the G struct.
needsDeref := runtime.GOOS == "windows" needsDeref := runtime.GOOS == "windows"

@ -5,8 +5,8 @@ package proc
import "C" import "C"
import ( import (
"fmt" "fmt"
"unsafe"
sys "golang.org/x/sys/unix" sys "golang.org/x/sys/unix"
"unsafe"
) )
// WaitStatus is a synonym for the platform-specific WaitStatus // WaitStatus is a synonym for the platform-specific WaitStatus