Commit Graph

1133 Commits

Author SHA1 Message Date
Alessandro Arzilli
def0688e7a
proc: step into coroutine (#3791)
The step command is changed such that when the function being currently
called is a coroutine switch function it will move to the associated
coroutine.
Functions that switch coroutines are currently the next, stop and yield
closures produced by the iter.Pull function.
2024-09-24 10:22:04 -07:00
Alessandro Arzilli
856ad78be0
*: release version 1.23.1 (#3816)
Thanks to @Jille, @linchizhen and @arvidfm.
2024-09-23 11:37:44 -07:00
Alessandro Arzilli
059f149433
proc: cache module data (#3800)
Cache module data so that we don't reload it every time we look up a
variable with a generic type.
2024-09-18 14:17:07 -07:00
Alessandro Arzilli
582305a813
proc: for optimized functions allow .closureptr to not exist (#3808)
* proc: flag variables correctly when range-over-func stmts are used

Argument variables of a range-over-func body closure should be returned
flagged as normal local variables, not as function arguments.

Updates #3806

* proc: for optimized functions allow .closureptr to not exist

For optimized functions .closureptr is sometimes omitted from DWARF,
allow it to be 0 and try to recover the range-over-func stack by best
effort.

Fixes #3806
2024-09-18 14:16:34 -07:00
Alessandro Arzilli
b9fadbae9b
proc: improve Rosetta check (#3810)
We have a check for Rosetta that should point users towards
misconfiguration, however occasionally we still get new issues about
debugserver crashing and some of those, as it turns out, are still
caused by Rosetta (see for example #3804).

Check the output of 'uname -m' and check that it isn't 'x86_64' if we
are an 'arm64' process: if that happens we are running unemulated but
debugserver will refuse to work.
2024-09-18 09:03:41 -07:00
Alessandro Arzilli
a63cc8a1a3
proc: fix result type of division of untyped constants (#3794)
The Go specification says that the result of division of untyped
constants should be an untyped integer constant if both constants are
untyped integers, the go/constant package however does something
different by always producing an untyped floating constant.

Fixes #3793
2024-09-05 09:23:21 +02:00
Alessandro Arzilli
162959baee
proc: workaround for macOS section name truncation (#3799)
Go 1.23 and earlier does not take into account that Mach-O section
names are limited to 16 characters, which causes DWARF sections with
long names to be truncated and become unreadable.

Fixes #3797
2024-09-03 10:39:27 -07:00
Arvid Fahlström Myrman
2abf517c21
terminal/starbind: fix starlark conversion of named consts (#3802)
* terminal/starbind: fix starlark conversion of named consts

If a value of a derived integer type matches a named constant,
Delve will wrap the string representation of the value with
the name of the constant, causing ParseInt/ParseUint to fail.
This change removes the wrapping before attempting to parse
the value before sending it to Starlark.

* terminal: add starlark tests for enums
2024-09-03 10:36:42 -07:00
Jille Timmermans
a164b89df1
eval: Allow reslicing a slice up to its cap, rather than its length (#3796)
fix a couple of places where we needed to track the cap
2024-08-28 11:41:23 -07:00
Alessandro Arzilli
a6849f2c7a
proc: fix TestRangeOverFuncNext on linux/386 (#3795)
TestRangeOverFuncNext and TestRangeOverFuncNextInlined are failing on
linux/386 with go1.23 due to an inconsistency on how append works on
32bit platforms.
2024-08-26 22:13:29 -07:00
Alessandro Arzilli
f2571fd46e
proc: fix step stuttering when entering range-over-func bodies (#3788)
Fixes a repeated stop on the first line of a range-over-func body when
stepping through a program. The entry point breakpoint is changed to a
special breakpoint that, when hit:

- clears the current temporary breakpoints
- sets breakpoints like 'next' would, and
- resumes execution.
2024-08-10 21:15:26 -07:00
Alessandro Arzilli
64f3d34663
proc: move stepping test to their own file (#3784)
Move all tests of the functionality of proc.next,
proc.(*TargetGroup).Next, proc.(*TargetGroup).Step,
proc.(*TargetGroup).StepOut to their own test file.
2024-07-19 21:29:56 -07:00
Alessandro Arzilli
56e9b85f40
*: release version 1.23.0 (#3782)
Thanks to @alexandear, @scop, @howardjohn, @archanaravindar, @abbasudo,
@fatanugraha, @jayantxie and @zdyj3170101136.
2024-07-16 11:44:48 -07:00
Alessandro Arzilli
eb0c6f89e2
goversion: add 1.23 to supported versions, update test matrix (#3780)
Add 1.23 to supported versions and to test matrix, remove 1.19 and 1.20
from supported versions (1.19 should have been removed long ago, but we
forgot to do it on release).
2024-07-15 14:43:03 -07:00
Alessandro Arzilli
c1366e90cc
proc: fix bug with range-over-func stepping (#3778)
Set a breakpoint on the return address of the current function, if it's
a range-over-func body, and clear the stepping breakpoints for the
current function (except the entry one) when its hit.

Without this what can happen is the following:

1. the range-over-func body finishes and returns to the iterator
2. the iterator calls back into the range-over-func body
3. a stepping breakpoint that's inside the prologue gets hit

Updates #3733
2024-07-14 21:27:47 -07:00
Oleksandr Redko
3ae22627df
*: replace old golang.org links with new go.dev (#3774) 2024-07-12 12:12:44 -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
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
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
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
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
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
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