On 04/03/24 14:07, Marco Bonardo wrote:
This is great news Gabriele.If I'd like to register an annotation only when we crash in a specific scope (my use case is recording if a sanitized SQL query was running at crash time), do you suggest I just set and unset the registered variable, or is there also a way to unregister a variable?
You can always unregister an annotation, irrespective of if you've used CrashReporter::RecordAnnotation<Type>() or RegisterAnnotation<Type>(). E.g. you could have a code block like:
{
uint32_t stuff_i_want_to_record = 0;
CrashReporter::RegisterAnnotationU32(Annotation::Stuff,
&stuff_i_want_to_record);
...
CrashReporter::UnregisterAnnotation(Annotation::Stuff);
}
This will incur in the cost of register/unregistering the annotation
every time you enter the scope. Alternatively you could use the
`skip_if` feature in the crash annotations list. If you know that your
annotation should be disregarded if it has a certain value you can put
it in the annotations list and it will be automatically skipped when it
matches that value.
See this as an example: https://searchfox.org/mozilla-central/rev/202c48686136360a23b73a49b611a19e64f3e1b8/toolkit/crashreporter/CrashAnnotations.yaml#883We always record the amount of textures we're using, but if the value is zero the annotation gets skipped.
Last but not least, we'll auto-skip the annotation for string pointer types if the pointed-to strings are empty or NULL (though I might not have surfaced all the string-related methods in C++ yet; the functionality is in a Rust crate that's wrapped in the crash reporter code).
Gabriele -- You received this message because you are subscribed to the Google Groups "[email protected]" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/5c7557db-65ec-4b4c-ac54-a72ada176ce4%40mozilla.com.
OpenPGP_signature.asc
Description: OpenPGP digital signature
