Error when getting thread stack trace

I created StackTrace utility that print stack trace of given thread without stopping it.

It has workaround that prevent Thread is inappropriate state error. Why it is needed? There are some bug in Haiku or I am doing something wrong? Also sometimes StackTrace cause to open crash dialog and if open Debugger is selected, thread is in debugged state (not exception) and can be continued. Why it happens?

2 Likes

That error appears to come from here: https://xref.landonf.org/source/xref/haiku/src/system/kernel/debug/user_debugger.cpp#1628

1 Like

It seems that waiting for B_DEBUGGER_MESSAGE_THREAD_DEBUGGED debug message is needed. I added debug message loop and issue is no longer observed (https://github.com/X547/HaikuUtils/blob/master/StackTrace/StackTrace.cpp#L155).