Commit Graph

923 Commits

Author SHA1 Message Date
aarzilli
93ad209f24 proc: bugfix: Detach(true) does not kill tracee
Instead of using PTRACE_DETACH to inject SIGINT into the tracee use
sys.Kill directly: PTRACE_DETACH is allowed to ignore its signal
argument if the tracee isn't in signal-delivery-stop status.
2015-09-27 07:56:35 +02: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
Derek Parker
c91ca831b7 build: Always pass ldflags to builds on OSX
Previously, 'ldflags' were added to the compiler invocation based on the
version of Go the user was running. It seems to make more sense to
simply always pass along the flags on Darwin (due to the bug mentioned
in the comment above this line in the diff) as that is less brittle than
branching on the Go version, and yet will not break current users /
developers work flow.
2015-09-25 17:19:09 -07:00
aarzilli
5ba0435382 Refactor: use FindGoroutine
Use proc.(*Process).FindGoroutine in proc.(*Process).SwitchGoroutine and
debugger.(*Debugger).Stacktrace. That method did not exist when those
were originally written.
2015-09-20 09:03:52 -07:00
aarzilli
a6391c1f76 proc/variables: Large strings & uninitialized memory fixes
Be more tolerant of unitialized memory, limit length of strings like we
do for array/slices.

Workaround for Issue #189
2015-09-20 08:59:06 -07:00
Derek Parker
7f3ae73471 Version: Bump to 0.9.0-alpha 2015-09-20 00:13:23 -05:00
Derek Parker
e02625ab89 terminal/command: Refactor to use stdlib function
Replace function with a stdlib implementation.
2015-09-19 23:58:18 -05:00
Derek Parker
2407005444 terminal/command: Stack no long takes goroutine id
Default numeric argument now simply represents the depth. If you would
like to see the stack trace of another goroutine, use `goroutine <id> bt`.
2015-09-19 23:43:43 -05:00
Derek Parker
784505813d proc/stack: Add punctuation to comment 2015-09-19 23:19:03 -05: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
Ilia Choly
6527f15e4d proc: Exclude dead goroutines from results.
Some of the goroutines stored in runtime.allg are in the dead state and
should not be displayed. The state is determined by the 'g.atomicstatus'
member.
2015-09-17 12:17:26 -07:00
Ilia Choly
c185b7d004 proc/proc: Cache 'GoroutineInfo' result during halt
The GoroutineInfo method can be slow if there are many goroutines. This
patch caches the results during a halt so they are not needlessly
recomputed.

