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)
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
This change addresses a Windows-specifc issue with the 'test' command. On
Windows, 'go test' generate executables with a '.exe' filename extention,
but the current implementation attaches to a filename without the
extention.
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.
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).
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
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.
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
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.
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.