* service/test: fix compile error in tests
Due to a merge conflict the tests in service/test are not compiling.
* proc: add support for struct literals
Adds support for evaluating struct literals, and allocating them into
the target's memory.
Updates #1465
Expose breakpoint hitcounts in the expression language through the
special variable runtime.bphitcount:
delve.bphitcount[1]
delve.bphitcount["bpname"]
will evaluate respectively to the hitcount of breakpoint with id == 1
and to the hitcount of the breakpoint named "bpname".
This is intended to be used in breakpoint conditions and allows
breakpoints to be chained such that one breakpoint is only hit after a
different is hit first.
A few optimizations are implemented so that chained breakpoints are
evaluated efficiently.
Adds support for setting a watchpoint on an interface by setting
the watchpoint on the data pointer in the eface/iface runtime
structs representing the interface.
Previously we relied on availability of the thread suffix protocol
extension to determine whether we should use the old or new encoding
for the qRRCmd extension of rr. Newly released version 5.9.0 of rr
removes this ability by not reporting the thread suffix extension as
available unless it gets to start lldb itself.
Use the value of rr's version instead.
Fixes#3920
* deduplicates exprToString, defined in multiple packages, and moves it
to astutil
* moves resolveTypedef into pkg/dwarf/godwarf, this is currently only
used by pkg/proc but we will need to call it from pkg/proc/evalop
* creates a new FakePointerType function in pkg/dwarf/godwarf, this is
also a function that is only used by pkg/proc but pkg/proc/evalop will
also need.
Updates #1465
After a call injection sequence terminates allow the evaluator to
access thread registers again so that variables stored in registers can
be used as arguments.
Fixes#3310
* delve: support linux-loong64 native debug
LoongArch is a new RISC ISA, which is independently designed by Loongson Technology.
LoongArch includes a reduced 32-bit version (LA32R), a standard 32-bit version (LA32S)
and a 64-bit version (LA64), and loong64 is the 64-bit version of LoongArch.
LoongArch documentation: https://github.com/loongson/LoongArch-Documentation.git
* *: mark loong64 port as experimental
---------
Co-authored-by: Huang Qiqi <huangqiqi@loongson.cn>
When creating a stack trace, if we make no progress with the normal
thread stack switch to the goroutine stack before giving up. This
improves stacktraces on the main thread of minidumps created on Windows
by WER.
Fixes#3824
The update of gilium/ebpf introduced a beaking change in it's API: The `offset` in the UprobeOptions is now relative to the added option `address`. Since `address` was only default initalized, the library did not use `address` and `offset` as address for the uprobe, but tried to calculate the offset itself based on the given symbol. Since we set the path of the executable as symbol, the library errored when trying to resolve it.
Fixes https://github.com/go-delve/delve/pull/3491
Add go1.24 to compatibility set and test matrix.
Remove go1.21 from test matrix.
TestRangeOverFuncNextInlined is disabled because the improved inlining
of go1.24 produces symbol names that are too complicated for us to
correlate, a fix for this will require a change to the compiler that
will probably be too complex to make it into 1.24.
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.
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
- 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
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
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.
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.
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.
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
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.
* 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