HaxeFoundation / HaxeFoundation/hxcpp
Debugger.THREAD_NOT_STOPPED / Debugger.NONEXISTENT_VALUE string comparisons
- Lingua principale
- C++
- Stelle
- 330
- Fork
- 227
- Merge medio
- 2g 16h
- PR unite (30g)
- 18
Descrizione
The Debugger implementation of THREAD_NOT_STOPPED / NONEXISTENT_VALUE makes us compare the returned value with a string for every result returned. This works fine normally, however the underlying cpp implementation calls `toString` on both values, which can fail with a stack overflow in the case of recursive objects.
I can easily make the debugger crash by trying to get the stack value of an object like:
```haxe
var obj:Dynamic = { a:10, b:null };
obj.b = obj;
```
After setting `obj.b` as `obj`, trying to get the stack value of this will consistently crash because of this string compare.
At first I thought about making an issue about `toString` sometimes crashing because of stack overflow - and I still think this is an issue - however it seems to me that using strings for these kinds of special values is not a great approach, as these values may occasionally (though I reckon rarely :) ) happen in user code, and value comparisons are always slower anyway. It seems to me that it would be both faster and easier to check for a specific control object (e.g. `static var THREAD_NOT_STOPPED = {};`) instead
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia con l’implementazione di Debugger di THREAD_NOT_STOPPED e NONEXISTENT_VALUE, quindi riproduci il problema usando l’oggetto Haxe ricorsivo mostrato nell’issue. Il lavoro è completato quando il recupero del suo valore dallo stack non va più in crash a causa della conversione in stringa ed entrambi i valori speciali rimangono distinguibili dai normali valori dell’utente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100