Move LockOSThread into init

This commit is contained in:
Derek Parker 2014-11-23 10:22:04 -06:00
parent 8be3ffc774
commit 5254c5188e

@ -25,12 +25,14 @@ type term struct {
const historyFile string = ".dbg_history"
func main() {
func init() {
// We must ensure here that we are running on the same thread during
// the execution of dbg. This is due to the fact that ptrace(2) expects
// all commands after PTRACE_ATTACH to come from the same thread.
runtime.LockOSThread()
}
func main() {
var (
pid int
run bool