what if i want to get the othe threads' stack #809
-
SDK have this api sentry_value_new_stacktrace( void **ips, size_t len). when the ips is null, it will get current thread stack. but what if i want to get the othe threads' stack. how can i make it ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @NikoLXQ! On which OS are you trying to do this? The general answer: In the crash case, our backends use OS-level debug capabilities to suspend all threads before snapshotting their stacks which can have racy consequences because it stops threads in uncoordinated moments. This is considered acceptable when the application is going to crash anyway, but a big issue in normal operation. |
Beta Was this translation helpful? Give feedback.
Hi @NikoLXQ! On which OS are you trying to do this?
The general answer:
sentry_value_new_stacktrace()
internally uses OS APIs that capture only the stack trace from the calling thread. This is because tracing the stack from another thread is not safe since that thread continues to run. Suspending and resuming threads are typically application-level responsibilities.In the crash case, our backends use OS-level debug capabilities to suspend all threads before snapshotting their stacks which can have racy consequences because it stops threads in uncoordinated moments. This is considered acceptable when the application is going to crash anyway, but a big issue in normal operation.