Commit Graph

195 Commits

Author SHA1 Message Date
aarzilli
3a8730de72 proc: Do not panic when a command is executed on an exited process
Fixes #355
2016-01-30 07:23:21 +01:00
aarzilli
6c7ad4059b proc: Possible panic while reading uninitialised memory
If uninitialized memory is read loadArrayValues could try to call
cacheMemory with a negative size, which could cause a 'makeslice:
len out of range' panic.

Fixes #354 (partial)
2016-01-27 13:25:49 +01:00
Luke Hoban
d756eba13a [service/debugger] Case-insensitive paths on Windows
Fixes #370.
2016-01-26 18:50:53 -08:00
Derek Parker
39bc379dd2 proc: Fix step when on breakpoint
Fixes #361
2016-01-26 16:45:26 -08: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
Derek Parker
afe77160b0 proc: refactor parseg
Instead of doing a bunch of manual DWARF / memory parsing we instead can
just dogfood the internal Variable API to retrieve the G struct.
2016-01-24 17:11:17 +01:00
aarzilli
d9a31dd598 proc: implement conditional breakpoints
Backend only, no UI

Implements #120 (partial)
2016-01-24 08:32:28 +01:00
aarzilli
092571591f proc: added fake runtime.curg variable 2016-01-24 08:31:16 +01:00
Luke Hoban
14f26ffda8 Reenable TestNextNetHTTP on Windows 2016-01-23 21:26:08 -08:00
Luke Hoban
bddb712a6b Add support for Windows.
Fixes #198.
2016-01-20 19:06:31 -08:00
Derek Parker
98ae684096 proc: Single step only "current" thread
Instead of the `step` command single stepping every thread, instead only
step the "current" thread. This fixes a few issues surrounding single
stepping, and simplifies the logic. The original concerns around only
stepping a single thread (with regard to coordination) are invalid and
generally non-issues.
2016-01-20 12:22:39 -08:00
aarzilli
70cbbdc083 service/locations: hooked expression evaluator to location specifiers
Location specifiers starting with '*' can be followed by any
expression supported by the evaluator.
The expression should evaluate to either an integer (which will be
interpreted as an address) or to a function pointer (which will be
dereferenced to get the function's entry point).
2016-01-17 21:45:28 -08:00
aarzilli
453bd0217f proc: bugfix: clearing temp breakpoints
Temp breakpoints should be cleared even if a non-temp breakpoint is
triggered on the same goroutine that the temp breakpoints are set on.

Fixes #305
2016-01-16 09:13:15 +01:00
aarzilli
b839eda2a9 proc/variables: prefetch of target process memory
Prefetch the entire memory of structs and arrays and cache it instead
of issuing readMemory calls only when we get down to primitive types.
This reduces the number of system calls to ptrace that variables makes.

Improves performance in general, greatly improving it in some
particular cases (involving large structs).

Benchmarks without prefetching:
	BenchmarkArray-4         	      10	 132189944 ns/op	   0.06 MB/s
	BenchmarkArrayPointer-4  	       5	 202538503 ns/op	   0.04 MB/s
	BenchmarkMap-4           	     500	   3804336 ns/op	   0.27 MB/s
	BenchmarkGoroutinesInfo-4	      10	 126397104 ns/op
	BenchmarkLocalVariables-4	     500	   2494846 ns/op

Benchmarks with prefetching:
	BenchmarkArray-4         	     200	  10719087 ns/op	   0.76 MB/s
	BenchmarkArrayPointer-4  	     100	  11931326 ns/op	   0.73 MB/s
	BenchmarkMap-4           	    1000	   1466479 ns/op	   0.70 MB/s
	BenchmarkGoroutinesInfo-4	      10	 103407004 ns/op
	BenchmarkLocalVariables-4	    1000	   1530395 ns/op

Improvement factors:
	BenchmarkArray				12.33x
	BenchmarkArrayPointer		16.97x
	BenchmarkMap					 2.59x
	BenchmarkGoroutinesInfo		 1.22x
	BenchmarkLocalVariables		 1.63x
2016-01-10 13:49:03 +01:00
aarzilli
32a0c752eb proc: fix 2 typos 2016-01-10 12:47:54 +01:00
Derek Parker
0188dc2c8b misc: cleanup and documentation 2016-01-10 02:10:51 -08:00
aarzilli
6d50aba71d proc/variables: bugfix: infinite loading loop through maps
Fixes #341
2016-01-10 10:04:14 +01: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
17d8aa2bd1 proc: bugfix: wrong final count in TestBreakpointCounts (linux)
Sometimes after PtraceSingleStep the thread does not advance of a
single instruction but is, instead, blocked immediately by a SIGSTOP
Made singleStep repeat the process until a SIGTRAP is observed.

Unsure where the SIGSTOP comes from.
2016-01-09 08:44:38 +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
5441135668 proc: Next implemented as conditional breakpoints + Continue
Next sets its temporary breakpoints with the condition that they
must only activate on the current goroutine, and then calls Continue
When Continue encounters a temporary breakpoint it clears all
the breakpoint.

User visible changes: breakpoints that get hit while executing Next
are not ignored.

This commit does not implement full conditional breakpoints
functionality, the only condition that can be set is on the
goroutine id.

Fixes race conditions in Next affecting TestNextConcurrent.
2016-01-09 08:44:32 +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
aarzilli
2c58d0c242 bugfix: proc/types: loadPackageMap and github.com packages
Makes loadPackageMap actually work with github.com/... packages
2016-01-08 09:58:25 -08:00
aarzilli
7e0d3fc244 workaround: proc/eval: go sometimes inserts &v instead of v 2016-01-04 16:20:23 +01:00
aarzilli
1aa83e30e0 proc/variables: bugfix: nil pointer with interfaces to functions
Fixes #325
2015-12-26 14:49:46 -08:00
aarzilli
17b39b789d Revert "proc: Fix parsing of 'BuildVersion' on Go tip"
This reverts commit ad5097a8dc716e61992d5c7dd6213e58cb0a88b5.
runtime/internal/sys.BuildVersion was not used in any official
release.
2015-12-23 10:53:49 +01:00
aarzilli
1a4250fb51 proc/variables: bugfix: hang on ptr loop including interfaces
recurseLevel value should not be reset when evaluating the contents
of an interface variable

Fixes #316
2015-12-19 14:57:48 +01:00
Derek Parker
ab77435223 docs: update comment docs for GetG 2015-12-16 17:16:59 -08:00
Derek Parker
67ef867762 proc: prefer %q over escaped quoute 2015-12-15 15:18:52 -08:00
aarzilli
38716dcc26 proc/variables: bugfix: ifaces with types in user defined packages
The concrete type of an interface only contains the abbreviated
package name, we must construct a map from package names to package
paths to be able to resolve the concrete type of an interface.
2015-12-15 15:18:52 -08:00
aarzilli
8346a6ee08 proc/variables: bugfix: disable cast to maps and channels
It's was implemented unintentionally and the unintentional
implementation doesn't work and causes a crash.
2015-12-15 15:18:52 -08:00
aarzilli
141fc4ed21 proc/eval: support for simple builtin functions
supported: len, cap, imag, real, complex
2015-12-15 15:18:52 -08:00
aarzilli
48e13a9045 proc/variables: Support for interface types 2015-12-15 15:18:52 -08:00
aarzilli
2deb7fba20 proc/eval: fix panic slicing or indexing 'nil' 2015-12-15 15:18:52 -08:00
aarzilli
ff3e2344c4 proc/eval: Support type casts between basic types 2015-12-15 15:18:52 -08:00
Derek Parker
ad5097a8dc proc: Fix parsing of 'BuildVersion' on Go tip
Fixes #301
2015-12-15 08:42:13 +01:00
aarzilli
e45443b3c4 proc/eval: Return an error when slicing a map over its length
Fixes #288
2015-11-07 11:48:40 +01:00
aarzilli
7a36967b5e proc/variables: unsafe.Pointer support 2015-11-06 17:01:38 -08:00
aarzilli
943c12030a proc/variables: map types support
Use m[n:] to skip the first n keys of a map
Map indexing is implemented with a linear scan

Implements #61, #122
2015-11-06 17:01:38 -08:00
aarzilli
988d529e91 proc/variables: Support chan types
Pretty print will print them with the format:
chan <element type> <queued elements>/<queue size>
2015-11-06 17:01:38 -08:00
aarzilli
c25b9b369a proc/proc_test: Fixed TestStacktraceGoroutine
TestStacktraceGoroutine would occasionally fail due to race
conditions in the test itself
2015-11-06 19:49:36 +01:00