Commit Graph

44 Commits

Author SHA1 Message Date
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
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
aarzilli
43b64ec39e proc: Implements expression interpreter
Supported operators:

- All (binary and unary) operators between basic types except <-,
++ and -- (includes & to take the address of an expression)
- Comparison operators between supported compound types
- Typecast of integer constants into pointer types
- struct members
- indexing of arrays, slices and strings
- slicing of arrays, slices and strings
- pointer dereferencing
- true, false and nil constants

Implements #116, #117 and #251
2015-11-04 12:28:48 +01:00
aarzilli
d65e832524 proc/variable: changed Value's type to constant.Value 2015-10-28 18:28:58 -07:00
aarzilli
50b5fc92e2 Changed api.Variable to have a machine readable value
The new contents of api.Variable are documented in
proc/variables.go.

Implements #243
2015-10-28 18:28:58 -07:00
Derek Parker
28e0a322bf proc: Improve 'next' functionality
Instead of trying to be clever and make an 'educated guess' as to where
the flow of control may go next, simple do the more naive, yet correct,
approach of setting a breakpoint everywhere we can in the function and
seeing where we end up. On top of this we were already setting a
breakpoint at the return address and deferred functions, so that remains
the same.

This removes a lot of gnarly, hard to maintain code and takes all the
guesswork out of this command.

Fixes #281
2015-10-22 10:14:24 -07:00
Florin Patan
197c165699 proc/breakpoint Add breakpoint statistics
This adds support for breakpoints statistics

Fixes #247
2015-10-09 16:01:06 -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
Derek Parker
466960d95a proc: Remove hardware assisted breakpoints
Only use software breakpoints for now. The reasoning is because it
complicates the code without justification, and is only supported on
Linux. Eventually, once watchpoints are properly implemented we will
revive some of this code. Also, if it is ever necessary to actually set
a hw breakpoint we can revive that code as well.

All future versions of this code will include support for OSX before
being merged back in.
2015-09-26 13:58:54 -07:00
aarzilli
da39258bec stack command: -full flag prints local variables and arguments of all the functions on the stack trace 2015-09-18 08:34:21 +02:00
aarzilli
c6ebd80905 Variable evaluation on arbitrary (goroutine, frame) pair. 2015-09-05 12:08:40 -05:00
omie
d5e00a583d dwarf/line: Support for parsing multiple file tables
Support multiple file / directory tables for multiple compilation units.

- added a type DebugLines that can hold number of DebugLineInfo
- added a supporting attribute to DebugLineInfo called 'Lookup' which is to be
used to quickly lookup if file exists in FileNames slice
- added supporting methods to lookup and return corresponding DebugLineInfo
- changed the debug_line parsing behavior to read all the available tables and
push them to DebugLines

- since Process.lineInfo is now a slice, it was breaking AllPCsBetween as well
- updated that function's definition to accept a new filename parameter to be
able to extract related DebugLineInfo
- updated calls to AllPCsBetween

- fixed tests that were broken due to attribute type change in Process
- updated _fixtures/cgotest program to include stdio.h, so that it updates
.debug_line header
- added a test to check 'next' in a cgo binary
- OSX - 1.4 does not support cgo, handle that in new testcase
2015-08-29 14:51:27 -05:00
Derek Parker
b9846c7684 command (next): Improvements for parallel programs
This patch aims to improve how Delve tracks the current goroutine,
especially in very highly parallel programs. The main spirit of this
patch is to ensure that even in situations where the goroutine we care
about is not executing (common for len(g) > len(m)) we still end up back
on that goroutine as a result of executing the 'next' command.

