Commit Graph

1158 Commits

Author SHA1 Message Date
Alessandro Arzilli
477e46ebbd
pkg/proc: support swiss table map implementation (#3838)
Adds support for the swiss table implementation for Go's maps.
2024-12-04 19:14:47 -08:00
Alessandro Arzilli
698f838616
terminal/starbind: allow modification of structs returned by API (#3872)
Structs returned to starlark scripts by API calls were immutable, this
made amend_breakpoint nearly impossible to use since its argument must
be a api.Breakpoint struct which the caller has received from
get_breakpoint and modified.
2024-12-04 19:09:59 -08:00
Alessandro Arzilli
d97b471292
pkg/proc,service/debugger: do not disable unsatisfiable breakpoints (#3868)
Previously breakpoints with hitcount conditions that became
unsatisfiable
would become disabled, this was done as an optimization so that the
continue loop would no longer need to stop on them and evaluate their
conditions.
As a side effect this meant that on restart these breakpoints would
remain disabled, even though their hit condition returned satisfiable.

This commit changes Delve behavior so that breakpoints with
unsatisifiable hitcount conditions are no longer disabled but the
associated physical breakpoints are removed anyway, preserving the
optimization.

Some refactoring is done to the way conditions are represented and the
enable status is managed so that in the future it will be possible to
use hitcount conditions to implement "chained" breakpoints (also known
as dependet breakpoints), i.e. breakpoints that become active only
after a second breakpoint has been hit.
2024-12-04 19:07:56 -08:00
Alessandro Arzilli
7b9a379e59
proc: allow accessing captured variable as if they were struct fields (#3866)
If 'a' is a captured variable in a function pointer called 'f' let
'f.a' evaluate to its value.
2024-12-02 11:20:51 -08:00
Alessandro Arzilli
5d82dc10dc
proc: fix issue on Windows when launching process while detached (#3867)
When the Delve instance is running in a detached state and it launches
a process an additional child conhost.exe process will be created, we
should detach from it.

Fixes #3864
2024-11-26 11:45:46 -08:00
Alessandro Arzilli
5c12831340
proc/core/minidump: remove newlines from minidump logs (#3869)
They are redundant.
2024-11-26 11:44:46 -08:00
Alessandro Arzilli
e0c80c8612
pkg/proc/native,pkg/proc/amd64util: xsave decoding cleanup (#3840)
- move the cpuid querying code to pkg/proc/native/cpuid since
  pkg/proc/native is the only package entitled to calling it
- add a type to describe the xstate_bv bitmap instead of using
  hardcoded constants everywhere
- use xcr0 instead of xstate_bv for the offset heuristic like gdb does
2024-11-21 13:06:51 +01:00
Oleksandr Redko
091e5535ab
all: remove redundant err declarations (#3855) 2024-11-12 08:04:22 -08:00
Oleksandr Redko
b4cfc8f6c7
tests: calling os.Exit in TestMain is not required (#3856) 2024-11-12 08:03:50 -08:00
Alessandro Arzilli
b16e12fde7
proc: do not ignore error return of funcCallEvalFuncExpr (#3850)
This is probably the cause of the panic such as in issue #3848 and
other similar issues, it is hard to be sure because we never get a
proper reproducer but judging from the stack traces it should be this.
Also it doesn't affect versions of Go that have the debug pinner.

Fixes #3848
2024-11-06 10:27:44 -08:00
Oleksandr Redko
6b2ed0d684
proc: fix typos in errors and comments (#3852) 2024-11-06 15:15:48 +01:00
Oleksandr Redko
844712a30b
proc: run gofmt (#3851) 2024-11-06 15:15:14 +01:00
Alessandro Arzilli
e9616a7f98
proc: fix rangeFuncStackTrace with inlined functions (#3849)
If an inlined function is encountered we should keep searching for its
rangeParent even if we don't have a closurePtr because it could be that
the function has been inlined into its rangeParent.

This does not need a new test, the existing tests already fail on
go1.24.
2024-11-04 08:21:40 -08:00
Alessandro Arzilli
822014b8e8
service,terminal,cmd/dlv: automatically guessing substitute-path config (#3781)
Add command, API calls and launch.json option to automatically guess
substitute-path configuration.
2024-10-31 10:19:08 -07:00
Alessandro Arzilli
1748f5f3d1
TeamCity: move riscv64 backend testing to tip (#3842)
Updates #3832
2024-10-28 11:38:01 -07:00
Chen
bef326c6a5
proc: use CPUID to determine ZMM_Hi256 region offset (#3831)
The offset of state component i can be found via
CPUID.(EAX=0DH,ECX=i):EBX. The ZMM_Hi256 is state component 6, so we use
CPUID to enumerate the offset instead of hardcoding.

For core dumps, we guess the ZMM_Hi256 offset based on xcr0 and the
length of xsave region. The logic comes from binutils-gdb.

Fixes #3827.
2024-10-21 09:16:57 -07:00
Alessandro Arzilli
423644e288
Documentation: fix autogenerated markdown documentation (#3836)
Changes < to &lt; in autogenerated documentation for CLI commands so that markdown does not interpret them as HTML tags.

Supersedes #3830
Fixes #3829
2024-10-21 09:15:44 -07:00
Alessandro Arzilli
1a9bd03d7a
goversion: parse version for development builds (#3837)
Once upon a time Go version strings for development builds did not
reference the major/minor version they belonged to, therefore the best
we could do was to always assume that a development build belonged to
the most recently released version of Go.

This commit changes pkg/goversion so that the new style of development
version string is fully parsed.
2024-10-21 09:15:02 -07:00
Alessandro Arzilli
064ef226ca
pkg/proc/core: Clean up some repetitive code (#3834)
Cleans up repetitive code in pkg/proc/core and also adds coredumpctl
support to our test suite.
2024-10-21 09:12:34 -07:00
Alessandro Arzilli
05dc760877
*: mark riscv64 port as experimental (#3835)
Delete non-working prologue detection code and mark port as experimental.

Updates #3832
2024-10-14 11:04:03 -07:00
lrzlin
75c41f2b64
delve: add linux-riscv64 support (#3785) 2024-10-11 12:34:25 -07:00
Alessandro Arzilli
025d47c6e9
proc: adds pointer pinning to call injection (#3787)
This commit adds a new mode to call injection. If the runtime.debugPinner
function is available in the target executable it obtains a pinner by
calling it and then uses it to pin the pointers in the results of call
injection.

This allows the code for call injection to be refactored to execute the
calls in the normal order, since it doesn't need to be concerned with having
space on the target's memory to store intermediate values.

Updates #3310
2024-10-04 10:44:57 -07:00
Alessandro Arzilli
52405ba86b
terminal,service: add raw examinemem dump (#3721)
Change the examinemem command to have a new format 'raw' that just
prints the raw memory bytes.
Change the transcript command to add a new flag that disables prompt
echo to the output file.

Fixes #3706
2024-10-03 14:09:38 -07:00
Alessandro Arzilli
a3d7712752
*: replace uses of uniq with slices.Compact (#3821) 2024-10-01 10:16:49 -07:00
Oleksandr Redko
8c645a32d7
pkg/proc: simplify tests by using errors.As (#3818) 2024-10-01 08:54:11 -07:00
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