delve/pkg/proc
Alessandro Arzilli bf627d0f7d
proc: fix TestCondBreakpointWithFrame flakes on 1.22rc1 (#3624)
The flake manifests as an error where the variable i can not be found in
frame 1 and happens in go1.22rc1 between 0.1% and 0.5% of the time (it is highly dependent on CPU contention)
This problem is caused by the new code in evalop.PushLocal referencing the
stale value of SelectedGoroutine. This happens because:

-  evalop.PushLocal calls ConvertEvalScope
- ConvertEvalScope calls FindGoroutine
- FindGoroutine checks the value of selectedGoroutine

When breakpoint conditions are evaluated both the value of selectedGoroutine
and currentThread are stale because we can only set their definitive value
*after* all breakpoint conditions have been evaluated.

The fact that it only happens in 1.22rc1 is coincidental, it's probably
caused by the fact that 1.22rc1 migrates goroutines between threads more in
this particular circumstance.

This commit fixes the problem in two ways:

1. selectedGoroutine and currentThread are given temprorary non-stale values
   before breakpoint conditions are evaluated
2. evalop.PushLocal is changed so it takes a stack trace of the current
   thread rather than resolving it through the selected goroutine.

Either one would suffice however I think we should do both, (2) ensures that
the runtime.frame(n).var will work even if the current thread is not running
any goroutine and (1) ensures that we don't accidentally reference a stale
selectedGoroutine in the future.
2024-01-10 06:53:16 -08:00
..
amd64util all: remove obsolete build tags "// +build" (#3513) 2023-10-03 08:50:11 -07:00
core pkg,service/dap: use switch instead of ifs (#3576) 2023-11-22 09:07:08 -08:00
debuginfod debuginfod-find stderr may contain diagnostics; look at stdout only for filename (#3381) 2023-05-23 11:11:51 -07:00
evalop proc: allow evaluator to reference previous frames (#3534) 2023-10-24 18:57:39 +02:00
fbsdutil pkg/proc: fix and improve freebsd register handling (#3019) 2022-05-31 16:04:36 -07:00
gdbserial proc/gdbserial: refactor parsing of key-value pairs from gdb protocol (#3574) 2023-11-20 10:50:37 -08:00
internal/ebpf *: Correct spelling mistakes (#3555) 2023-11-06 07:55:44 -06:00
linutil pky/proc: enable function call injection in Delve for linux/ppc64le (#3449) 2023-09-21 10:39:57 -07:00
macutil all: remove obsolete build tags "// +build" (#3513) 2023-10-03 08:50:11 -07:00
native proc: fix TestIssue1101 flake (#3585) 2023-11-27 08:58:27 -08:00
test *: remove checks for TRAVIS env variable (#3568) 2023-11-16 10:42:41 -08:00
winutil pkg,service: remove unnecessary convertions (#3564) 2023-11-14 16:36:55 +01:00
amd64_arch.go proc: simplify and generalize runtime.mallocgc workaround (#3571) 2023-11-20 10:43:15 -08:00
amd64_disasm.go pkg/proc: apply simplifycompositelit analysis fixes (#3236) 2023-01-03 08:13:28 -08:00
arch.go proc: simplify and generalize runtime.mallocgc workaround (#3571) 2023-11-20 10:43:15 -08:00
arm64_arch.go proc: simplify and generalize runtime.mallocgc workaround (#3571) 2023-11-20 10:43:15 -08:00
arm64_disasm.go pkg,service: remove unnecessary convertions (#3564) 2023-11-14 16:36:55 +01:00
bininfo.go *: Use forked goretk/gore module (#3597) 2023-12-12 10:13:32 +01:00
breakpoints.go pkg,service: remove unnecessary convertions (#3564) 2023-11-14 16:36:55 +01:00
disasm.go pkg,service: remove unnecessary convertions (#3564) 2023-11-14 16:36:55 +01:00
doc.go *: run go1.19 'go fmt' on everything and fix problems (#3031) 2022-06-17 10:08:11 -07:00
dump.go *: add ppc64le support (#2963) 2023-07-07 09:30:38 -07:00
dwarf_export_test.go pkg/proc: pad variable mem in extractVarInfoFromEntry (#3365) 2023-05-15 14:46:33 -07:00
dwarf_expr_test.go pkg,service: remove unnecessary convertions (#3564) 2023-11-14 16:36:55 +01:00
eval.go proc: fix TestCondBreakpointWithFrame flakes on 1.22rc1 (#3624) 2024-01-10 06:53:16 -08:00
fncall.go proc: simplify and generalize runtime.mallocgc workaround (#3571) 2023-11-20 10:43:15 -08:00
goroutine_cache.go pkg/proc: enable basic debug functionality for stripped ELF binaries (#3408) 2023-06-14 13:23:46 +02:00
i386_arch.go proc: fix stacktraces on freebsd/amd64/go1.20 (#3458) 2023-08-14 15:32:15 -07:00
i386_disasm.go dwarf,proc: fix typos in comments and error messages (#3379) 2023-05-23 18:22:20 +02:00
interface.go proc: move StepInstruction method to TargetGroup (#3488) 2023-09-20 09:17:45 +02:00
mem.go pkg,service: remove unnecessary convertions (#3564) 2023-11-14 16:36:55 +01:00
moduledata.go proc: remove old method to resolve the type of an interface to a DIE (#3150) 2022-09-29 10:06:15 -07:00
pclntab.go pkg/proc: add inline function support for stripped binaries (#3549) 2023-11-03 10:00:49 +01:00
pe.go proc: fix typo 'unkown' => 'unknown' (#2473) 2021-05-10 11:36:03 -07:00
ppc64le_arch.go proc: simplify and generalize runtime.mallocgc workaround (#3571) 2023-11-20 10:43:15 -08:00
ppc64le_disasm.go *: update dependencies (#3552) 2023-11-04 17:07:55 +01:00
proc_amd64_test.go pkg/proc: unskip passing tests and reorganize (#3561) 2023-11-12 12:01:21 +01:00
proc_darwin_amd64_test.go pkg/proc: unskip passing tests and reorganize (#3561) 2023-11-12 12:01:21 +01:00
proc_darwin_test.go pkg/proc: unskip passing tests and reorganize (#3561) 2023-11-12 12:01:21 +01:00
proc_general_test.go pkg,service: remove unnecessary convertions (#3564) 2023-11-14 16:36:55 +01:00
proc_linux_test.go TeamCity: speed up ppc64le CI (#3622) 2024-01-09 14:13:00 -08:00
proc_test.go TeamCity: speed up ppc64le CI (#3622) 2024-01-09 14:13:00 -08:00
proc_unexported_test.go proc: correctly truncate the result of binary ops on integers (#2463) 2021-05-17 10:31:05 -07:00
proc_unix_test.go all: remove obsolete build tags "// +build" (#3513) 2023-10-03 08:50:11 -07:00
redirect.go pkg/proc,service/*: Supports sending output to clients when running programs remotely (#3253) 2023-07-05 08:39:01 -07:00
redirector_other.go all: remove obsolete build tags "// +build" (#3513) 2023-10-03 08:50:11 -07:00
redirector_windows.go pkg,service: Remove redundant build constraints (#3556) 2023-11-06 16:22:50 +01:00
registers.go proc: support function call injection on arm64 (#2996) 2022-05-03 10:46:24 -07:00
scope_test.go chore: use strings.Contains instead (#3562) 2023-11-14 10:16:39 +01:00
stack_sigtramp.go pkg,service: fix typos in comments, exceptions, tests (#3486) 2023-08-29 14:44:18 +02:00
stack.go pkg,service: remove unnecessary convertions (#3564) 2023-11-14 16:36:55 +01:00
stackwatch.go proc: when stepping set condition on thread ID if there is no curg (#3475) 2023-08-21 12:30:56 -07:00
target_exec.go proc: fix TestCondBreakpointWithFrame flakes on 1.22rc1 (#3624) 2024-01-10 06:53:16 -08:00
target_group.go proc: refactorings to implement follow-exec mode on Windows (#3441) 2023-08-28 12:46:19 -07:00
target.go pky/proc: enable function call injection in Delve for linux/ppc64le (#3449) 2023-09-21 10:39:57 -07:00
threads.go proc: move StepInstruction method to TargetGroup (#3488) 2023-09-20 09:17:45 +02:00
types.go pkg,service: remove unnecessary convertions (#3564) 2023-11-14 16:36:55 +01:00
variable_test.go proc,proc/native: adds ability to automatically debug child processes (#3165) 2023-02-22 09:26:28 -08:00
variables_fuzz_test.go proc: use stack machine to evaluate expressions (#3508) 2023-10-17 11:21:59 -07:00
variables_test.go proc: fix TestPackageRenames on go1.22 on linux/386 (#3610) 2023-12-26 10:17:25 -08:00
variables.go pkg,service: remove unnecessary convertions (#3564) 2023-11-14 16:36:55 +01:00
x86_disasm.go proc: remove duplicate Registers.Get implementations (#2415) 2021-04-28 10:00:26 -07:00