go-delve / delve

Delve is a debugger for the Go programming language.
MIT License
22.38k stars 2.13k forks source link

RR chaos mode #3670

Closed firelizzard18 closed 1 month ago

firelizzard18 commented 4 months ago

Please provide a way to pass the --chaos flag to the rr backend. Either by a dedicated flag such as --rr-chaos or as a general --rr-flags, --backend-flags, --backend-opts, etc.

$ rr record -h
 rr record [OPTION]... <exe> [exe-args]...
  [...]
  -h, --chaos                randomize scheduling decisions to try to 
                             reproduce bugs

Chaos mode is an extremely useful tool for reproducing weird bugs.

firelizzard18 commented 4 months ago

It looks like this https://github.com/go-delve/delve/blob/master/pkg/proc/gdbserial/rr.go#L144 line is where the arguments for rr record are constructed.

aarzilli commented 4 months ago

It looks like this https://github.com/go-delve/delve/blob/master/pkg/proc/gdbserial/rr.go#L144 line is where the arguments for rr record are constructed.

That's replay, record is above in RecordAsync.

firelizzard18 commented 4 months ago

🤦 of course

firelizzard18 commented 4 months ago

@aarzilli Would you accept a PR for this? Do you have a preferred flag name or other mechanism for setting the RR flag?

aarzilli commented 4 months ago

Do you have a preferred flag name or other mechanism for setting the RR flag?

That's the problem. The simple way to do this is to add a flag to debug, test and exec but that sucks, they already have too many flags and adding another one that only works when --backend is rr is ugly. The implementation is trivial.

dmvolod commented 4 months ago

I would prefer to have backend specific --backend-opts parameter to avoid confusion and, probably futher using for other backend.

For example, I can't use rr without --bind-to-cpu=0 option on my CPU and OS combination. Thanks in advance.

aarzilli commented 1 month ago

@firelizzard18 @dmvolod I have made a PR about this using environment variables: #3726

firelizzard18 commented 1 month ago

@aarzilli That works for me, I should be able to set those via VSCode so that takes care of my use case.