LEFT | RIGHT |
1 // Copyright 2014 The Go Authors. All rights reserved. | 1 // Copyright 2014 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Package server provides RPC access to a local program being debugged. | 5 // Package server provides RPC access to a local program being debugged. |
6 // It is the remote end of the client implementation of the Program interface. | 6 // It is the remote end of the client implementation of the Program interface. |
7 package server | 7 package server |
8 | 8 |
9 import ( | 9 import ( |
10 "bytes" | 10 "bytes" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 324 } |
325 | 325 |
326 for { | 326 for { |
327 if err := s.setBreakpoints(); err != nil { | 327 if err := s.setBreakpoints(); err != nil { |
328 return err | 328 return err |
329 } | 329 } |
330 if err := s.ptraceCont(s.stoppedPid, 0); err != nil { | 330 if err := s.ptraceCont(s.stoppedPid, 0); err != nil { |
331 return fmt.Errorf("ptraceCont: %v", err) | 331 return fmt.Errorf("ptraceCont: %v", err) |
332 } | 332 } |
333 | 333 |
334 » » stoppedPid, err := s.waitForTrap(-1, true) | 334 » » wpid, err := s.waitForTrap(-1, true) |
335 if err == nil { | 335 if err == nil { |
336 » » » s.stoppedPid = stoppedPid | 336 » » » s.stoppedPid = wpid |
337 break | 337 break |
338 } | 338 } |
339 bce, ok := err.(*breakpointsChangedError) | 339 bce, ok := err.(*breakpointsChangedError) |
340 if !ok { | 340 if !ok { |
341 return err | 341 return err |
342 } | 342 } |
343 | 343 |
344 if err := syscall.Kill(s.stoppedPid, syscall.SIGSTOP); err != ni
l { | 344 if err := syscall.Kill(s.stoppedPid, syscall.SIGSTOP); err != ni
l { |
345 return fmt.Errorf("kill(SIGSTOP): %v", err) | 345 return fmt.Errorf("kill(SIGSTOP): %v", err) |
346 } | 346 } |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 // topOfStack is the out-of-process equivalent of runtimeĀ·topofstack. | 669 // topOfStack is the out-of-process equivalent of runtimeĀ·topofstack. |
670 func (s *Server) topOfStack(funcEntry uint64) bool { | 670 func (s *Server) topOfStack(funcEntry uint64) bool { |
671 return funcEntry == s.runtime.goexit || | 671 return funcEntry == s.runtime.goexit || |
672 funcEntry == s.runtime.mstart || | 672 funcEntry == s.runtime.mstart || |
673 funcEntry == s.runtime.mcall || | 673 funcEntry == s.runtime.mcall || |
674 funcEntry == s.runtime.morestack || | 674 funcEntry == s.runtime.morestack || |
675 funcEntry == s.runtime.lessstack || | 675 funcEntry == s.runtime.lessstack || |
676 funcEntry == s.runtime._rt0_go || | 676 funcEntry == s.runtime._rt0_go || |
677 (s.runtime.externalthreadhandlerp != 0 && funcEntry == s.runtime
.externalthreadhandlerp) | 677 (s.runtime.externalthreadhandlerp != 0 && funcEntry == s.runtime
.externalthreadhandlerp) |
678 } | 678 } |
LEFT | RIGHT |