kstenerud / KSCrash

The Ultimate iOS Crash Reporter
MIT License
4.26k stars 712 forks source link

Add a callback after handling the crash #545

Closed tamwei closed 2 months ago

tamwei commented 3 months ago

Is it possible to add a callback here?

I tried kscrash_setReportWrittenCallback, but this callback is before ksmc_resumeEnvironment, so I want to ask if it is possible to provide a callback after ksmc_resumeEnvironment.

GLinnik21 commented 3 months ago

Hi! Interesting question. What are you trying to achieve with a callback after ksmc_resumeEnvironment? Are you facing any specific issues?

The current design ensures consistent process state for custom crash report additions. But I'm curious about your use case – maybe we can find a solution or consider an enhancement. Can you share more details?

tamwei commented 3 months ago

@GLinnik21 Hi, thanks for getting back to me.

Since we are going to migrate from PLcrashReporter to KSCrash, and the callback of PLcrashReporter is called after thread_resume(https://github.com/microsoft/plcrashreporter/blob/master/Source/PLCrashReporter.m#L232-L237). So I'm thinking that if KSCrash can also provide such a callBack, then we don't need to adjust the codes in the callback too much.

GLinnik21 commented 3 months ago

Thanks for providing that context. I'm curious – what specific functionality are you concerned might not work properly in the suspended environment with KSCrash? Are there particular operations or data you need to access that you think might be affected?

tamwei commented 3 months ago

Because I want to call a specific thread in the callback, but this thread is suspended at this time.

By the way, I have added the callback in the local repository and tested it after integration, it works fine.

GLinnik21 commented 3 months ago

By the way, I have added the callback in the local repository and tested it after integration, it works fine.

This is great that you have some work! Feel free to make a PR with what you need and then we can discuss further.

GLinnik21 commented 2 months ago

Since there's been no activity for 3 weeks, I'm closing this issue. Feel free to open a PR if you'd like to contribute this enhancement.