The debugger command doesn't seem to work when using multiple threads at the same time.

Aperta
#1,027 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
ruby
Ambito
devtools

Direzione di ricerca

Start by running the reproduced Ruby program with require "debug", two threads, and debugger statements. Trace how the debugger handles simultaneous thread breakpoints and local-variable evaluation; the fix is complete when each breakpoint reports the matching local variable and continue resumes execution without hanging.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Your environment

  • ruby -v: 3.2.2
  • rdbg -v: 1.8.0

Describe the bug

Doesn't seem to work well with multithreaded debugger statements. The program does not print out expected local variables and seems to hang forever after last continue statement.

To Reproduce

Given the following ruby code:

require "debug"

thr1 = Thread.new {
  hello = "world"

  debugger

  puts hello
}


thr2 = Thread.new {
  hello = "hello"

  debugger

  puts hello
}

thr1.join
thr2.join

The first time I reach a breakpoint it shows me in the hello = "hello" block. When I type out hello though it than jumps me to hello = "world" block. After typing out hello a second time, it prints out the string "hello" instead of "world". If I type continue it hangs forever after that. If I run the program without the debugger statements it doesn't hang.

Expected behavior
I would expect debugger to be somewhat threadsafe. Obviously debugger cannot necessarily control the order of these two debuggers. The second debug statement may execute first but I'd expect that the breakpoint would match the local variable and I'd expect typing continue would than make the program keep running and go to the next debugger statement or terminate the program if no more debugger statements.

Lingua principale
Ruby
Stelle
1.3k
Fork
146
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ruby/debug

Tutte le issue di ruby/debug

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.