Comments (8)
It keeps happening - any clues on how to debug it would be helpful.
from delve.
Are you hitting ^Z while the program you are debugging is running or at delve's prompt?
If you look at the output of ps what does it say about dlv?
Can you use delve to attach to the stuck dlv process and see what it's doing?
from delve.
^Z while in dlv
ps auxw | grep dlv
thockin 3468313 1.5 0.1 6322216 83956 pts/0 Tl+ 15:07 0:00 dlv debug ./staging/src/k8s.io/code-generator/cmd/defaulter-gen -- --v 5 --logtostderr -h hack/boilerplate/boilerplate.generatego.txt -O zz_generated.defaults -i ./cmd/kubeadm/app/apis/kubeadm/v1beta3 -i ./cmd/kubeadm/app/apis/kubeadm/v1beta4 -i ./pkg/apis/abac/v1beta1 -i ./pkg/apis/admission/v1
$ dlv attach 3468313
Could not attach to pid 3468313: this could be caused by a kernel security setting, try writing "0" to /proc/sys/kernel/yama/ptrace_scope
sudo ~thockin/go/bin/dlv attach 3468313
Type 'help' for list of commands.
(dlv) grs
Goroutine 1 - User: /home/thockin/go/pkg/mod/github.com/go-delve/[email protected]/input.go:140 github.com/go-delve/liner.(*State).readNext (0x9537be) [select]
Goroutine 2 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [force gc (idle) 1631637529423568]
Goroutine 3 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [GC sweep wait]
Goroutine 4 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [GC scavenge wait]
Goroutine 5 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [finalizer wait 1631637529423568]
Goroutine 6 - User: /home/thockin/go/pkg/mod/github.com/go-delve/[email protected]/pkg/proc/native/proc.go:400 github.com/go-delve/delve/pkg/proc/native.(*ptraceThread).handlePtraceFuncs (0x892457) [chan receive]
Goroutine 7 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
Goroutine 13 - User: /home/thockin/sdk/gotip/src/net/pipe.go:159 net.(*pipe).read (0x565a35) [select]
Goroutine 15 - User: /home/thockin/sdk/gotip/src/runtime/internal/syscall/syscall_linux.go:38 syscall.RawSyscall6 (0x407ced) (thread 3468317)
Goroutine 18 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
Goroutine 19 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
Goroutine 20 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
Goroutine 21 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [select 1631637748260353]
Goroutine 34 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
Goroutine 35 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
Goroutine 51 - User: /home/thockin/sdk/gotip/src/net/pipe.go:159 net.(*pipe).read (0x565a35) [select]
Goroutine 53 - User: /home/thockin/sdk/gotip/src/runtime/sigqueue.go:152 os/signal.signal_recv (0x46f929) (thread 3468319)
Goroutine 55 - User: /home/thockin/go/pkg/mod/github.com/go-delve/[email protected]/pkg/terminal/terminal.go:186 github.com/go-delve/delve/pkg/terminal.(*Term).sigintGuard (0x99f4bd) [chan receive 1631637748260353]
[18 goroutines]
Here's my config, in case it matters:
(dlv) config -list
aliases map[display:[disp] down:[do] help:[?]]
substitute-path []
max-string-len 256
max-array-values 4
max-variable-recurse 2
disassemble-flavor <not defined>
show-location-expr false
source-list-line-color "\x1b[0;33m"
source-list-arrow-color "\x1b[1;36m"
source-list-keyword-color "\x1b[0;34m"
source-list-string-color "\x1b[0;35m"
source-list-number-color "\x1b[0;32m"
source-list-comment-color "\x1b[0;36m"
source-list-tab-color "\x1b[2;37m"
source-list-line-count 10
debug-info-directories [/usr/lib/debug/.build-id]
position ""
tab "... "
trace-show-timestamp false
It seems to happen 100% now for me, but when I sud dlv attach
'ed I could ^Z ok.
from delve.
The 'T' status looks fine, it means dlv did suspend in response to the signal. What's not good is the '+', at that point the shell should take over the terminal. What's the environment here: shell, terminal, any terminal multiplexes involved, ssh, is any of this being started by a script?
from delve.
from delve.
hah, that does seem to trigger it. I admit I don't know enough about how the terminal SHOULD react to say if this is right or not. I tested by putting vi
in a script and ^Zing that works how I would expect (the whole shell suspends).
$ cat vi.sh
#!/bin/sh
echo before
vi "$@"
echo after
$ echo $SHLVL
1
$ sh vi.sh /tmp/a
before
<vi loaded, I hit ^Z>
[1]+ Stopped sh vi.sh /tmp/a
$ echo $SHLVL
1
$ fg
<vi reloaded, I exited>
sh vi.sh /tmp/a
after
Is that a fair analog? I think so but not 100% sure.
from delve.
We're sending SIGTSTP to ourselves when we should be sending it to our process group. The workaround for this should be to have an actual exec in the script (exec dlv debug ...
)
from delve.
Yes, exec fixes the problem for now. Thanks for digging in.
from delve.
Related Issues (20)
- panic when delve process is stopped HOT 1
- support for Termux debugger with the Android
- How build arm version HOT 1
- Support `dlv types` from DAP (the same way `types` is supported in the command line `dlv` REPL)
- polish go1.23 range-over-func UX HOT 1
- Does delve ignore // line instructions during debug HOT 1
- Breakpoints do not work in packages with a TestMain(*testing.M) function HOT 1
- Unable to print a package string const value during a breakpoint HOT 1
- Error clearing stack watchpoint HOT 2
- Add defer functions to follow-calls tracing option
- Breakpoint line numbers not matching HOT 1
- Hitting compile error when launching delve in devbox HOT 4
- `undefined behavior - version of Delve is too old for Go version 1.22.3 (maximum supported version 1.20)` HOT 2
- trace: allow tracing from (or skip tracing on) G-less threads
- panic when data length is greater than memCache size
- Unable to find escape variables when using Delve HOT 7
- Fail to set watchpoint after clearing one of four HOT 3
- Dwarf parsing infinite loop causes OOM HOT 1
- Feature request: restart the current function HOT 6
- Seeing a warning that delve is too old for the latest Go version 1.22.5 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delve.