mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
d0e4d2c6c2
This patch rolls up all the required changes for this purpose. Since the whole crash reporting flow must understand the new format it's not possible to land this as separate patches as individually they would be broken. This patch includes the following changes: * Changes to the crash reporting machinery to write out annotations as JSON, these includes changes to the DLL blocklist code that must be run at crash time. * Modifications to the crash reporter client so that it can read and submit the new format; this includes platform-specific changes to the Breakpad libraries it uses for submitting crashes. * Modifications to the minidump-analyzer to understand and process the new format correctly. * Modifications to the crash manager to understand and process the new format correctly. * Modifications to GeckoView's crash handler to understand and submit the new format correctly. * Added new tests to cover the new format and modified existing ones to accomodate the new one. Differential Revision: https://phabricator.services.mozilla.com/D46848 --HG-- extra : moz-landing-system : lando
87 lines
2.5 KiB
C
87 lines
2.5 KiB
C
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef CrashAnnotations_h
|
|
#define CrashAnnotations_h
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
namespace CrashReporter {
|
|
|
|
// Typed enum representing all crash annotations
|
|
enum class Annotation : uint32_t {
|
|
${enum}
|
|
};
|
|
|
|
// Stringified crash annotation names
|
|
const char* const kAnnotationStrings[] = {
|
|
${strings}
|
|
};
|
|
|
|
// Whitelist of crash annotations that can be included in a crash ping
|
|
const Annotation kCrashPingWhitelist[] = {
|
|
${whitelist}
|
|
};
|
|
|
|
// Blacklist of crash annotations that shouldn't be read from a content process
|
|
const Annotation kContentProcessBlacklist[] = {
|
|
${blacklist}
|
|
};
|
|
|
|
/**
|
|
* Return the string representation of a crash annotation.
|
|
*
|
|
* @param aAnnotation a crash annotation
|
|
* @returns A constant string holding the annotation name
|
|
*/
|
|
static inline const char*
|
|
AnnotationToString(Annotation aAnnotation) {
|
|
return kAnnotationStrings[static_cast<uint32_t>(aAnnotation)];
|
|
}
|
|
|
|
/**
|
|
* Converts a string to its corresponding crash annotation.
|
|
*
|
|
* @param aResult a reference where the annotation will be stored
|
|
* @param aValue the string to be converted
|
|
* @return true if the string was successfully converted, false if it did not
|
|
* correspond to any known annotation
|
|
*/
|
|
bool AnnotationFromString(Annotation& aResult, const char* aValue);
|
|
|
|
/**
|
|
* Checks if the given crash annotation is whitelisted for inclusion in the
|
|
* crash ping.
|
|
*
|
|
* @param aAnnotation the crash annotation to be checked
|
|
* @return true if the annotation can be included in the crash ping, false
|
|
* otherwise
|
|
*/
|
|
bool IsAnnotationWhitelistedForPing(Annotation aAnnotation);
|
|
|
|
/**
|
|
* Checks if the given crash annotation needs to be filtered out when reading
|
|
* a content process crash annotations. Blacklisted annotations will be
|
|
* replaced with ones provided by the parent process.
|
|
*
|
|
* @param aAnnotation the crash annotation to be checked
|
|
* @return true if the annotation needs to be filtered out when reading
|
|
* annotations provided by a content process, false otherwise
|
|
*/
|
|
bool IsAnnotationBlacklistedForContent(Annotation aAnnotation);
|
|
|
|
/**
|
|
* Abstract annotation writer, this is needed only for code that writes out
|
|
* annotations in the exception handler.
|
|
*/
|
|
class AnnotationWriter {
|
|
public:
|
|
virtual void Write(Annotation aAnnotation, const char* aValue, size_t aLen = 0) = 0;
|
|
};
|
|
|
|
} // namespace CrashReporter
|
|
|
|
#endif // CrashAnnotations_h
|