Fixes #234
2015-09-17 12:10:35 -07:00
Derek Parker
b733b66236 docs: Update contributing doc
Updated doc with standard commit message format.
2015-09-17 07:10:56 -07:00
Derek Parker
0cba1fe0ba proc/variables: Use sched.pc instead of gopc for G location
gopc is the instruction of the `go` command that spawned this goroutine.
What we really want (unless we can get the PC from the thread) is the
value of sched.pc which is the value of the PC at the time it was
parked.
2015-09-16 20:59:30 -07:00
Ilia Choly
2c48b60bb4 terminal/command: list command w/ frame & goroutine commands 2015-09-13 11:56:20 -05:00
Ilia Choly
e273949f37 Add basic tab completion to terminal 2015-09-12 12:46:09 -05:00
Ilia Choly
e2acf8ce4a Sort goroutines by ID 2015-09-10 14:12:42 -04:00
Ilia Choly
0efe3eef4a Sort threads by ID 2015-09-10 14:04:59 -04:00
aarzilli
017ce2ae4e Fix: absolute path confused for regexp in FindLocation 2015-09-09 10:06:56 -05:00
Derek Parker
c0a0e0bdc1 proc/proc: Fix OSX hangs in highly parallel programs
`next` would hang in highly parallel programs, causing test flickers and
unexpected behavior. This patch fixes it by examining all stopped
threads whenever Delve gets a notification, instead of just the thread
that caused the stop.
2015-09-05 18:29:33 -05:00
Derek Parker
1094c32f14 Bump version to 0.8.1-alpha 2015-09-05 17:27:06 -05:00
Derek Parker
af9e97b697 service/debugger: Use PC instead of scope in Location.Find 2015-09-05 17:23:59 -05:00
Derek Parker
3fc823b781 Bump version to 0.8.0-alpha 2015-09-05 12:31:37 -05:00
aarzilli
c6ebd80905 Variable evaluation on arbitrary (goroutine, frame) pair. 2015-09-05 12:08:40 -05:00
Paul Smith
7206267772 Visually align registers & show 16 bytes for each
This change right-aligns the register names in the output of the "regs" command,
and pads out the display of the hex value of each register to 16 bytes. This
makes scanning registers for set values a bit easier.
2015-09-02 00:00:48 -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
a0cffab881 Collect errors from defer in proc.next 2015-08-28 08:27:08 -05:00
Derek Parker
cf105863a7 Skip dependency install with SKIP_DEPS env var 2015-08-28 07:59:22 -05:00
Derek Parker
8be76428c8 Remove superfluous var declarations 2015-08-27 16:48:34 -05:00
Derek Parker
39378a6541 Update gitignore 2015-08-27 16:21:00 -05:00
Derek Parker
8c1853d193 proc/proc: Let thread set its own state 2015-08-21 22:46:17 -05:00
Derek Parker
eb0b4e9392 proc.Next: Further improve handling of highly parallel programs
This patch forces Delve to be more mindful of how it handles many
threads and the goroutine context switching that occurs in such cases.
2015-08-21 22:33:42 -05:00
Tyler Bunnell
be2d9c3a84 Add config file and command alias config options. 2015-08-21 14:20:23 -05:00
Derek Parker
38e0051308 thread.Halt: Remove duplication between OS implementations
Bring similar code up to top level, and keep OS dependant code in OS
dependant files. DRY up code a bit.
2015-08-20 10:06:33 -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
Derek Parker
71845350a0 dlv/main: Add exec subcommand to debug existing binary
Added subcommand which takes a path to an existing binary, starts it,
and begins a debug session.
2015-08-19 18:01:47 -05:00
Derek Parker
32b499fa47 api/conversions: Do not shorten file paths
The shortening of file paths is purely a terminal UI concern. Move that
code to the presentation layer, and remove from the service layer.
2015-08-19 17:38:53 -05:00
Derek Parker
8d6bb4a1bb Add Go1.5 to travis list 2015-08-19 14:07:19 -05:00
Derek Parker
288e2036f6 proc/proc: Refactor next function 2015-08-18 14:48:41 -05:00
Derek Parker
e3e13dc672 service/debugger: Do not preserve temp breakpoints on restart 2015-08-17 19:27:29 -05:00
Derek Parker
326e65efbc Misc: Source code formatting 2015-08-17 08:19:04 -05:00
Derek Parker
f0afd41d94 terminal/command: Fix 'goroutine' command output 2015-08-17 08:11:00 -05:00
Derek Parker
066160f93e Bump to version 0.7.0-alpha & add CHANGELOG 2015-08-14 14:56:56 -05:00
Derek Parker
48f3db8216 Rename 'run' subcommand to 'debug'.
This renaming avoids confusion with the 'run' subcommand in the go tool.
The 'run' subcommand in Delve is now deprecated. It is still there,
however simply prints a deprecation notice and exits.
2015-08-14 14:52:04 -05:00
Tyler Bunnell
96dd44bd6e cmd/dlv: Add ability to connect to headless server
Fixes #201. Use to connect to a running headless server
2015-08-14 09:28:38 -05:00
Derek Parker
5d489bef99 terminal/command: Add "ls" alias for list command 2015-08-14 08:58:17 -05:00
Joe Shaw
bb95d534a6 terminal/command: add list command to display source
Without arguments, `list` displays source around the current context.  A
linespec argument can be taken to display source around that location.

Fixes #58
2015-08-14 08:51:31 -05:00
Derek Parker
e68e760a9f service/debugger: Remove newline at end of error 2015-08-13 18:19:16 -05:00
Derek Parker
12bd0472d2 Only make new process a group leader, not session
We're not dealing with a debugged process having its own controlling
terminal at this point, so no need to make the new process a session
leader. Simply making the process a group leader will suffice for our
purposes at the moment.
2015-08-13 18:18:42 -05:00
aarzilli
77d46a51fb Fix: Support for x.y versions 2015-08-12 09:30:47 -05:00