thread Thread;
}
-func (c ThreadCreate) NewThread() Thread {
+func (c *ThreadCreate) NewThread() Thread {
return c.thread;
}
-func (c ThreadCreate) String() string {
+func (c *ThreadCreate) String() string {
return "thread create";
}
}
// Exited returns true if the thread exited normally.
-func (c ThreadExit) Exited() bool {
+func (c *ThreadExit) Exited() bool {
return c.exitStatus != -1;
}
// ExitStatus returns the exit status of the thread if it exited
// normally or -1 otherwise.
-func (c ThreadExit) ExitStatus() int {
+func (c *ThreadExit) ExitStatus() int {
return c.exitStatus;
}
// Signaled returns true if the thread was terminated by a signal.
-func (c ThreadExit) Signaled() bool {
+func (c *ThreadExit) Signaled() bool {
return c.exitStatus == -1;
}
// StopSignal returns the signal that terminated the thread, or "" if
// it was not terminated by a signal.
-func (c ThreadExit) StopSignal() string {
+func (c *ThreadExit) StopSignal() string {
return c.signal;
}
-func (c ThreadExit) String() string {
+func (c *ThreadExit) String() string {
res := "thread exited ";
switch {
case c.Exited():
// as well as experimentation and examination of gdb's behavior.
const (
- trace = true;
+ trace = false;
traceIP = false;
+ traceMem = false;
)
/*
func (t *thread) ptracePeekText(addr uintptr, out []byte) (int, os.Error) {
c, err := syscall.PtracePeekText(t.tid, addr, out);
+ if traceMem {
+ fmt.Printf("peek(%#x) => %v, %v\n", addr, out, err);
+ }
return c, os.NewSyscallError("ptrace(PEEKTEXT)", err);
}
func (t *thread) ptracePokeText(addr uintptr, out []byte) (int, os.Error) {
c, err := syscall.PtracePokeText(t.tid, addr, out);
+ if traceMem {
+ fmt.Printf("poke(%#x, %v) => %v\n", addr, out, err);
+ }
return c, os.NewSyscallError("ptrace(POKETEXT)", err);
}
c = Signal(sigName(t.signal));
case stoppedThreadCreate:
- c = ThreadCreate{t.newThread};
+ c = &ThreadCreate{t.newThread};
case stoppedExiting, exiting, exited:
if t.signal == -1 {
- c = ThreadExit{t.exitStatus, ""};
+ c = &ThreadExit{t.exitStatus, ""};
} else {
- c = ThreadExit{t.exitStatus, sigName(t.signal)};
+ c = &ThreadExit{t.exitStatus, sigName(t.signal)};
}
default: