Commit Graph

2677 Commits

Author SHA1 Message Date
Oleksandr Redko
3ae22627df
*: replace old golang.org links with new go.dev (#3774) 2024-07-12 12:12:44 -07:00
Oleksandr Redko
c1c9feae3e
service/rpc1: add Go Reference doc (#3779) 2024-07-12 12:10:25 -07:00
Alessandro Arzilli
abad6bb97e
proc: use .closureptr for stepping through range-over-func statements (#3763)
* proc: use .closureptr for stepping through range-over-func statements

Uses special variables .closureptr and #yieldN to correctly identify
the parent frame of a range-over-func body closure call.

Updates #3733

* fix
2024-07-11 10:26:38 -07:00
Oleksandr Redko
b791f91c0e
pkg/dwarf/line: use t.Logf instead of fmt.Printf in tests (#3772) 2024-07-11 10:19:09 -07:00
Oleksandr Redko
ef13067401
pkg: refactor to buf.WriteString() (#3769) 2024-07-11 08:06:51 -07:00
Oleksandr Redko
a3e4a41468
pkg/terminal: add missing file.Close() call (#3770) 2024-07-11 08:06:16 -07:00
Alessandro Arzilli
a151be7eca
go.mod: update gopkg.in/yaml to v3 (#3776)
We are already importing v3 indirectly for github.com/spf13/cobra/doc,
update our own dependency to v3 as well so that we can delete one
module from the vendor directory.
2024-07-11 08:04:47 -07:00
Oleksandr Redko
d8003a74c8
pkg/proc: fix 404 links and change to https (#3775) 2024-07-11 08:03:32 -07:00
Oleksandr Redko
7a801c440b
*: remove redundant lines at the start/end of block (#3773) 2024-07-11 13:54:55 +02:00
杨杰
8e9607a53c
fix: LoadAbstractOriginAndSpecification infinite loop caused by abstract origin point to itself. (#3767) 2024-07-08 04:43:46 -07:00
Alessandro Arzilli
979e487ac7
service/debugger: evaluate breakpoint vars on g-less threads (#3759)
Use a thread scope to evaluate breakpoint variables if the current
thread does not have an associated goroutine.

Fixes #3758
2024-07-01 11:23:39 -07:00
Alessandro Arzilli
608eaa3d7c
proc: support stepping through range-over-func statements with inlining (#3755)
Extends support for stepping through range-over-func statement to
programs compiled with inlining enabled.

Updates #3733
2024-07-01 11:22:59 -07:00
Jayant
faac701e9f
fix: mem cache out of range panic caused by overflow (#3761) 2024-06-30 21:34:35 -07:00
Derek Parker
b9f50fe9b0
pkg/proc,service/debugger: fix debuginfod-find source (#3762)
Fixes bug where the incorrect Build ID could be used to try and download the source for a binary. This is because the Build ID was stored on the BinInfo object for a target and not the image itself.
2024-06-28 09:15:37 +02:00
Jayant
a4196f35a9
refactor: move loadModuleData from runtimeTypeToDIE and expose the apis (#3741) 2024-06-25 08:03:28 -07:00
Oleksandr Redko
a8293a36f5
all: fix typos in docs, comments and package name (#3757) 2024-06-25 15:16:58 +02:00
Oleksandr Redko
82ff628751
pkg/terminal: do not use deprecated strings.Title (#3756) 2024-06-25 13:15:07 +02:00
Alessandro Arzilli
ed2960b01c
proc: initial support for expressions with range-over-func (#3750)
Supports viewing local variables and evaluating expressions correctly
when range-over-func is used.
The same limitations that the previous commit on this line had still
apply (no inlining, wrong way to identify the range parent in some
cases).

Updates #3733
2024-06-24 13:04:06 -07:00
Oleksandr Redko
0d0d2e1b16
*: replace fmt.Errorf with errors.New (#3752) 2024-06-20 21:50:18 +02:00
Oleksandr Redko
7e753701d4
pkg/astutil,pkg/elfwriter: fix package doc (#3753) 2024-06-20 21:48:33 +02:00
Alessandro Arzilli
d673e04662
service: print better message for unattended stops (#3747)
Print a better message when an unattended stop happens for reasons
other than hitting a breakpoint.
2024-06-19 09:57:41 -07:00
Alessandro Arzilli
4b628b81cb
proc: refactor identifier evaluation for range-over-func support (#3738)
Because of how range-over-func is implemented it is difficult to
determine the set of visible local variables during expression
compilation (i.e. it is difficulto to keep the HasLocal function
correct).
This commit moves that logic from expression compilation to expression
evaluation.

Updates #3733
2024-06-14 14:36:11 -07:00
Alessandro Arzilli
cce54c0992
proc: fix TestRangeOverFuncNext (#3740)
Fix TestRangeOverFuncNext on non-linux operating systems, on arm64 and
when the build mode is PIE.
2024-06-14 14:32:34 -07:00
Alessandro Arzilli
06053a7e4b
proc: fix bug with stack watchpoints going out of scope (#3742)
When stack watchpoints go out of scope simultaneously they can hide (or
duplicate the effect) of other breakpoints (including other watchpoints
going out of scope) that are placed on the same physical memory
location.

This happens because we delete the watchpoint-out-of-scope breakpoint
while we are evaluating hit breakpoints, mangling the breaklets list.

This commit moves breakpoint deletion out of the
watchpoint-out-of-scope condition, delaying it until all hit
breakpoints have been evaluated.

Also fix bug where on amd64 if all four watchpoints are in use the last
one is not checked.

Fixes #3739
2024-06-12 12:37:04 -07:00
Archana Ravindar
89123a0000
pkg/terminal,service/debugger: Support to add a new suboption --follow-calls to trace subcommand (#3594)
* rebasing on master to implement --followcalls

* in progress changes to enable --followcalls

* rebase to master: modified function to add children to funcs array

* modify main traversal loop

* added tests to check different scenarios

* added tests to check different scenarios

* added tests to check different scenarios

* add test to check for overlapping regular expression

* modified type of strings array as a return only

* changed depth to a simple integer instead of a global map

* avoid calling traverse on recursive calls

* Added tests for various call graphs to test trace followfuncs

* Added tests for various call graphs to test trace followfuncs

* Added tests for various call graphs to test trace followfuncs

* made auxillary changes for build to go through for new option follow-calls

* Add support to print depth of the function calls as well

* Added two sample output files for checking

* Bypass morestack_noctxt in output for verification testing

* Corrected newline error by adding newlines only if the line does not match morestack_noctxt

* Added more tests

* Cleanup

* Updated documentation

* fixed error message in fmt.Errorf

* Fixed result of Errorf not used error

* Addressing review comments to fix depth reporting and other issues

* dont invoke stacktrace if tracefollowcalls is enabled, compute depth from main regex root symbol than main.main

* Addressing a part of review comments

* Added changes to allow deferred functions to be picked up for tracing

* Fix issue to avoid printing stack for a simple trace option

* Moving most tests to integration2_test.go and keeping only one in dlv_test.go

* Moving most tests to integration2_test.go and keeping only one in dlv_test.go

* Adding panic-defer test case

* Moved rest of the tests to integration2_test.go

* addressing review comments: folding Functions and FunctionsDeep, reducing branches by using depth prefix, wrap using %w and other comments

* Optimize traversal and parts of printing trace point function and modify trace output layout
and adjust tests accordingly

* Resolved error occurring due to staticcheck

* Implemented traversal algorithm using breadth first search

* Addressing review comments on the breadth first search implementation and
other comments

* Inline filterRuntimeFuncs and remove duplicate initialization
2024-06-12 12:35:48 -07:00
Fata Nugraha
15a9f9d353
cmd/dlv: print out message with stack trace when breakpoint is hit but has no waiting client (#3632)
* Print out message and dump stack on pause

* Fix test

* Move the logic to debugger layer

* Remove unused fields

* Do not use defer to get state

* move channel to connection

* remove lock on isClosed

* Use mutex

* Remove unwanted changes
2024-06-12 12:31:46 -07:00
Alessandro Arzilli
2ec2e831d6
proc: initial stepping with range-over-func support (#3736)
Initial support for stepping in functions that use the new
range-over-func statement in go1.23.
Does not support:

- inlining
- viewing variables of the enclosing function from a range-over-func
  body closure
- the correct way to find the enclosing function from a range-over-func
  body closure (but it should work most of the time).

Updates #3733
2024-06-04 12:52:30 -07:00
Alessandro Arzilli
40670aadc2
proc/gdbserial: add environment variables to configure rr invocation (#3726)
Adds two environment variables to configure rr invocations.

Fixes #3670
2024-05-24 11:33:23 -07:00
Abbas mkhzomi
35ebb085c5
*: update actions/checkout to v4 (#3731) 2024-05-22 16:17:41 -07:00
Oleksandr Redko
8347f97c00
*: remove redundant lines at the start/end of block (#3730) 2024-05-20 14:16:22 -07:00
Oleksandr Redko
468727c34d
pkg/terminal: remove deprecated starlark global options (#3722) 2024-05-20 08:35:30 -07:00
Alessandro Arzilli
7c7265f4e6
gdbserial: fixes for rr 5.7.0 (#3718)
The following fixes have been applied to make delve work with rr 5.7.0

- added a new launch prefix to exclude from stderr output
- allow the thread selection packet to be sent for 'c' commands even
  when the stub supports thread suffixes, because the specification is
  unclear over what should be done with bc and bs packets with thread
  suffixes.
- changed the way qRRCmd are escaped and added a thread selector to
  them to match changes to rr codebase
2024-05-16 16:07:20 -07:00
Alessandro Arzilli
2331fa8f8a
gdbserial: update path of lldb protocol extension documentation (#3727) 2024-05-15 11:45:53 -07:00
Derek Parker
4f28742da6
pkg/proc/gdbserial: optimize gdbwire backend (#3715)
This change optimizes the gdbwire backend by reducing the number of
round trips we have to make to debugserver. It does this by using the
jstopinfo packet to only query threads which we know to have a stop
reason, and it also uses the registers returned by the 'T' packet
to avoid issuing a bunch of 'p' packets to get the register values.
2024-05-15 09:48:38 +02:00
Alessandro Arzilli
b4fc206a7b
_scripts: upgrade to python3 (#3716)
Upgrade python script to python3
2024-05-08 10:30:57 -07:00
Derek Parker
bba7547156
pkg/proc: fix watchpoints on macos (#3703)
It seems newer MacOS kernels are sending mach exceptions for watchpoints
which contain the hardware register number as opposed to the address
which triggered the exception. Also, ARM64 seems to have switched to
sending _EXC_I386_SGL as medata[0] for this exception type.
2024-04-29 14:06:32 +02:00
Archana Ravindar
8c07c984e8
pkg/terminal: Add function name to return tracepoints (#3712) 2024-04-23 14:22:17 -07:00
John Howard
baf68e0e79
rr: fix gdb parsing (#3705)
* rr: fix gdb parsing

Attempt to fix https://github.com/go-delve/delve/issues/3704

* Fold into one branch
2024-04-19 10:38:01 -07:00
Alessandro Arzilli
64a46abd81
proc: generalize escapeCheck and allocString (#3687)
* proc: generalize escapeCheck and allocString

Generalizes the function for checking for escaping pointers so that it
can be used to iterate on all pointers of a variable.
Also generalizes the string allocation opcodes so that in the future we
can use it to call other special runtime functions (for example: map
access, channel send/receive, etc).

* review changes
2024-04-19 08:44:47 -07:00
Ville Skyttä
3f280259ad
cmd/dlv: improve positional argument completion (#3699)
Avoid default filename completions when not applicable.
2024-04-18 08:57:33 -07:00
Oleksandr Redko
95e2a57b92
pkg/terminal: remove duplicated word (#3707) 2024-04-18 08:56:52 -07:00
Derek Parker
6d3556784d
pkg/terminal: clear erroneous name setting on postfix if (#3702)
When a breakpoint was set on the current line via `break if i ==3` style
condition setting, we would erroneously set the breakpoint name to be
'if'.
2024-04-15 10:07:36 +02:00
Alessandro Arzilli
2e88b7ead3
tests: fix tests on Go 1.23 (#3697)
* Adjust rtype.go script to handle constants moved to internal/abi from
  runtime
* Remove tests in service/dap/server_test that relied on knowledge of
  the internal layout of channels.
2024-04-11 09:40:57 -07:00
Ville Skyttä
d7f104bf9c
cmd/dlv: fix panic on connect fail (#3698) 2024-04-11 07:12:42 +02:00
Ville Skyttä
2c946bcbd0
cmd/dlv: add shell (non-)completions to flags taking args (#3696)
Mostly to avoid the default filename completions to flags that don't
operate on filenames. Then again, mark ones that do explicitly as
such, and add more specific completions for a number of other cases,
too.
2024-04-09 11:04:55 -07:00
Alessandro Arzilli
fb430eac5e
proc: change 'step' command so that it steps through go statements (#3686)
Change 'step' command so that when stepping into a 'go statement' the
debugger will stop on the newly created goroutine, instead of just
stepping over the go statement.
2024-04-09 15:53:23 +02:00
Derek Parker
689c86355b
pkg/terminal: allow postfix if for breakpoint conds (#3693)
Allows for a user to specify the breakpoint condition directly
when creating the breakpoint. The new syntax looks like the
following:

```
break <name> <locspec> [if <expression>]
```

Also updates docs to include more examples and locspec description
instead of directing users to the online / source documentation.
2024-04-09 15:15:38 +02:00
Alessandro Arzilli
bbcea6b9f4
proc: support reading captured variables of closures (#3682)
Supports showing captured variables for function closures on versions
of Go that export informations about the closure struct (Go >= 1.23)

Fixes #3612
2024-04-07 21:36:50 -07:00
Derek Parker
6f1f549c71
pkg/proc: defend better against missing DWARF (#3695)
The `scope.Locals` function did not have any guard checks against missing DWARF information.
This patch adds a check, which likely will need to be added to other functions as well.
2024-04-05 11:46:39 +02:00
Alessandro Arzilli
bae4dfbc4c
proc,go.mod: update x/sys remove KeepAlive calls (#3680)
* Cirrus-CI: update to FreeBSD 13.3

* proc,go.mod: update x/sys remove KeepAlive calls

Update version of golang.org/x/sys to the latest version and remove
calls to runtime.KeepAlive calls that were added to the FreeBSD backend
to work around an issue in the version of x/sys that we were using.
2024-03-04 11:36:46 -08:00