We accomplish this by tracking our original goroutine id, and any time a
breakpoint is hit or a threads stops, we examine the stopped threads and
see if any are executing the goroutine we care about. If not, we set
'next' breakpoint for them again and continue them. This is done so that
one of those threads can eventually pick up the goroutine we care about
and begin executing it again.
2015-08-20 09:32:59 -05:00
aarzilli
77d46a51fb Fix: Support for x.y versions 2015-08-12 09:30:47 -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
d9d3118aa0 Fix: Parse rc version strings 2015-08-11 08:37:27 -05:00
Derek Parker
f43007c55e Fix: Handle inability to find return addr
Fixes a code path where stacktrace returns < 2 locations and
thread.ReturnAddress would panic. Now returns an error.
2015-08-10 10:45:33 -05:00
aarzilli
8e8d2660ef Improve commands which take a location spec
Breakpoints, tracepoints, etc.. take a location spec as input. This
patch improves the expressiveness of that API. It allows:

* Breakpoint at line
* Breakpoint at function (handling package / receiver smoothing)
* Breakpoint at address
* Breakpoint at file:line
* Setting breakpoint based off regexp
2015-08-08 14:41:48 -05:00
Derek Parker
869884b9ab Bind to less used port in test 2015-08-08 14:30:23 -05:00
Derek Parker
93dcd40cee Refactor read/write memory code 2015-08-01 21:43:03 -05:00
Derek Parker
bcbda1dba3 Rename version.After to version.AfterOrEqual 2015-07-28 15:42:56 -05:00
aarzilli
311da7c314 bugfix: version string parsing support for beta versions and tolerance for devel versions
fixes issue #179
2015-07-28 15:15:45 -05:00
aarzilli
a0115e3a15 bugfix: Issue #170 (partial) set function breakpoints on the first instruction
the entry point of a function is the beginning of the prologue, which can be run multiple times for each invocation of a function if the stack needs to be expanded or the scheduler needs to be run.
2015-07-28 08:16:20 -05:00
aarzilli
a353735715 Breakpoints are hit multiple times or skipped sometimes (tests) 2015-07-28 08:13:46 -05:00
Derek Parker
051ea39f2c Remove superfluous Kill method call in test
The process will already be killed via withTestProcess
2015-07-28 07:54:26 -05:00
aarzilli
0933a681cf proc.(*Thread).GetG: reading TLS memory directly for g address instead of modifying the executable code 2015-07-28 07:33:51 +02:00
aarzilli
d0f3459efb bugfix, Issue #163: offset of g struct in TLS picked based on the value of runtime.buildVersion and presence of compile units created by GNU AS, instead of being fixed to -16 2015-07-28 07:33:51 +02:00
Derek Parker
b32afd92ad Add test for kevent patch 2015-07-15 19:57:54 -05:00
Derek Parker
40284111d4 Kill process outright if manually forked 2015-07-11 01:43:47 -05:00
Derek Parker
e6448556fa Cleanup whitespace 2015-07-10 20:16:06 -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
6b99c5f519 Cleanup tracepoint commit
* Cleanup comments
* Cleanup naming in certain instances
* Modify stacktrace to return current location
2015-06-30 22:16:52 -05:00
aarzilli
3a96d8eed7 trace command 2015-06-29 21:16:55 +02:00
Derek Parker
9d1711d376 dbp.Running determined by any thread running 2015-06-26 09:58:26 -05:00
Derek Parker
db278d0453 Improve TestHalt reliability on Linux 2015-06-26 07:46:46 -05:00
Derek Parker
72b81c0c6b Ensure process is stopped before detaching in tests 2015-06-24 18:33:38 -05:00
Derek Parker
687dc4172d Introduce JSON-RPC service 2015-06-21 21:11:30 -05:00
Derek Parker
6e538119d2 Refactor: Rename breakpoint methods
s/Break/SetBreakpoint/
s/Clear/ClearBreakpoint/
s/BreakByLocation/SetBreakpointByLocation/
2015-06-20 18:01:06 -05:00
Derek Parker
102d4c89ae s/DebuggedProcess/Process/ 2015-06-20 17:54:52 -05:00
aarzilli
07473f04c5 Implement stack command
Finishes #63 #64
2015-06-20 15:29:33 -05:00
Derek Parker
37235bba7f Store hardware/software breakpoints in same struct 2015-06-17 18: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