Thanks Gabriele -- this seems great for making crash reports more useful!

Can you provide guidance (or link to documentation) for how to locally test
a newly added annotation, to be sure it's working properly?  i.e. once I've
added an annotation, how might I go about generating a dummy crash report
so that I can make sure my annotation shows up?

Presumably I might add a `MOZ_CRASH("crashing");` to the relevant section
of code, and then I'd run my local build and crash, or something along
those lines -- but right now, my local build never gives me a reporter
dialog, including for a local opt build with `--enable-crashreporter`, so
I'm not entirely sure how to generate a crash report.

Is there another mozconfig flag I should be using?  (and, stepping back: is
it OK to submit crash reports from local builds for stuff like this, or is
there a preferred alternative approach you'd rather that folks use, if this
would be viewed as pollution of crash-stats?)

Thanks again,
~Daniel

On Mon, Mar 4, 2024 at 6:19 AM Gabriele Svelto <[email protected]> wrote:

> 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#883
>
> We 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
> .
>

-- 
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/CAN_rCTkqmfuWwtAriT3vdEw8EZG_nEXZOtMWTVsdrFrWR%3DrRCA%40mail.gmail.com.

Reply via email to