2022-09-06 19:14:07 -04:00
|
|
|
|
// Copyright 2014 The Crashpad Authors
|
2014-10-24 14:44:55 -04:00
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
//
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
2014-10-24 14:58:53 -04:00
|
|
|
|
#ifndef CRASHPAD_MINIDUMP_MINIDUMP_MODULE_CRASHPAD_INFO_WRITER_H_
|
|
|
|
|
#define CRASHPAD_MINIDUMP_MINIDUMP_MODULE_CRASHPAD_INFO_WRITER_H_
|
2014-10-24 14:44:55 -04:00
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2014-10-28 17:00:46 -04:00
|
|
|
|
#include <sys/types.h>
|
2014-10-24 14:44:55 -04:00
|
|
|
|
|
2016-04-25 12:13:07 -07:00
|
|
|
|
#include <memory>
|
2014-10-24 14:44:55 -04:00
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "minidump/minidump_extensions.h"
|
2014-11-07 10:01:17 -05:00
|
|
|
|
#include "minidump/minidump_string_writer.h"
|
2014-10-24 14:44:55 -04:00
|
|
|
|
#include "minidump/minidump_writable.h"
|
|
|
|
|
|
|
|
|
|
namespace crashpad {
|
|
|
|
|
|
2017-11-01 17:06:18 -04:00
|
|
|
|
class MinidumpAnnotationListWriter;
|
2014-10-24 14:44:55 -04:00
|
|
|
|
class MinidumpSimpleStringDictionaryWriter;
|
2014-10-28 17:00:46 -04:00
|
|
|
|
class ModuleSnapshot;
|
2014-10-24 14:44:55 -04:00
|
|
|
|
|
|
|
|
|
//! \brief The writer for a MinidumpModuleCrashpadInfo object in a minidump
|
|
|
|
|
//! file.
|
|
|
|
|
class MinidumpModuleCrashpadInfoWriter final
|
|
|
|
|
: public internal::MinidumpWritable {
|
|
|
|
|
public:
|
|
|
|
|
MinidumpModuleCrashpadInfoWriter();
|
2021-09-20 12:55:12 -07:00
|
|
|
|
|
|
|
|
|
MinidumpModuleCrashpadInfoWriter(const MinidumpModuleCrashpadInfoWriter&) =
|
|
|
|
|
delete;
|
|
|
|
|
MinidumpModuleCrashpadInfoWriter& operator=(
|
|
|
|
|
const MinidumpModuleCrashpadInfoWriter&) = delete;
|
|
|
|
|
|
2014-10-27 15:01:39 -04:00
|
|
|
|
~MinidumpModuleCrashpadInfoWriter() override;
|
2014-10-24 14:44:55 -04:00
|
|
|
|
|
2014-11-07 11:38:13 -05:00
|
|
|
|
//! \brief Initializes MinidumpModuleCrashpadInfo based on \a module_snapshot.
|
2014-10-28 17:00:46 -04:00
|
|
|
|
//!
|
|
|
|
|
//! Only data in \a module_snapshot that is considered useful will be
|
|
|
|
|
//! included. For simple annotations, usefulness is determined by
|
|
|
|
|
//! MinidumpSimpleStringDictionaryWriter::IsUseful().
|
|
|
|
|
//!
|
|
|
|
|
//! \param[in] module_snapshot The module snapshot to use as source data.
|
|
|
|
|
//!
|
|
|
|
|
//! \note Valid in #kStateMutable. No mutator methods may be called before
|
|
|
|
|
//! this method, and it is not normally necessary to call any mutator
|
|
|
|
|
//! methods after this method.
|
2015-03-04 10:53:34 -05:00
|
|
|
|
void InitializeFromSnapshot(const ModuleSnapshot* module_snapshot);
|
2014-10-24 14:44:55 -04:00
|
|
|
|
|
2014-11-07 10:01:17 -05:00
|
|
|
|
//! \brief Arranges for MinidumpModuleCrashpadInfo::list_annotations to point
|
|
|
|
|
//! to the internal::MinidumpUTF8StringListWriter object to be written by
|
|
|
|
|
//! \a list_annotations.
|
|
|
|
|
//!
|
|
|
|
|
//! This object takes ownership of \a simple_annotations and becomes its
|
|
|
|
|
//! parent in the overall tree of internal::MinidumpWritable objects.
|
|
|
|
|
//!
|
|
|
|
|
//! \note Valid in #kStateMutable.
|
|
|
|
|
void SetListAnnotations(
|
2016-04-25 12:13:07 -07:00
|
|
|
|
std::unique_ptr<MinidumpUTF8StringListWriter> list_annotations);
|
2014-11-07 10:01:17 -05:00
|
|
|
|
|
2014-10-24 14:44:55 -04:00
|
|
|
|
//! \brief Arranges for MinidumpModuleCrashpadInfo::simple_annotations to
|
|
|
|
|
//! point to the MinidumpSimpleStringDictionaryWriter object to be written
|
|
|
|
|
//! by \a simple_annotations.
|
|
|
|
|
//!
|
2014-10-27 15:01:39 -04:00
|
|
|
|
//! This object takes ownership of \a simple_annotations and becomes its
|
|
|
|
|
//! parent in the overall tree of internal::MinidumpWritable objects.
|
2014-10-24 14:44:55 -04:00
|
|
|
|
//!
|
|
|
|
|
//! \note Valid in #kStateMutable.
|
|
|
|
|
void SetSimpleAnnotations(
|
2016-04-25 12:13:07 -07:00
|
|
|
|
std::unique_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations);
|
2014-10-24 14:44:55 -04:00
|
|
|
|
|
2017-11-01 17:06:18 -04:00
|
|
|
|
//! \brief Arranges for MinidumpModuleCrashpadInfo::annotation_objects to
|
|
|
|
|
//! point to the MinidumpAnnotationListWriter object to be written by
|
|
|
|
|
//! \a annotation_objects.
|
|
|
|
|
//!
|
|
|
|
|
//! This object takes ownership of \a annotation_objects and becomes its
|
|
|
|
|
//! parent in the overall tree of internal::MinidumpWritable objects.
|
|
|
|
|
//!
|
|
|
|
|
//! \note Valid in #kStateMutable.
|
|
|
|
|
void SetAnnotationObjects(
|
|
|
|
|
std::unique_ptr<MinidumpAnnotationListWriter> annotation_objects);
|
|
|
|
|
|
2014-10-28 17:00:46 -04:00
|
|
|
|
//! \brief Determines whether the object is useful.
|
|
|
|
|
//!
|
|
|
|
|
//! A useful object is one that carries data that makes a meaningful
|
2014-11-07 10:01:17 -05:00
|
|
|
|
//! contribution to a minidump file. An object carrying list annotations or
|
|
|
|
|
//! simple annotations would be considered useful.
|
2014-10-28 17:00:46 -04:00
|
|
|
|
//!
|
|
|
|
|
//! \return `true` if the object is useful, `false` otherwise.
|
|
|
|
|
bool IsUseful() const;
|
|
|
|
|
|
2014-10-24 14:44:55 -04:00
|
|
|
|
protected:
|
|
|
|
|
// MinidumpWritable:
|
|
|
|
|
bool Freeze() override;
|
|
|
|
|
size_t SizeOfObject() override;
|
|
|
|
|
std::vector<MinidumpWritable*> Children() override;
|
|
|
|
|
bool WriteObject(FileWriterInterface* file_writer) override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
MinidumpModuleCrashpadInfo module_;
|
2016-04-25 12:13:07 -07:00
|
|
|
|
std::unique_ptr<MinidumpUTF8StringListWriter> list_annotations_;
|
|
|
|
|
std::unique_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations_;
|
2017-11-01 17:06:18 -04:00
|
|
|
|
std::unique_ptr<MinidumpAnnotationListWriter> annotation_objects_;
|
2014-10-24 14:44:55 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//! \brief The writer for a MinidumpModuleCrashpadInfoList object in a minidump
|
|
|
|
|
//! file, containing a list of MinidumpModuleCrashpadInfo objects.
|
|
|
|
|
class MinidumpModuleCrashpadInfoListWriter final
|
2015-03-04 10:53:34 -05:00
|
|
|
|
: public internal::MinidumpWritable {
|
2014-10-24 14:44:55 -04:00
|
|
|
|
public:
|
|
|
|
|
MinidumpModuleCrashpadInfoListWriter();
|
2021-09-20 12:55:12 -07:00
|
|
|
|
|
|
|
|
|
MinidumpModuleCrashpadInfoListWriter(
|
|
|
|
|
const MinidumpModuleCrashpadInfoListWriter&) = delete;
|
|
|
|
|
MinidumpModuleCrashpadInfoListWriter& operator=(
|
|
|
|
|
const MinidumpModuleCrashpadInfoListWriter&) = delete;
|
|
|
|
|
|
2014-10-27 15:01:39 -04:00
|
|
|
|
~MinidumpModuleCrashpadInfoListWriter() override;
|
2014-10-24 14:44:55 -04:00
|
|
|
|
|
2014-10-28 17:00:46 -04:00
|
|
|
|
//! \brief Adds an initialized MinidumpModuleCrashpadInfo for modules in \a
|
|
|
|
|
//! module_snapshots to the MinidumpModuleCrashpadInfoList.
|
|
|
|
|
//!
|
|
|
|
|
//! Only modules in \a module_snapshots that would produce a useful
|
|
|
|
|
//! MinidumpModuleCrashpadInfo structure are included. Usefulness is
|
|
|
|
|
//! determined by MinidumpModuleCrashpadInfoWriter::IsUseful().
|
|
|
|
|
//!
|
|
|
|
|
//! \param[in] module_snapshots The module snapshots to use as source data.
|
|
|
|
|
//!
|
2014-10-30 14:51:40 -04:00
|
|
|
|
//! \note Valid in #kStateMutable. AddModule() may not be called before this
|
|
|
|
|
//! method, and it is not normally necessary to call AddModule() after
|
|
|
|
|
//! this method.
|
2014-10-28 17:00:46 -04:00
|
|
|
|
void InitializeFromSnapshot(
|
|
|
|
|
const std::vector<const ModuleSnapshot*>& module_snapshots);
|
|
|
|
|
|
2014-10-24 14:44:55 -04:00
|
|
|
|
//! \brief Adds a MinidumpModuleCrashpadInfo to the
|
|
|
|
|
//! MinidumpModuleCrashpadInfoList.
|
|
|
|
|
//!
|
doc: Fix all Doxygen warnings, cleaning up some generated documentation
This makes Doxygen’s output more actionable by setting QUIET = YES to
suppress verbose progress spew, and WARN_IF_UNDOCUMENTED = NO to prevent
warnings for undocumented classes and members from being generated. The
latter is too noisy, producing 721 warnings in the current codebase.
The remaining warnings produced by Doxygen were useful and actionable.
They fell into two categories: abuses of Doxygen’s markup syntax, and
missing (or misspelled) parameter documentation. In a small number of
cases, pass-through parameters had intentionally been left undocumented.
In these cases, they are now given blank \param descriptions. This is
not optimal, but there doesn’t appear to be any other way to tell
Doxygen to allow a single parameter to be undocumented.
Some tricky Doxygen errors were resolved by asking it to not enter
directiores that we do not provide documentation in (such as the
“on-platform” compat directories, compat/mac and compat/win, as well as
compat/non_cxx11_lib) while allowing it to enter the
“off-platform” directories that we do document (compat/non_mac and
compat/non_win).
A Doxygen run (doc/support/generate_doxygen.sh) now produces no output
at all. It would produce warnings if any were triggered.
Not directly related, but still relevant to documentation,
doc/support/generate.sh is updated to remove temporary removals of
now-extinct files and directories. doc/appengine/README is updated so
that a consistent path to “goapp” is used throughout the file.
Change-Id: I300730c04de4d3340551ea3086ca70cc5ff862d1
Reviewed-on: https://chromium-review.googlesource.com/408812
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-08 14:23:09 -05:00
|
|
|
|
//! \param[in] module_crashpad_info Extended Crashpad-specific information
|
|
|
|
|
//! about the module. This object takes ownership of \a
|
|
|
|
|
//! module_crashpad_info and becomes its parent in the overall tree of
|
|
|
|
|
//! internal::MinidumpWritable objects.
|
|
|
|
|
//! \param[in] minidump_module_list_index The index of the MINIDUMP_MODULE in
|
|
|
|
|
//! the minidump file’s MINIDUMP_MODULE_LIST stream that corresponds to \a
|
2015-03-04 10:53:34 -05:00
|
|
|
|
//! module_crashpad_info.
|
2014-10-24 14:44:55 -04:00
|
|
|
|
//!
|
|
|
|
|
//! \note Valid in #kStateMutable.
|
2015-03-04 10:53:34 -05:00
|
|
|
|
void AddModule(
|
2016-04-25 12:13:07 -07:00
|
|
|
|
std::unique_ptr<MinidumpModuleCrashpadInfoWriter> module_crashpad_info,
|
2015-03-04 10:53:34 -05:00
|
|
|
|
size_t minidump_module_list_index);
|
2014-10-24 14:44:55 -04:00
|
|
|
|
|
2014-11-07 11:38:13 -05:00
|
|
|
|
//! \brief Determines whether the object is useful.
|
|
|
|
|
//!
|
|
|
|
|
//! A useful object is one that carries data that makes a meaningful
|
|
|
|
|
//! contribution to a minidump file. An object carrying children would be
|
|
|
|
|
//! considered useful.
|
|
|
|
|
//!
|
|
|
|
|
//! \return `true` if the object is useful, `false` otherwise.
|
|
|
|
|
bool IsUseful() const;
|
|
|
|
|
|
2015-03-04 10:53:34 -05:00
|
|
|
|
protected:
|
|
|
|
|
// MinidumpWritable:
|
|
|
|
|
bool Freeze() override;
|
|
|
|
|
size_t SizeOfObject() override;
|
|
|
|
|
std::vector<MinidumpWritable*> Children() override;
|
|
|
|
|
bool WriteObject(FileWriterInterface* file_writer) override;
|
|
|
|
|
|
2014-10-24 14:44:55 -04:00
|
|
|
|
private:
|
2017-10-19 00:26:38 -04:00
|
|
|
|
std::vector<std::unique_ptr<MinidumpModuleCrashpadInfoWriter>>
|
|
|
|
|
module_crashpad_infos_;
|
2015-03-04 10:53:34 -05:00
|
|
|
|
std::vector<MinidumpModuleCrashpadInfoLink> module_crashpad_info_links_;
|
|
|
|
|
MinidumpModuleCrashpadInfoList module_crashpad_info_list_base_;
|
2014-10-24 14:44:55 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace crashpad
|
|
|
|
|
|
2014-10-24 14:58:53 -04:00
|
|
|
|
#endif // CRASHPAD_MINIDUMP_MINIDUMP_MODULE_CRASHPAD_INFO_WRITER_H_
|