Commit Graph

1101 Commits

Author SHA1 Message Date
Derek Parker
53f0d24057 Move top-level packages into pkg 2017-02-08 12:17:19 -08:00
Derek Parker
26ad5f1d82 Introduce target interface 2017-02-08 12:16:51 -08:00
Alessandro Arzilli
3658d1e17c proc/variables: mark malformed maps as unreadable instead of panicking (#703)
Under currently undetermined circumstances we encounter a map type that
has a malformed buckets, oldbuckets or overflow field.
Check the type of buckets, oldbuckets and overflow before using them.

Fixes #685
2017-02-08 08:18:13 -08:00
Alessandro Arzilli
e77595ce31 Improve stacktraces (#721)
* service/rpccommon: fixed typo

* proc: test parseG while target is in runtime.deferreturn

runtime.deferreturn will change the value of curg._defer.fn in such a
way that if the target is stopped at just the right instruction it
may crash an incorrect implementation of parseG

* proc/stack: handle stack barriers correctly

Correctly handle stack barriers insterted during garbage collection.
2017-02-08 14:14:57 +01:00
Alessandro Arzilli
8c96e275d0 proc: Make sure CurrentLoc of G returned by GetG is up to date (#723)
We are already doing this in GoroutinesInfo we should be doing it for
GetG. The main consequence of not doing this is that the CurrentLoc of
DebuggerState.SelectedGoroutine is out of date compared to the location
of the thread running it.
2017-02-07 13:44:36 -08:00
Alessandro Arzilli
098457e59e Trace optimizations (#695)
* proc: Added trace benchmark

Results:

BenchmarkTrace-4   	    5000	  36195899 ns/op

* proc/linux: faster single step implementation.

BenchmarkTrace-4   	    5000	   2093271 ns/op

* proc: Cache function debug_info entries to speed up variable lookup.

BenchmarkTrace-4   	    5000	   1864846 ns/op

* proc/variables: Optimize FunctionArguments by prefetching frame

BenchmarkTrace-4   	    5000	   1815795 ns/op

* proc/variables: optimized parseG

BenchmarkTrace-4   	   10000	    712767 ns/op
2017-02-07 13:08:11 -08:00
Alessandro Arzilli
8724b3fce7 Go 1.8 compatibility (part 2) (#667)
* dwarf/line: bugfix: not all values of the state machine can be used

According to DWARF Version 3 Section 6.2 "Line Number Information" not
all the values transversed by the line numbers state machine are valid
instructions, only the ones after a "special opcode", after the
standard opcode DW_LNS_copy and the extended opcode
DW_LINE_end_sequence.

DWARF3 describes this by specifying that only the opcodes listed above
"append a row to the matrix".

Additionally the implementation of DW_LNS_const_add_pc was wrong.

Fixes #664

* dwarf/line: fixed test failing with go1.8

* service/test: fix prologue detection tests

The conditions about which function prologue is emitted by the compiler
changed in go1.8, changed the test program so that callme2 will still
have a prologue under go1.8.

* service/test: fix step test

compilation units are linked in a different order under go1.8 so the
code of 'fmt' is no longer located after 'main' in the executable,
changed the tests so that they don't rely on this assumption anymore.

* proc: change runtime.Breakpoint support for go1.8

Before 1.8 it was sufficient to step twice to exit a
runtime.Breakpoint(), but go 1.8 added frame pointer tracking to small
functions making runtime.Breakpoint longer.
This changes runtime.Breakpoint handling in Continue to single step as
many times as are needed to exit runtime.Breakpoint.

* proc/test: fix TestIssue561 for go1.8
2017-02-07 13:07:18 -08:00
Alessandro Arzilli
025ae26140 Added jodosha/vim-godebug to Documentation/EditorIntegration.md (#722) 2017-02-07 13:05:10 -08:00
Alessandro Arzilli
d89d115ef9 proc/variables: support NaN/Inf float values (#706)
Unfortunately go/constant does not support NaN and Inf float values so
we need to store this information alongside.

Fixes #705
2017-01-20 14:22:36 -08:00
Derek Parker
449b276fe1 Bump to version 0.12.1 2017-01-11 11:37:04 -08:00
Derek Parker
2fb8129fa0 version: Fix version output format 2017-01-11 11:34:54 -08:00
Derek Parker
da39bcd0d7 Bump to version 0.12.0 2017-01-11 11:27:23 -08:00
Alessandro Arzilli
1afcc6c189 Fix for #614 and #683 (#687)
* service: Prevent panics from crashing delve and killing the target

Catch all unrecovered proc and debugger panics in the service layer and
report them as errors, allow users to cleanly detach from the target
and quit.

Fixes #614

* proc: Next/Step should not panic if line info can not be found.

Fixes #683
2017-01-09 15:21:54 -08:00
Alessandro Arzilli
4dd627f669 service/debugger: bugfix: error values can not be marshalled (#697) 2017-01-09 15:19:42 -08:00
Alessandro Arzilli
fd1df948fa proc: Improved prologue detection for big stackframes (#690)
Improved prologue detection for big stackframes and added references to
the function of the compiler that inserts the prologue.
2017-01-05 11:39:34 -08:00
Alessandro Arzilli
464d6c2783 terminal: fixed typo. (#694)
* terminal: fixed typo.

* debugger: bugfix: when restaring use new process to FindFileLocation
2017-01-05 11:13:07 -08:00
Alessandro Arzilli
f4aaffbbf3 Two bugfixes regarding stale executable files, and executables changing between restarts (#689)
* service/debugger: Restore breakpoints using file:line on restart

Restoring by address can cause the breakpoint to be inserted in the
middle of an instruction if the executable file has changed.

* terminal: Warn of stale executable when printing source
2016-12-22 10:53:34 -06:00
aarzilli
8f0646e426 proc: load more registers
Adds ability to load x87, SSE and AVX registers.

Fixes #666
2016-12-19 21:29:45 +01:00
aarzilli
63b8fa8269 proc: support for ver. 10.12.1 the OS formerly known as Mac OS X
Fixes #645
2016-12-17 11:07:43 +01:00
aarzilli
ee6d2734c9 tests: fix TestBuild on macOS, windows 2016-12-17 10:53:30 +01:00
Alessandro Arzilli
6bff4d1970 proc/variables: extend sign of read negative integers. (#657)
Since we store all signed integers as int64 the sign bit should be
extended, otherwise we read negative integers as their 2-complement
value.
2016-11-02 14:32:48 -07:00
Evgeny L
4064d6acc0 Flag to set working directory (#650)
* proc: Add `wd` to Launch

This change adds the `wd` arg which specify working directory of the
program.

Fixes #295

* service/debugger: Add `Wd` field to debugger.Config

This change adds the `Wd` field which specify working directory of the
program launched by debugger.

Fixes #295

* service: Add `Wd` to service.Config

This change adds the `Wd` field which specify working directory of the
program debugger will launch.

Fixes #295

* cmd/dlv: Add `Wd` flag

This change adds `Wd` flag which specify working directory of the
program which launched by debugger.

Fixes #295

* only set the Linux working directory if it is set,
stub out param in darwin and windows

* set working directory for Windows
https://godoc.org/golang.org/x/sys/windows#CreateProcess
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx

* Windows workingDir must be an *uint16

* attempt to chdir on darwin via @yuntan

* proc/exec_darwin.c: fix working directory for darwin

* Add tests to check if working directory works.
* Fix darwin implementation of fork/exec, which paniced if
  child fork returned.

* cmd, service: rename Wd to WorkingDir
2016-11-01 12:58:42 -07:00
aarzilli
f62bf8d1e3 proc: Names of concrete types of interfaces parsing their runtime._type
Generate names of the concrete types stored inside interface variables
by fully parsing their runtime._type instead of simply using the str
field.

This allows delve to read the contents of an interface variable when
the program imports multiple packages that have the same name. It also
allows delve to correctly interpret some complex anonymous types.

Fixes #455
2016-10-27 09:56:15 +02:00
Evgeny L
35bc789b3b config, terminal, command: Add substitute-path parameter to configuration file. (#640)
Allows to rewrite a source path stored in program's debug information,
if the sources were moved to a different place between compilation and
debugging.
2016-10-25 10:01:38 -07:00
aarzilli
0f4b5150c3 proc, terminal: stepout command
Command to step out of the currently executing function.

Implements #358
2016-10-23 17:09:26 +02:00
Alessandro Arzilli
54d3eab63a prettyprint: Print type of the elements of arrays of interface type (#591) 2016-10-21 22:14:43 -07:00
Alessandro Arzilli
6e882c50fa debugger/locations: prioritize exact matches of function names (#651)
If the location specification matches the name of a function exactly
return that function as a match event if the expression matches other
functions as well.

Without this some functions, like math/rand.Intn are unmatchable.
2016-10-21 22:04:03 -07:00
Alessandro Arzilli
f6e8fb37a4 proc: changed windows backend to deal with simultaneous breakpoints (#598)
* proc: changed windows backend to deal with simultaneous breakpoints

* bugfix: forgot to add windowsPrologue3 to the prologues list in e4c7df1

* Tolerate errors returned by Stacktrace in TestStacktraceGoroutine.

* bugfix: proc: propagate debug events we don't cause back to the target process

Fixes: #594

* proc: fixed TestStepConcurrentPtr

Implementation of nextInProgress was wrong.
2016-10-21 21:51:34 -07:00
Derek Parker
46803551b8 CI: add Go 1.7 to Travis (#649) 2016-10-04 20:06:09 +02:00
aarzilli
9cbe768836 proc: Renamed temp breakpoints to internal breakpoints 2016-09-30 08:35:29 +02:00
aarzilli
7c49d4968d proc: Implement Step using Continue
Instead of repeatedly calling StepInstruction set breakpoints to the
destination of CALL instructions (or on the CALL instructions
themselves for indirect CALLs), then call Continue.
Calls to unexported runtime functions are skipped.
Reduces the number of code paths managing inferior state from 3 to 2
(StepInstruction, Continue).

Fixes #561
2016-09-27 09:37:33 +02:00
aarzilli
8d58262020 proc: bugfix: Next and normal calls to deferred function
When a deferred function is called directly Next and StepOut should not
step into it.

Fixes #582
2016-09-27 09:37:26 +02:00
Alessandro Arzilli
fb8388ab2e proc/variables: missing return statement on error (#643)
Fixes #642
2016-09-25 08:28:22 -07:00
Alessandro Arzilli
5d78c04e62 dlv: bugfix: Allow quoting in build flags argument (#639)
Allows quoted substrings in build-flags flag. This fixes a build
problem on windows where the default build flags must contain a space.

Fixes #634 and #638
2016-09-25 08:26:59 -07:00
Alex Brainman
4d8daeb1a8 proc: implement detach on windows (#615) 2016-09-12 11:16:41 -07:00
Koichi Shiraishi
2fad5abe74 cmd: Support space separate flags for build-flags (#619)
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2016-09-12 11:13:21 -07:00
Alessandro Arzilli
e4c7df1469 Fix prologue detection on testvariables2.go's main.main (#625) 2016-09-06 10:27:07 -07:00
Alessandro Arzilli
f2c1789c64 Changed TestIssue426 to work with go 1.8 (#627)
go1.8 changed the way anonymous struct names are generated for DWARF.
2016-09-06 10:26:56 -07:00
Alessandro Arzilli
a782abee90 Update vendored version of peterh/liner (#620)
As suggested by Ederson de Souza.
https://groups.google.com/forum/?utm_medium=email#!msg/delve-dev/W_SfC3i9tf0/MY4QWaZOCgAJ
2016-09-01 08:29:46 -07:00
Alex Brainman
f09ef23f9e proc: implement attach on windows
Updates #363
2016-08-12 12:30:01 +10:00
guo
c3ade94b86 proc: fix could not read process comm name error
fix #531
2016-08-05 13:14:46 +08:00
dr2chase
218c2b953b proc: Fix stepping into runtime.duff* (#575)
Detect calls that do not target a function's entrypoint
(i.e, calls to runtime.duffzero and runtime.duffcopy) and
instead step into them directly.  StepInto sets a breakpoint
past the called function's prologue and expects that continue
will hit that breakpoint, but because the call is into the
interior of the function (well past the prologue) this fails.

Fixes #573
2016-07-21 13:10:35 -07:00
Alessandro Arzilli
16f16cf86d proc: bugfix: cleaning up spurious process exited errors (#599)
Fixes flakiness of TestCmdLineArgs.
2016-07-20 15:36:31 -07:00
aarzilli
c7f11149d7 Fix typo in terminal/terminal.go
Fixes #589
2016-07-08 15:10:13 +02:00
Nan Xiao
bfc280f48f Fix typo in proc/arch.go. 2016-07-08 13:57:40 +08:00
Alessandro Arzilli
142d882799 debugger/locations: Fixed bug parsing remote package paths (#586) 2016-07-05 12:13:21 -07:00
Alessandro Arzilli
372869c9e1 proc: Back to using vendored golang.org/x/debug/ (#585)
Patch https://go-review.googlesource.com/23085 has been merged so we
can go back to using golang.org/x/debug/.
2016-07-05 11:58:11 -07:00
aarzilli
da910cc3bd proc: disabled TestUnsupportedArch on go1.7
See: https://github.com/golang/go/issues/16180
2016-07-03 09:02:21 +02:00
aarzilli
80336e57e0 Replaced net/rpc with custom version
This version preserves the order of requests, allows the
client to switch between API versions and introduces a
way to send notifications to the client (see TODO item at:
proc/proc_linux.go:325).

Fixes #523, #571
2016-07-02 12:16:06 +02:00
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