-
-
Notifications
You must be signed in to change notification settings - Fork 201
Description
Description
Hi thanks for the lib! I wonder how can I fill in the stacktrace? Currently when I report an error manually, it only has exception messages. But as we know, stack traces are very important to debug!
In addition, I do see automatic stack traces when an unexpected exception happens. Thus I guess sentry should have an api like get_the_current_stack_trace_as_sentry_data_structures() ;)
I have tried to use the following:
sentry_value_t event = sentry_value_new_event();
sentry_value_set_by_key(event, "exception", exception_obj);
sentry_event_value_add_stacktrace(event, nullptr, 0);
sentry_capture_event(event);
but then error occurs:
2021-03-26 09:47:05.010 6468-6733/com.cjy.yplusplus E/Sentry: An exception occurred while processing event by processor: io.sentry.android.core.DefaultAndroidEventProcessor
java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference
at io.sentry.android.core.util.MainThreadChecker.isMainThread(MainThreadChecker.java:40)
at io.sentry.android.core.DefaultAndroidEventProcessor.processNonCachedEvent(DefaultAndroidEventProcessor.java:213)
at io.sentry.android.core.DefaultAndroidEventProcessor.process(DefaultAndroidEventProcessor.java:143)
at io.sentry.SentryClient.processEvent(SentryClient.java:185)
at io.sentry.SentryClient.captureEvent(SentryClient.java:76)
at io.sentry.Hub.captureEvent(Hub.java:82)
at io.sentry.Sentry.captureEvent(Sentry.java:254)
at io.sentry.HubAdapter.captureEvent(HubAdapter.java:27)
at io.sentry.OutboxSender.processEnvelope(OutboxSender.java:141)
at io.sentry.OutboxSender.processFile(OutboxSender.java:68)
at io.sentry.OutboxSender.processEnvelopeFile(OutboxSender.java:101)
at io.sentry.android.core.EnvelopeFileObserver.onEvent(EnvelopeFileObserver.java:59)
at android.os.FileObserver$ObserverThread.onEvent(FileObserver.java:163)
at android.os.FileObserver$ObserverThread.observe(Native Method)
at android.os.FileObserver$ObserverThread.run(FileObserver.java:113)
Ok here is my hack:
sentry_value_t threads = sentry_value_get_by_key(event, "threads");
sentry_value_t values = sentry_value_get_by_key(threads, "values");
sentry_value_t thread = sentry_value_get_by_index(values, 0);
sentry_value_set_by_key(thread, "id", sentry_value_new_int32(-1));
but it still does not work. now no errors, but no stacktraces.
the output of sentry_value_to_json(event):
{"event_id":"9aabc52f-2ece-439d-f46e-3206346ba765","timestamp":"2021-03-26T02:28:09.814Z","exception":{"values":[{"type":"Exception","value":"cv_error_callback see error status=-215 func_name=debug_throw_exception err_msg=1 == 0 file_name=/Users/tom/QAPMain/Development/rzzsdxx_frontend/vision_utils/ios/Classes/basic_vision_utils.cpp line=190"}]},"threads":{"values":[{"stacktrace":{"frames":[{"instruction_addr":"0x71e6806698"},{"instruction_addr":"0x71aaf8e0a8"},{"instruction_addr":"0x71ab1369cc"},{"instruction_addr":"0x71ab136f90"},{"instruction_addr":"0x71aaf8d980"},{"instruction_addr":"0x71aaf8d44c"},{"instruction_addr":"0x71c5415cc4"},{"instruction_addr":"0x71c5418548"}]},"id":999}]}
but the website:
Therefore, what I want: Can we fill in Stack trace when manually capturing an exception? (Just like what happens when auto captured)? Now there is only instruction addresses - no things like function names, etc!
When does the problem happen
- During build
- During run-time
- When capturing a hard crash
Environment
- OS: [e.g. Windows 10, 64-bit] android
- Compiler: [e.g. MSVC 19] android ndk compiler
- CMake version and config: [e.g. 3.17.2, SENTRY_BACKEND=inproc]
Steps To Reproduce
Log output
N/A
