Commit Graph

21 Commits

Author SHA1 Message Date
aarzilli
9ee21686e6 proc: report errors when loading executable on attach
Fixes #940
2017-08-30 11:20:20 -07:00
aarzilli
4121fb1f96 proc/native,proc/gdbserial: set selectedGoroutine after StepInstruction
When stepping through runtime sometimes the current goroutine will
change. It is impossible to handle this in Next, Step and StepOut but
StepInstruction can reset the current goroutine correctly.
2017-07-26 12:50:09 -06:00
aarzilli
5c2673a632 proc/native, proc/gdbserial: StepInstruction without goroutine
proc.Process.StepInstruction should work even if there is no goroutine
selected.
2017-07-26 12:50:09 -06:00
Florin Pățan
135330cbb2 Pass LD_/DYLD_ env vars to debugserver (fixes #877) (#910) 2017-07-18 12:57:41 -06:00
Alessandro Arzilli
07e53f7cbb proc: fix interaction of RequestManualStop and conditional breakpoints (#876)
* proc: fix interaction of RequestManualStop and conditional breakpoints

A conditional breakpoint that is hit but has the condition evaluate to
false can block a RequestManualStop from working. If the conditional
breakpoint is set on an instruction that is executed very frequently by
multiple goroutines (or many conditional breakpoints are set) it could
prevent all calls to RequestManualStop from working.

This commit fixes the problem by changing proc.Continue to exit
unconditionally after a RequestManualStop is called.

* proc/gdbserial: fix ContinueOnce getting stuck on macOS

Fixes #902
2017-07-07 16:29:37 -07:00
Florin Pățan
32a005de2b Fix various issues detected by megacheck (#880)
* Fix various issues detected by megacheck

I've ran honnef.co/go/tools/cmd/megacheck and fixed a few of the
things that came up there.

* Cleanup using Gogland
2017-06-29 11:15:59 -07:00
Alessandro Arzilli
50f6382307 dlv: make headless servers quit automatically when client disconnects (#895) 2017-06-26 11:45:13 -07:00
heschik
7d2834a963 proc: read G struct offset from runtime.tlsg if possible (#883)
When a Go program is externally linked, the external linker is
responsible for picking the TLS offset. It records its decision in the
runtime.tlsg symbol. Read the offset from that rather than guessing -16.

This implementation causes a regression: 1.4 and earlier will no longer
work.
2017-06-21 15:40:42 -07:00
aarzilli
16d8bd647f proc/*: remove Process.Running
Implementing proc.Process.Running in a thread safe way is complicated
and nothing actually uses it besides tests, so we are better off
rewriting the tests without Running and removing it.

In particular:

* The call to d.target.Running() in service/debugger/debugger.go
  (Restart) can never return true because that line executes while
  holding processMutex and all continue operations are also executed
  while holding processMutex.
* The call to dbp.Running() pkg/proc/native/proc.go (Detach) can never
  return true, because it's only called from
  debugger.(*Debugger).detach() which is also always called while
  holding processMutex.

Since some tests are hard to write correctly without Process.Running a
simpler interface, Process.NotifyResumed, is introduced.

Fixes #830
2017-06-13 08:53:54 +02:00
Florin Pățan
640dedb479 Return breakpoints when they already exist (#870)
See https://youtrack.jetbrains.com/issue/GO-3931#comment=27-2224179
for more details
2017-06-12 14:55:53 -07:00
Alessandro Arzilli
f4ebfd5101 proc/gdbserial: wait for a connection from stub as long as stub lives (#846)
The authorization prompt on macOS can take a long time to be
acknowledged by the user, we should keep waiting for a connection as
long as the debugserver instance we launched remains alive.
2017-05-22 11:27:54 -07:00
Alessandro Arzilli
8d3e74a445 proc/gdbserial: fix passing arguments to target via debugserver (#843)
Debugserver does not work as documented, "--" needs to be specified to
pass arguments to the target process (but only if it's an argument that
starts with a dash).

Fixes #839
2017-05-15 10:11:46 -07:00
Alessandro Arzilli
82d142d1cd proc/gdbserial: use reverse connect feature of debugserver (#837)
Fixes #836
2017-05-11 12:34:39 -07:00
Alessandro Arzilli
862145f874 proc: print runtime.curg._panic.arg on unrecovered-panic breakpoint (#833)
You usually want to know the reason for the panic when a panic happens,
it can be printed manually this is a small quality of life improvement.
2017-05-09 10:32:16 -07:00
Alessandro Arzilli
a843f7944e proc/gdbserial: mozilla rr support (#804)
Implements #727
2017-05-05 15:17:52 -07:00
Alessandro Arzilli
f29b9edad2 proc/gdbserial: pass environment variables to target (#820)
debugserver requires a special option to forward the environment to the target.

Fixes #818
2017-05-04 10:46:45 -07:00
Alessandro Arzilli
76ce11cffb proc/gdbserial: disable lldb backend on windows (#819)
Lldb-server does not currently support windows/amd64 (it's in
development). And delve's native backend seems to work well on windows.
Disable the lldb backend on windows for now.

Fixes #817
2017-05-04 10:43:53 -07:00
Alessandro Arzilli
dcf51a5032 proc/native: error when reading/writing memory of exited process (#812)
Fixes #809
2017-05-01 09:57:37 -07:00
Alessandro Arzilli
a731eb661f Minor post-refactoring cleanup (#808)
* proc/native: remove unused utility methods

* proc: turn FindFileLocation, FindFunctionLocation, FirstPCAfterPrologue methods into function
2017-04-28 10:15:39 -07:00
aarzilli
b6fe5aebaf proc: refactoring: merge target into proc
- moved target.Interface into proc as proc.Process
- rename proc.IThread to proc.Thread
- replaced interfaces DisassembleInfo, Continuable and
  EvalScopeConvertible with Process.
- removed superfluous Gdbserver prefix from types in the gdbserial
  backend.
- removed superfluous Core prefix from types in the core backend.
2017-04-21 14:00:04 -07:00
aarzilli
15bac71979 proc: refactoring: split backends to separate packages
- move native backend to pkg/proc/native
- move gdbserver backend to pkg/proc/gdbserial
- move core dumps backend to pkg/proc/core
2017-04-21 14:00:04 -07:00