HaxeFoundation / HaxeFoundation/hxcpp
Debugger.THREAD_NOT_STOPPED / Debugger.NONEXISTENT_VALUE string comparisons
- Dominant language
- C++
- Stars
- 330
- Forks
- 227
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 18
Description
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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.