Commit Graph

41 Commits

Author SHA1 Message Date
aarzilli
51c39ed171 proc: detect when Launching non-executable files
This provides a better error message when the user tries to run dlv
debug on a directory that does not contain a main package, when `dlv
exec` is used with a source file.

Additionally the architecture of the executable is checked as suggested
by @alexbrainman in #443.

Fixes #509
2016-06-30 09:39:18 +02:00
Alessandro Arzilli
9bc6ad4f46 Go 1.7 compatibility (#524)
* tests: update to cope with go1.7 SSA compiler

* de-vendored golang.org/x/debug/dwarf

We need our own tweaked version

* dwarf/debug/dwarf: always use the entry's name attribute

Using the name attribute leads to better type names as well as fixes
inconsistencies between 1.5, 1.6 and 1.7.

* proc: Updated loadInterface to work with go1.7

go1.7 changed the internal representation of types, removing the string
field from runtime._type.
Updated loadInterface to use the new str field.
2016-05-29 12:20:09 -07:00
Derek Parker
f37a26d525 proc: Use correct type for mach task 2016-04-12 22:53:13 -07:00
Derek Parker
1bda586115 proc: step now goes to next line, including funcs
This patch modifies the `step` command to step to the next source line,
stepping into any function encountered along the way.

Fixes #360
2016-01-24 15:48:36 -08:00
aarzilli
54f1c9b3d4 proc: replace debug/dwarf with golang.org/x/debug/dwarf
Typedefs that resolve to slices are not recorded in DWARF as typedefs
but instead as structs in a way that there is no way to know they
are really slices using debug/dwarf.
Using golang.org/x/debug/dwarf instead this problem is solved and
as a bonus some types are printed with a nicer names: (struct string
→ string, struct []int → []int, etc)

 Fixes #356 and #293
2016-01-24 15:41:41 -08:00
aarzilli
b1640238ce dwarf/frame: detecting dwarf section endianness 2016-01-24 15:41:41 -08:00
aarzilli
91743d9472 go fmt 2016-01-24 17:30:23 +01:00
Luke Hoban
bddb712a6b Add support for Windows.
Fixes #198.
2016-01-20 19:06:31 -08:00
Derek Parker
0188dc2c8b misc: cleanup and documentation 2016-01-10 02:10:51 -08:00
Derek Parker
26c0307aef proc: fix typo 2016-01-09 13:46:18 -08:00
aarzilli
4266479531 proc: bugfix: array overrun from cgo in updateThreadList 2016-01-09 08:44:45 +01:00
aarzilli
4da4aea89c proc: wait for full process stop before evaluating anything 2016-01-09 08:44:43 +01:00
aarzilli
ab2b9ad1c6 proc: refactoring of Continue 2016-01-09 08:44:41 +01:00
aarzilli
5354e462e8 proc: bugfix: race condition between termination and Continue (linux)
resume loops in continueOnce moved to a OS specific resume function,
this makes the problem easier to deal with and seems to be more
appropriate to a windows port given what transpired from discussion
of Pull Request #276
2016-01-09 08:44:37 +01:00
aarzilli
2f9f20188a proc: bugfix: proc.Launch race (OS X) 2016-01-09 08:44:35 +01:00
aarzilli
78c79927d6 proc: bugfix: [OS X] desync of mach message queue in Continue 2016-01-09 08:44:30 +01:00
aarzilli
b21686e6c4 proc: Continue does not work with breakpoints set on NOP (OSX)
Fixes #262
2016-01-09 08:44:28 +01:00
aarzilli
a9e2696f46 proc: bugfix: proc.(*Process).Continue skips breakpoints
Breakpoints are skipped either because:
1. when multiple breakpoints are hit simultaneously only one is
processed
2. a thread hits a breakpoint while another thread is being
singlestepped over the breakpoint.

Additionally fixed a race condition between Continue and tracee
termination.
2016-01-09 08:28:36 +01:00
Derek Parker
d8dd9c8d0e proc: Properly close channels upon process exit
Prevents a lot of goroutines hanging around, especially when running
tests.
2015-10-09 17:33:16 -07:00
Derek Parker
f2ae6a27cd proc: fix: Call wg.Done in loadProcessInformation on OSX 2015-10-04 12:08:17 -07:00
aarzilli
e509c3ce36 proc: bugfix: status does not work with programs containing spaces
/proc/pid/stat needs more complex parsing

Fixes #239
2015-10-04 12:01:09 -07:00
aarzilli
c6ebd80905 Variable evaluation on arbitrary (goroutine, frame) pair. 2015-09-05 12:08:40 -05:00
Derek Parker
8be76428c8 Remove superfluous var declarations 2015-08-27 16:48:34 -05:00
Derek Parker
a336c92a8b Fix: Improve handling of soft signals on darwin
Fixes a bug on OSX where, if the debugged process spawned a child, when
that process received a SIGCHLD it would cause Delve to hang.

Fixes #197
2015-08-11 19:20:25 -05:00
Derek Parker
ed9b7769fd Remove unused 'singleStepping' state on Process
We don't care, at the process level, whether or not we're single
stepping. That state is really only relevant at the thread level.
2015-08-11 08:20:44 -05:00
Derek Parker
af55ef3522 Process.Kill: Do not kill if process already exited 2015-08-04 08:32:43 -05:00
Derek Parker
a6fc8d11a7 Create new session/process grp for forked process 2015-07-28 12:20:07 -05:00
Derek Parker
1727df4b1b Fix: Properly attach to running process on OSX 2015-07-15 20:37:43 -05:00
Derek Parker
40284111d4 Kill process outright if manually forked 2015-07-11 01:43:47 -05:00
Derek Parker
4d1dc5ad0e Inject SIGTRAP for manual stop
Instead of fighting against the normal flow, just signal a SIGTRAP and
let the existing flow handle it, as long as we set the halt flag
correctly the system should halt.
2015-07-07 15:55:22 -05:00
Derek Parker
776e2a593f Null terminate argv array in Go land not C land 2015-07-07 14:57:36 -05:00
Derek Parker
05517c62c1 Properly terminate C string array for execve on OSX 2015-07-07 08:42:34 -05:00
Derek Parker
8d4a73f7dd Refactor: Reorganize guard clauses 2015-06-27 23:22:01 -05:00
Derek Parker
29ed169848 Return error when invoking Delve with invalid path
Fixes #154
2015-06-26 23:05:15 -05:00
aarzilli
d919114d32 Fix: Linux - call wait4 on thread grp leader is broken
On a thread that's leader of its group,
that is ptraced and that was survived by its children.
2015-06-26 22:10:09 -05:00
Derek Parker
102d4c89ae s/DebuggedProcess/Process/ 2015-06-20 17:54:52 -05:00
Derek Parker
e3aade85ab Update Launch docs for Darwin 2015-06-19 08:15:54 -05:00
Derek Parker
509c4839ae Update OSProcessDetails docs for Darwin 2015-06-19 08:14:56 -05:00
Derek Parker
e4fc5e32c2 Refactor: Use thread-locked goroutine for ptrace ops
Previously either the terminal client or the debugger service would
either lock main goroutine to a thread or provide a locked goroutine to
run _all_ DebuggedProcess functions in. This is unnecessary because only
ptrace functions need to be run from the same thread that originated the
PT_ATTACH request.

Here we use a specific thread-locked goroutine to service any ptrace
request. That goroutine is also responsible for the initial spawning /
attaching of the process, since it must be responsible for the PT_ATTACH
request.
2015-06-13 12:57:42 -05:00
Derek Parker
e5233e7262 Rename: s/ThreadContext/Thread/ 2015-06-12 14:51:23 -05:00
Derek Parker
bfca6114d4 Rename package proctl -> proc 2015-06-12 14:49:23 -05:00