2991 Commits

Author SHA1 Message Date
cui
922470c995
proc: compile hit-condition regexp once (#4335)
parseHitCondition rebuilt the same regexp from a MustCompile literal on
every call. Move hitConditionRegex to package scope so the pattern is
compiled once at initialization while keeping parseHitCondition behavior
unchanged.
2026-05-04 13:13:02 -07:00
cui
b936c580be
proc: bail out of loadArrayValues after stride overflow (#4328)
Detecting uint overflow when computing Base+stride*count already sets
v.Unreadable, but execution continued into memory prefetch and element
loading with inconsistent state. Return immediately like other guard
clauses in this function.
2026-05-04 13:12:27 -07:00
cui
dcc40158dc
dwarf/reader: propagate errors during Reader entry iteration (#4327)
SeekToTypeNamed, FindEntryNamed, and NextMemberVariable used for loops
whose condition only tested entry != nil before running the body. When
Next or NextType returned a non-nil error with a nil entry, the loop
exited without inspecting err, returning not-found or nil instead of the
failure. Restructure iteration to always handle errors first.
2026-05-04 13:11:40 -07:00
cui
7a6b813d1b
proc: fix OR handling in breakpointConditionSatisfiable (#4325)
The token.OR branch required both operands to pass satisf recursively,
matching AND semantics incorrectly. Use logical disjunction so hit-count
fast paths treat disjunctive breakpoint conditions accurately.
2026-05-04 13:10:25 -07:00
cui
3e7fcd4e06
proc/internal/ebpf: fix AddressToOffset off-by-one at section load (#4324)
AddressToOffset compared virtual addresses with strict inequality against
each executable ELF section load address. PCs landing exactly on Section
.Addr were never matched while still within [Addr, Addr+Size).

Use inclusive lower bounds so the scan matches the usual VMA half-open
interval.
2026-05-04 13:09:14 -07:00
cui
129dde8de3
proc: propagate AddrPiece ReadMemory errors in composite memory (#4323)
newCompositeMemory ignored errors from MemoryReadWriter.ReadMemory when
building address-based DWARF fragments, so failed reads silently produced
zero-filled data. Return a wrapped error with size and address context,
consistent with RegPiece failures.
2026-05-04 13:08:02 -07:00
cui
46ca47a530
native: propagate PtraceGetRegs error on linux/ppc64le (#4322)
ptraceGetGRegs ignored the return value from sys.PtraceGetRegs, so
registers() never reported syscall failures when reading general purpose
registers. Assign the error and normalize syscall.Errno(0) to nil like
other ptrace helpers.
2026-05-04 13:06:29 -07:00
cui
087a500040
native: propagate PtraceSetRegs error on linux/ppc64le (#4321)
ptraceSetGRegs ignored the return value from sys.PtraceSetRegs, so
setPC and SetReg never reported syscall failures when writing general
purpose registers. Assign the error and normalize errno(0) to nil like
the rest of the ptrace helpers.
2026-05-04 13:05:56 -07:00
Álex Sáez
59d9aeee99
proc: fix SP calculation for sigpanic frames on arm64 (#4319)
* proc: fix SP calculation for sigpanic frames on arm64

Without this fix, stack traces from linux/arm64 core dumps showed SP
values that differed from the runtime's panic output.

Fixes #3591

* Update withCoreFile
2026-04-30 12:01:49 -07:00
Álex Sáez
1d5a7eb404
proc: implement frame pointer unwinding (#4288)
* Add BenchmarkStacktrace test

* proc: implement frame pointer unwinding

Add hybrid stack unwinding that attempts frame-pointer-based unwinding before falling back to DWARF.

* Rename useDWARF and change to funcToImage

* Update comment

Remove _fixtures/deeprecursion.go

* Add check of non-go code

* Fix ARM64 FP unwind false positives and Windows failures.
2026-04-28 11:19:03 -07:00
Álex Sáez
954ef88092
service/dap: avoid Session.conn race in breakpoint-after-disconnect test (#4317)
Fixes #4117
2026-04-27 14:27:41 -07:00
Alessandro Arzilli
b17676cac1
*: release version 1.26.3 (#4318)
Bugfix release mostly for #4311.
Thank you @purelualight, @croepha, @typesanitizer.
v1.26.3
2026-04-27 14:23:42 -07:00
Alessandro Arzilli
759115b580
dwarf/godwarf: fix regression debugging DWARFv5 on macOS (#4315)
The change introduced to fix #4302 happens to conflict with a similar
workaround in debug/macho I forgot exists.
The telemetry report was probably from a binary that legitimately did
not have a debug_line_str section (but referenced it) and we just
misidentified the cause, the fix however is still worth keeping since
there are versions of Go without the workaround that could be affected.

Fixes #4311
2026-04-23 13:16:07 -07:00
Archana Ravindar
29aa227c5c
pkg/proc: extend feature to print procedure parameters in trace on eBPF backend (#4305)
* Extend feature to print procedure parameters in trace on eBPF backend
Fixes #4266

* address review comments

* ran go fmt
2026-04-23 11:52:31 -07:00
Varun Gandhi
08ef5f3d75
pkg/proc: Fix flakiness in TestWaitFor (#4306)
TestWaitFor could have the following sequence of events:
1. cmd.Start() is called.
2. The process is started in the kernel.
3. CreateToolhelp32Snapshot (inside waitForSearchProcess) sees
   the process and returns from native.WaitFor.
4. The test immediately deferences cmd.Process, but cmd.Process
   has not been assigned yet in cmd.Start() -> nil panic.

This patch fixes the issue by introducing a channel that is
written to from testWaitForSetup() _after_ cmd.Start() returns.
Unlike the mutex + boolean, this channel can be waited upon
without spinning, and only then cmd.Process is read inside
the test code.
2026-04-23 11:49:00 -07:00
David Butler
c9ed7c0b23
cmd/dlv: use goversion.ParseProducer for DW_AT_producer (#4307) 2026-04-23 11:48:25 -07:00
LuaLighter
c4280281d2
chore: fix typos(#4316)
Signed-off-by: purelualight <purelualight@outlook.com>
2026-04-23 11:47:50 -07:00
chuanshanjida
0c15a4835a
chore: fix function name in comment to match actual function (#4310)
Signed-off-by: chuanshanjida <chuanshanjida@outlook.com>
2026-04-21 14:23:45 +02:00
Alessandro Arzilli
3c840a562b
*: release version 1.26.2 (#4309)
Thank you @BrotifyPacha, @cuiweixie, @archanaravindar, @typesanitizer
v1.26.2
2026-04-20 07:31:55 -07:00
Alessandro Arzilli
73abedc367
dwarf/godwarf: work around Mach-O section name limitation (#4304)
Mach-O limits the names of sections to the first 16 characters, this
truncates the names of some DWARFv5 sections, meaning we can't find
them by simply calling debug/macho.(*File).Section. Work around this
limitation by looking for a section with the truncated name.

Fixes a panic while parsing DWARFv5 debug_line header on macOS when
DW_FORM_line_strp is used.

Fixes #4302
2026-04-14 09:38:34 -07:00
Archana Ravindar
464e62a0aa
cmd/dlv: support varying verbosity levels with trace subcommand (#4251)
* First draft implementation to print procedure parameters in trace

* Added code to propagate verbosity flag to terminal side also and
modified tests for expected output

* make output of function return consistent with function call for verbose level=0

* Regenerate Documentation file

* addressed review comments

* Making output at verbosity level 0 consistent with default output and
other comments

* regenerate Documentation file

* Addressed more review comments and refactored code based on recent commit
on pretty print API

* static check build error

* addressed review comment and removed superflous function

* fixed comment, and ran go fmt

* removed incorrect nomenclature from comments

* Add validation tests for traces with verbosity levels

* Correct output format for some types

* Remove TraceVerbosity from breakpoint and keep it in the terminal to
use it only for formatting

* Correct TraceVerbose tests to assert on output incl. formatting just like other trace tests

* remove leftorver t.Logf

* Cleaned up code, renamed trace-verbose to verbose and -V to -v
2026-04-08 10:27:38 -07:00
Derek Parker
0b686c36d0
proc/internal/ebpf,build: extend eBPF tracing type support (#4285)
* proc/internal/ebpf,build: extend eBPF tracing type support and update Docker build

Add support for additional Go types in the eBPF tracing backend:

- Bool: use BoolType with ByteSize 1 instead of IntType with ByteSize 8
- Int/Uint: use actual DWARF size instead of hardcoded ByteSize 8
- Float32/Float64: synthesize FloatType, detect XMM registers as unreadable
- Complex64/Complex128: synthesize ComplexType with XMM detection
- Pointer: capture pointer address and dereference pointed-to value via
  bpf_probe_read_user in eBPF C code
- Slice: capture slice header (ptr+len+cap) and dereference element data
- Graceful degradation: map, chan, interface, func, struct, and array
  types now produce specific "not yet supported" errors instead of
  generic "type not supported by ebpf"

Add Unreadable field to RawUProbeParam so the Go-side parser can
propagate specific error messages through to Variable display.

Update eBPF build infrastructure:
- Replace EOL Ubuntu 21.04 base image with Ubuntu 22.04
- Use clang-12 (required: newer clang generates BPF code that fails
  the kernel verifier with "dereference of modified ctx ptr disallowed")
- Update Go from 1.17 to 1.24
- Remove sudo requirement from build-ebpf-builder-img.sh
- Add -u flag to Docker run to avoid root-owned output files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* dwarf/godwarf,proc: fix slice ReflectKind and address PR review feedback

Fix a bug in the DWARF type parser where SliceType.ReflectKind was not
set (stayed 0/reflect.Invalid). When parsing struct types, the code
creates a new StructType, sets ReflectKind on it, then for slices
creates a new SliceType and reassigns the pointer — losing the
ReflectKind. The String case already had an explicit fix for this
(str.ReflectKind = reflect.String), but the Slice case was missing it.

This caused the eBPF tracing backend (which uses dt.Common().ReflectKind
to determine type kind) to see kind=0 for slice parameters, making them
appear as unsupported types. The ptrace backend was unaffected because it
uses Go type assertions (case *godwarf.SliceType) instead of ReflectKind.

Also addresses PR review feedback:
- Add t.Parallel() to TestTraceEBPFTypes subtests
- Use regexp matching for pointer/slice address verification
- Add content verification for slice test output
- Add comment explaining -u flag in build-ebpf-objects.sh
- Add comment explaining amd64-only XMM register threshold
- Handle CreateCompositeMemory errors in target.go
- Remove debug prints from target.go

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: document eBPF type support pipeline and TestTraceEBPFTypes

Add documentation for the eBPF type support pipeline, currently
supported types, the canonical test (TestTraceEBPFTypes) for adding
new type support, and the clang-12 build constraint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* proc/internal/ebpf: clarify pointer/slice comments per review

Clarify that the eBPF probe does capture dereferenced data, but
loadValue runs Go-side after the probe returns and cannot follow
pointer chains through fake memory addresses. Also remove unicode
arrow from XMM register comment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* proc/internal/ebpf: clarify pointer/slice deref_val limitations

Explain why we display raw addresses instead of dereferenced values:
element type info isn't propagated through the eBPF pipeline, and
deref_val is limited to 48 bytes which is insufficient for nested
or variable-length types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* address review feedback

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 09:27:35 +01:00
Weixie Cui
dbe5a7810a gobuild: fix gocommandRun stdout and stderr streams
The go subprocess had Stdout and Stderr assigned to the wrong OS
streams, so normal build output went to stderr and errors to stdout.
2026-03-26 08:41:35 +01:00
aarzilli
b37872a6db pkg/terminal,service: add TypeInfo API
Add an API to retrieve type information and make the 'whatis' command
accept a type name and print what we know about it.

Fixes #2249
2026-03-26 08:41:03 +01:00
Alessandro Arzilli
2a508e536d
service/dap: support data breakpoints (#4294)
Add data breakpoint support to the DAP server, corresponding to our watchpoints.

Fixes #4153
2026-03-25 10:51:37 -07:00
Varun Gandhi
0355633b29
pkg/proc: Fix flaky test on Windows (#4292)
TestWaitFor was flaky on Windows. This seems to be linked to
prefix-based matching, where the fixture process spawned by
one test could be waited upon by another test. Adding a
unique no-op argument to different invocations of the
same fixture binary appears to fix the flakiness issue.
2026-03-25 10:42:21 -07:00
cui
160c32bef1
proc: fix stack watch breaklet index for recorded replay (#4295)
* proc: fix stack watch breaklet index for recorded replay

When adding the extra WatchOutOfScope breakpoint at the CALL before the
return PC, the code used len(retbp.Breaklets) to index into retbp2.Breaklets.
If the return address already had other breaklets (e.g. a user breakpoint),
that index could be out of range.

Add TestWatchpointStackRecordedOutOfScopeBreakletIndex (runs with -backend=rr)
to cover this path.

* fix: review
2026-03-25 10:42:01 -07:00
cui
f7be04f153
native: return ptrace error from riscv64 setSP (#4298)
setSP ignored the error from ptraceSetGRegs and always returned nil,
so callers could not detect failures when updating the stack pointer.
2026-03-25 10:40:54 -07:00
cui
a8e6978c26
proc: clear stepping breakpoints on every target in TargetGroup (#4299)
ClearSteppingBreakpoints returned after the first target with stepping
breakpoints, so other targets in the group were never cleared.
2026-03-25 10:40:23 -07:00
Alessandro Arzilli
d355ae4a8e
service/dap,terminal: cover more cases in examinemem command (#4300)
Cover some cases that were not handled by the implementation. Also in
the version of the code in DAP use the proc.Variable directly, avoiding
the roundtrip through a string.
2026-03-25 10:39:37 -07:00
cui
1f83848a4c
dwarf/op: fix DW_OP_shr and DW_OP_shra evaluation (#4296)
* dwarf/op: fix DW_OP_shr and DW_OP_shra evaluation

DW_OP_shr must perform a logical right shift (zero-fill) and DW_OP_shra an
arithmetic right shift (sign-extend). The two cases were swapped, so
negative values were wrong for location expressions.

Add a regression test that exercises both opcodes with a negative value.

* add,space,trigger ci

* revert

* Update go.mod

* Update go.mod
2026-03-25 10:38:54 -07:00
Pavel
d3cb0508b8
dap/command: port examinemem from dlv/terminal (#4289) 2026-03-24 10:45:47 -07:00
Alessandro Arzilli
28c9219ffa
service/dap_test: remove dlv help test (#4290)
This test is overly specific and only ever breaks if someone adds a
command.
2026-03-19 09:12:17 -07:00
Alessandro Arzilli
1c2321ee24
service/dap: add build message (#4287)
This is a second attempt at #3207, which was abandoned.
Prints a build message before starting the build so that the user knows
why the debug session is taking time to start.
The whole command line is not printed, it can be seen by adding the
appropriate logging options already.

Fixes #3173
2026-03-16 10:10:46 -07:00
Alessandro Arzilli
1a49553f3d
pkg/terminal,pkg/config: add ability to configure Delve's prompt (#4284)
Fixes #4001
2026-03-15 08:47:14 -07:00
Alessandro Arzilli
aea4d000da
_scripts: fallback to calling go if goreleaser is not installed (#4286) 2026-03-15 08:46:24 -07:00
Alessandro Arzilli
5ca401718d
config,terminal: better documentation for configuration file (#4282)
Provide an online documentation for the configuration file parameters
and the 'config' command.
Until now the configuration parameters were only documented in the
default configuration file and in the source code, neither of which is
very discoverable.
2026-03-10 12:34:56 -07:00
Alessandro Arzilli
a0db15838e
service/dap: set seq number for response messages (#4280)
The DAP specification says that messages sent from the server to the
client should have a seq number but we never did do that because the
original DAP extension didn't.
Add sequence numbers, even though it doesn't seem to cause problems in
practice, to conform to the protocol specification.

Fixes #2245
2026-03-10 12:34:27 -07:00
Derek Parker
814b09c165 build: allow release workflow to be manually triggered against a tag
Add a 'tag' input to the workflow_dispatch trigger so releases can be
re-run or initiated manually for a specific tag. The checkout step uses
the provided tag, and GORELEASER_CURRENT_TAG is set so goreleaser picks
up the correct version. A validation step ensures non-dry-run releases
require a tag.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 11:30:18 +01:00
Alessandro Arzilli
ea13840996
pkg/proc,service,pkg/terminal: add stacktrace caching (#4277)
Adds caching to stacktraces so that stacktrace requests are not
quadratic. Also add a Skip parameter to the Stacktrace RPC request so
that clients can only request the frames they need.

Fixes #3809
Fixes #989
2026-03-09 10:23:11 -07:00
Derek Parker
25e1565230
build: add goreleaser release automation with cosign signing (#4278)
Adds goreleaser-based release automation integrated with GitHub Releases.

On pushing a v* tag, the release workflow cross-compiles dlv for 8
platforms (linux/darwin/windows × amd64/arm64/386/ppc64le where
supported), packages them as .tar.gz/.zip archives, generates a SHA256
checksums file, signs checksums.txt with cosign keyless signing via
GitHub Actions OIDC, and publishes everything to GitHub Releases.

A workflow_dispatch trigger supports dry-run testing without publishing.

Changes:
- .goreleaser.yaml: goreleaser v2 config for builds, archives,
  checksums, cosign signing, and GitHub Release publishing
- .github/workflows/release.yml: release workflow with tag push and
  manual dispatch triggers
- _scripts/make.go: make build now delegates to goreleaser
  --single-target so local and release builds share identical config
- Documentation/installation/README.md: document binary release
  download and cosign verification
- CONTRIBUTING.md: document goreleaser v2 as a build prerequisite

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 17:24:42 +01:00
Alessandro Arzilli
5435acac91
dwarf/line: fix PrologueEndPC and FirstStmt (#4276)
In some circumstances PrologueEndPC and FirstStmt could return a PC
that is before the start PC that was passed to them.

It is not certain that this is what caused the crash in the issue
because it couldn't be reproduced with a real Go binary, but it looks
like the only possible cause.

Fix #4269
2026-03-05 09:58:44 -08:00
Derek Parker
ad2756669a
service/dap,pkg/proc: fix misc test failures (#4273)
* service/dap,proc: tolerate debuginfod events in tests

When debuginfod is available on the system (e.g. Fedora), asynchronous
"Download debug info" output events can arrive during DAP sessions and
EventBinaryInfoDownload events can appear in the proc event stream.
Tests were not expecting these and would fail.

Fix the DAP test client to skip debuginfod download output events in
ExpectMessage, and fix TestBreakpointMaterializedEvent to search for the
materialized event rather than assuming it is the first event.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* proc: fix test failures with Go 1.27 (gotip)

TestClassicMap: replace panic with t.Skip since the noswissmap
GOEXPERIMENT was removed in Go 1.27.

TestRangeOverFuncNextInlined: extend skip to all Go >= 1.24. The
inlined range-over-func symbol name issue (#3882) still requires a
compiler fix that has not landed in 1.27.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* cmd/dlv: skip TestStaticcheck on development versions of Go

Staticcheck output depends on the Go version used to build it. When
running against a development version (e.g. gotip), the output will
not match the checked-in baseline, causing spurious failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 09:34:20 +01:00
Derek Parker
5a5f35e158
*: v1.26.1 (#4272) v1.26.1 2026-03-03 20:01:07 +01:00
Varun Gandhi
093f1eba60
proc: Remove special-casing for 1.23 in tests (#4271)
go.mod specifies 1.24, so it's not possible to compile the
tests with Go toolchains <= 1.23 anyway. It doesn't make
sense to skip certain tests for older toolchains, because
attempting to use old toolchains will fail at build time.
2026-03-03 09:36:12 -08:00
Alessandro Arzilli
368a2ef33d
pkg/proc/debuginfod: fix debuginfod download progress (#4270)
debuginfod-find broke the documented way to get progress information:

https://sourceware.org/bugzilla/show_bug.cgi?id=33937

Restore this functionality by using the --verbose flag instead.
2026-03-02 12:10:18 -08:00
Alessandro Arzilli
9ae271905e
pkg/terminal/starbind: remove some duplicate code (#4262)
introduce helper type starlarkUnhashable to avoid several duplicate
method definitions.
2026-02-27 10:40:37 -08:00
Alessandro Arzilli
b1b1faabd0
service/dap: better error messages when we can't launch the debugger (#4264)
Users of vscode-go can sometimes be confused as to how they invoked the
debugger, add what we are trying to launch to the error message.

Fixes #4229
2026-02-27 10:40:00 -08:00
Derek Parker
50c3bbcb93
proc: support debugging stripped non-Go binaries (#4263)
* proc: support debugging non-Go binaries that dlopen Go shared libraries

Add support for debugging non-Go stub binaries that dynamically load Go
shared libraries via dlopen or other dynamic linkage modes. When the
initial binary has no Go runtime symbols or DWARF info, Delve now marks
it as non-Go and defers Go-specific initialization. A breakpoint on the
dynamic linker's _dl_debug_state function detects shared library loads,
allowing Delve to pick up Go debug info when a Go .so is loaded at
runtime.

* proc: address PR review feedback for non-Go binary debugging

- Deduplicate auxv parsing by extracting searchAuxv helper
- Rename IsNonGo to IsGo (positive flag is easier to reason about)
- Move Go image detection into loadDebugInfoMaps to avoid reparsing
  debug_info; uses DW_AT_language == DW_LANG_Go which is already
  checked there for cu.isgo
- Remove hasGoProducer function (no longer needed)
- Remove pkg/proc import from pkg/terminal/command.go; use string
  literal for stop reason comparison instead
- Update CLAUDE.md with DWARF parsing and layer boundary guidance

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 15:05:11 +01:00
nil
5565574ae8
Update README.md (#4265) 2026-02-21 12:07:57 +01:00