Commit Graph

1695 Commits

Author SHA1 Message Date
chainhelen
bd6a8e56d5 pkg/proc/core: add error details when reading spliced memory (#1701)
The origin error message is confusing, so add some details.

Fixes #1700
2019-10-07 09:33:16 -07:00
Alessandro Arzilli
3d0bd515d8 service/debugger: make Disassemble work without a selected goroutine (#1704)
The Disassemble API call should work when there is no selected
goroutine (for example because the program was just started).

Fixes #1703
2019-10-07 09:32:38 -07:00
Cody Kaup
75a1bc032a Documentation: Bump required Go version (#1708) 2019-10-07 09:23:06 -07:00
Alessandro Arzilli
e1e2a1fabb tests: fix TestGeneratedDoc (#1709)
It was failing silently.
2019-10-07 09:20:49 -07:00
chainhelen
a82e6d6987 pkg/proc: fix can not call method of an embedded filed directly (#1691)
`func (v *Variable) findMethod` should support for searching methods of an
embedded filed.

Fixes #1688
2019-09-26 07:37:23 -07:00
Alessandro Arzilli
4905cff3c8 proc: allow calls to optimized functions (#1684)
Trust argument order to determine argument frame layout when calling
functions, this allows calling optimized functions and removes the
special cases for runtime.mallocgc.

Fixes #1589
2019-09-25 10:23:02 -07:00
Alessandro Arzilli
efd628616b proc: add options to bypass smart stacktraces (#1686)
Add options to start a stacktrace from the values saved in the
runtime.g struct as well as a way to disable the stackSwitch logic and
just get a normal stacktrace.
2019-09-25 10:21:20 -07:00
Alessandro Arzilli
e994047355 proc: correctly mark closure variables as shadowed (#1674)
If a closure captures a variable but also defines a variable of the
same name in its root scope the shadowed flag would, sometimes, not be
appropriately applied to the captured variable.

This change:

1. sorts the variable list by depth *and* declaration line, so that
closure captured variables always appear before other root-scope
variables, regardless of the order used by the compiler

2. marks variable with the same name as shadowed even if there is only
one scope at play.

This fixes the problem but as a side effect:

1. programs compiled with Go prior to version 1.9 will have the
shadowed flag applied arbitrarily (previously the shadowed flag was not
applied at all)
2. programs compiled with Go prior to versoin 1.11 will still exhibit
the bug, as they do not have DeclLine information.

Fixes #1672
2019-09-15 11:40:35 -07:00
Alessandro Arzilli
223eb4cb5f travis: bump continuous integration to 1.13 (#1693)
Bump continuous integration to include Go 1.13, drop 1.10 from
compatiblity file.
2019-09-15 11:37:07 -07:00
chainhelen
58a7c84e01 scripts: Add 'make uninstall' command
This change adds the `make uninstall` command which will uninstall delve.
2019-09-13 11:17:28 +02:00
chainhelen
69e6b613d8 pkg/dwarf/frame/parser: Fix parse augmentation (#1679)
According to the description of "CIE: length, CIE_id, version, augmentation"
in Page 122 of  http://dwarfstd.org/doc/Dwarf3.pdf ,
`augmentation` should exclude `version`
2019-09-04 09:02:24 -07:00
Heschi Kreinick
8954858ee8 proc: round TLS segment size to its alignment (#1682)
The fix for #1428 was buggy, partly because I communicated poorly. Sorry
about that.

The size of the TLS segment should be padded such that TLS addresses
are congruent in the file to where they will end up memory, i.e.
(tlsoffset%align) == (vaddr%align). In most cases, vaddr will be aligned
and it won't matter, but if not then simply aligning the end of the
segment is incorrect. This should be right.

(For the record, the current rounding logic is working in bits, but
PtrSize is in bytes, so it wasn't working as originally intended
either.)
2019-09-04 09:01:53 -07:00
Derek Parker
dd3c2d63cc
all: Version 1.3.0 (#1680)
* all: Bump to v1.3.0

Add new version to CHANGELOG and update internal version.

Thank you @Ladicle, @qaisjp, @justinclift, @tschundler, @two,
@dpapastamos, @qingyunha, @rayrapetyan, @briandealwis and @msaf1980,
@jeremyfaller, @stmuk, @dr2chase, @pjot726.

* all: Add date to changelog
2019-08-27 14:40:41 -07:00
Alessandro Arzilli
0c36cfb9b1 dwarf/line: implement missing DW_LNS_set_isa opcode (#1676) 2019-08-27 14:27:14 -07:00
Alessandro Arzilli
a3e884e55c proc: discard variables with address 0 in disassembly sym lookup (#1668)
They are irrelevant and confusing.
2019-08-14 08:58:27 -07:00
Alessandro Arzilli
327fbdbd44 tests: remove duplicate code (#1669) 2019-08-14 08:57:05 -07:00
Alessandro Arzilli
4779218a83 proc/gdbserial: reset thread updater in step loop (#1665)
threadUpdater needs to be reset before every possible use.

Fixes #1659
2019-08-13 11:14:47 -07:00
pjot726
a621034bcf Edited to fix issue #1071 (#1664) 2019-08-13 11:13:56 -07:00
David Chase
440aa31bc6 proc: add *Function.PrologueEndPC to support optargorder tool (#1663)
Intent here is to bring optargorder up to date with delve
and keep it in sync (and to use optargorder to help monitor
compiler output for debugging quality regressions).
2019-08-13 11:13:28 -07:00
Alessandro Arzilli
3b0c886598 proc: next/step/stepout restarts thread from wrong instruction (#1657)
proc.Next and proc.Step will call, after setting their temp
breakpoints, curthread.SetCurrentBreakpoint. This is intended to find
if one of the newly created breakpoints happens to be at the same
instruction that curthread is stopped at.
However SetCurrentBreakpoint is intended to be called after a Continue
and StepInstruction operation so it will also detect if curthread is
stopped one byte after a breakpoint.
If the instruction immediately preceeding the current instruction of
curthread happens to:
 1. have one of the newly created temp breakpoints
 2. be one byte long
SetCurrentBreakpoint will believe that we just hit that breakpoint and
therefore the instruction should be repeated, and thus rewind the PC of
curthread by 1.

We should distinguish between the two uses of SetCurrentBreakpoint and
disable the check for "just hit" breakpoints when inappropriate.

Fixes #1656
2019-08-12 15:11:19 -07:00
David Chase
ecc62a0f3a dwarf/line: add some detail to unknown opcode messages (#1662) 2019-08-12 15:10:01 -07:00
Alessandro Arzilli
c441330822 proc: remove (*EvalScope).globalFor (#1658) 2019-08-11 13:56:16 -07:00
Derek Parker
f0a9031969 pkg/proc: Move EvalScope methods, cleanup others
Moves EvalScope methods to the proper file and organizes everything
together. Also makes some EvalScope methods no longer methods and just
pure functions.
2019-08-10 14:03:12 +02:00
Derek Parker
094915e4aa pkg/proc: Drop state from BinaryInfo
Remove `initialized` member in favor of just deriving the information it
represented.
2019-08-10 14:03:12 +02:00
Derek Parker
b87813e177 pkg/proc: Remove extra struct members in BinaryInfo 2019-08-10 14:03:12 +02:00
Derek Parker
1b9ae4188d pkg/proc: Consolidate BinaryInfo/Image methods
The methods for the BinaryInfo and Image structs were spread around in
multiple files. This patch just brings them all under one file.
2019-08-10 14:03:12 +02:00
Derek Parker
9963458d77 pkg/proc: Refactor Disassemble 2019-08-10 14:03:12 +02:00
Derek Parker
583d335ffe pkg/proc: Untangle Arch from G struct
More untangling. Arch doesn't actually need to know anything about a
Goroutine.
2019-08-09 18:15:44 +02:00
Derek Parker
2de4930ad1 pkg/proc: Avoid passing BinaryInfo when not needed
This is going towards untangling proc in order to clean it up.
2019-08-09 18:15:44 +02:00
Derek Parker
a3d530bbd4 pkg/proc: Refactor AMD64 struct
Cleanup some unused members.
2019-08-09 18:15:44 +02:00
Alessandro Arzilli
c9c455cc38 cmd/dlv: actually disable C compiler optimizations when building (#1647)
* proc: fix stacktraces when a SIGSEGV happens during a cgo call

When a SIGSEGV happens in a cgo call (for example as a result of
dereferencing a NULL pointer) the stack layout will look like this:

(system stack) runtime.fatalthrow
(system stack) runtime.throw
(system stack) runtime.sigpanic
(system stack) offending C function
... other C functions...
(system stack) runtime.asmcgocall
(goroutine stack) call inside cgo

The code in switchStack would switch directly from the
runtime.fatalthrow frame to the first frame in the goroutine stack,
hiding important information.

Disable this switch for runtime.fatalthrow and reintroduce the check
for runtime.mstart that existed before this version of the code was
implemented in commit 7bec20.

This problem was reported in comment:
https://github.com/go-delve/delve/issues/935#issuecomment-512182533

* cmd/dlv: actually disable C compiler optimizations when building
2019-08-01 16:31:50 -07:00
Alessandro Arzilli
2bd1cd3fa7 Documentation,cmd/dlv: tidy up --help output (#1649)
* scripts: use relative path in gen-cli-docs.go

Makes gen-cli-docs.go work outside GOPATH.

* Documentation,cmd/dlv: tidy up --help output

The description of --log-dest, --log-output and --backend is very
verbose and messes up the output of --help, move it to two "additional
help" subcommands.
2019-08-01 16:28:37 -07:00
Steve Mynott
282b3e052b terminal: alias stepout to so (#1646)
* alias stepout to so

* run gen-cli-docs.go to update cli/README.md
2019-07-31 13:09:20 -07:00
Alessandro Arzilli
67b6d4b9c9 travis-ci: fix dwz test problems (#1648)
For some reason the version of dwz in Travis-CI now fails to run on Go
binaries. Ignore the particular error.
2019-07-31 13:09:00 -07:00
Derek Parker
f4eaad69d9
*: Add .cirrus.yml for FreeBSD testing (#1639)
* *: Add .cirrus.yml for FreeBSD testing

* *: run go mod tidy

* service/test: prefer 127.0.0.1 over localhost

* dwarf/line: fix TestDebugLinePrologueParser

* vendor: rerun go mod vendor
2019-07-30 08:38:25 -07:00
Jeremy Faller
1a478cdb53 terminal/command: add support for next [count] (#1629)
* terminal/command: add support for next [count]

* disallow negative counts.

* handle github comments, and regen docs.

* Fix the fact that we don't print the file info in the last step of the next count.

* Fix a typo, cleanup a few other observations.
2019-07-29 18:04:26 -07:00
Alessandro Arzilli
dc3fca3f7b service: add backend to GetVersion response (#1641)
Implements #1640
2019-07-27 16:44:48 -07:00
Alessandro Arzilli
7bcb9ace88 Documentation: mention DevToolsSecurity in documentation (macOS) (#1638) 2019-07-26 11:32:29 -07:00
Alessandro Arzilli
b65882a588 proc: ignore DW_TAG_inlined_subroutine entries without abstract origin (#1637)
GCC produces DW_TAG_inlined_subroutine entries without a
DW_AT_abstract_origin attribute.
From the bug report:

 <1><1fe6c7c>: Abbrev Number: 41 (DW_TAG_subprogram)
    <1fe6c7d>   DW_AT_external    : 1
    <1fe6c7d>   DW_AT_name        : (indirect string, offset: 0x485814): MultiGetImpl
    (omissis)
 <2><1fe6c9e>: Abbrev Number: 65 (DW_TAG_inlined_subroutine)
    <1fe6c9f>   DW_AT_low_pc      : 0x311023a
    <1fe6ca7>   DW_AT_high_pc     : 0x5
    <1fe6caf>   DW_AT_call_file   : 10
    <1fe6cb0>   DW_AT_call_line   : 1690
 <2><1fe6cb2>: Abbrev Number: 20 (DW_TAG_inlined_subroutine)
    <1fe6cb3>   DW_AT_abstract_origin: <0x1ffb534>
    <1fe6cb7>   DW_AT_entry_pc    : 0x311023f
    <1fe6cbf>   DW_AT_ranges      : 0xe9bf20
    <1fe6cc3>   DW_AT_call_file   : 10
    <1fe6cc4>   DW_AT_call_line   : 1690

Inlined subroutine at 1fe6c9e doesn't have abstract origin, a name or a
declaration location. It's unclear whether this is in-standard and what
it even means.

Let's ignore it.

Fixes #1636
2019-07-26 11:24:35 -07:00
Alessandro Arzilli
dcc1030d18 gdbserial: propagate signals to target while stepping (#1624)
Propagate signals when stepping because debugserver will report them,
from the issue:

2019-07-11T16:31:25+02:00 debug layer=gdbconn <- $z0,105525d,1#c9
2019-07-11T16:31:25+02:00 debug layer=gdbconn -> $OK#00
2019-07-11T16:31:25+02:00 debug layer=gdbconn <- $vCont;s:c41c3#50
2019-07-11T16:31:25+02:00 debug layer=gdbconn -> $T1cthread:c41c3;threads:c41c3,c41d7,c41d8,c41d9,c41da;thread-pcs:105525d,7fffc464bf46,7fffc464bbf2,7fffc464bbf2,7fffc46...
2019-07-11T16:31:25+02:00 debug layer=gdbconn <- $Z0,105525d,1#a9
2019-07-11T16:31:25+02:00 debug layer=gdbconn -> $OK#00

in this case we request a single step on thread c41c3 but debugserver
reports instead a signal (in this case SIGWINCH).

Fixes #1610
2019-07-23 14:42:21 -07:00
Michail Safronov
89d2167c31 pkg/config: add max-variable-recurse parameter (#1626)
* add max-variable-recurse parameter
2019-07-23 14:40:35 -07:00
Brian de Alwis
cb65877297 cmd/dlv: add --continue to continue process on launch/attach (#1585)
* Add --continue to continue process on launch/attach

* Add small test of --continue

* regenerate usage docs

* minor cleanup

* Use similar approach to `trace` and connect and detach using a client instance

* back out previous attempt

* regen usage doc

* fix up continue test

* fix TestContinue to properly test --continue

* back out unnecessary changes

* update faq
2019-07-19 10:59:38 -07:00
Brian de Alwis
f67239f302 terminal: prompt to kill remote if process exited (#1621) 2019-07-17 15:54:15 -07:00
Alessandro Arzilli
7d25f6eb97 proc/native/linux: call postExit when process is killed by SIGINT (#1622)
If we return ErrProcessExited we should also set exited to true.
2019-07-17 15:52:28 -07:00
Alessandro Arzilli
acc9f24a5b go.mod: add Go version to go.mod (#1623)
Go 1.13 insists on adding a go version to go.mod, add one that makes
sense.
2019-07-17 15:51:39 -07:00
Alessandro Arzilli
29a058ee7e proc: flag variables that have a 'fake' address (#1619)
Add variables flag to mark variables that are allocated on a register
(and have no address) and variables that we read as result of a
function call (and are allocated on a stack that no longer exists when
we show them to the user).
2019-07-16 13:12:16 -07:00
Alessandro Arzilli
158fb7bfac proc: increase maximum string length when loading string for binary ops (#1620)
Increases the maximum string length from 64 to 1MB when loading strings
for a binary operator, also delays the loading until it's necessary.

This ensures that comparison between strings will always succeed in
reasonable situations.

Fixes #1615
2019-07-16 13:11:35 -07:00
Robert Ayrapetyan
df65be43ae *: FreeBSD initial support (#1480)
* FreeBSD initial support

* first code review fixes

* regs slice upd

* execPtraceFunc wrap

* disabled concurrency tests
fixed kill() issue

* disabled concurrency tests
fixed kill() issue

* cleanup vendor related code

* cleanup ptrace calls

* vendoring latest changes

* Revert "vendoring latest changes"

This reverts commit 833cb87b

* vendoring latest changes

* requested changes
2019-07-12 18:28:04 -07:00
qingyunha
114b76aefc terminal: Add breakpoint autocompletion (#183) (#1612) 2019-07-12 10:43:42 -07:00
Derek Parker
86ed5b66a1 pkg/terminal: Use new starlark CallFrame API 2019-07-09 08:54:15 +02:00