fuchsia: More fixes to get a basic minidump written

With this `generate_dump <somepid>` generates a valid and somewhat
plausible (but still quite incomplete) minidump.

As an example, on a running Fuchsia system, `ps` reported the pid of
"netstack" as 6062, followed by `generate_dump 6062`, copy minidump.6062
to host, and run Breakpad's minidump_dump on the generated dump file,
resulting in:
https://gist.github.com/sgraham/24e4ba1af968219d7c154bb0fba43925

This looks roughly correct in that it has a bunch of threads (without
much data) and a reasonable looking module list.

Bug: crashpad:196
Change-Id: I3f68cc015f74374624a5ce497d46ac90df17a22c
Reviewed-on: https://chromium-review.googlesource.com/1005978
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Scott Graham 2018-04-10 16:03:05 -07:00 committed by Commit Bot
parent a4f4d6a736
commit d9bf38f39c
3 changed files with 31 additions and 7 deletions

View File

@ -115,18 +115,17 @@ void ProcessSnapshotFuchsia::ProcessCPUTimes(timeval* user_time,
void ProcessSnapshotFuchsia::ReportID(UUID* report_id) const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
NOTREACHED(); // TODO(scottmg): https://crashpad.chromium.org/bug/196
*report_id = report_id_;
}
void ProcessSnapshotFuchsia::ClientID(UUID* client_id) const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
NOTREACHED(); // TODO(scottmg): https://crashpad.chromium.org/bug/196
*client_id = client_id_;
}
const std::map<std::string, std::string>&
ProcessSnapshotFuchsia::AnnotationsSimpleMap() const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
NOTREACHED(); // TODO(scottmg): https://crashpad.chromium.org/bug/196
return annotations_simple_map_;
}
@ -162,26 +161,23 @@ std::vector<UnloadedModuleSnapshot> ProcessSnapshotFuchsia::UnloadedModules()
const ExceptionSnapshot* ProcessSnapshotFuchsia::Exception() const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
NOTREACHED(); // TODO(scottmg): https://crashpad.chromium.org/bug/196
// TODO(scottmg): https://crashpad.chromium.org/bug/196
return nullptr;
}
std::vector<const MemoryMapRegionSnapshot*> ProcessSnapshotFuchsia::MemoryMap()
const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
NOTREACHED(); // TODO(scottmg): https://crashpad.chromium.org/bug/196
return std::vector<const MemoryMapRegionSnapshot*>();
}
std::vector<HandleSnapshot> ProcessSnapshotFuchsia::Handles() const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
NOTREACHED(); // TODO(scottmg): https://crashpad.chromium.org/bug/196
return std::vector<HandleSnapshot>();
}
std::vector<const MemorySnapshot*> ProcessSnapshotFuchsia::ExtraMemory() const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
NOTREACHED(); // TODO(scottmg): https://crashpad.chromium.org/bug/196
return std::vector<const MemorySnapshot*>();
}

View File

@ -56,6 +56,31 @@ class ProcessSnapshotFuchsia : public ProcessSnapshot {
//! the process.
void GetCrashpadOptions(CrashpadInfoClientOptions* options);
//! \brief Sets the value to be returned by ReportID().
//!
//! On Fuchsia, the crash report ID is under the control of the snapshot
//! producer, which may call this method to set the report ID. If this is not
//! done, ReportID() will return an identifier consisting entirely of zeroes.
void SetReportID(const UUID& report_id) { report_id_ = report_id; }
//! \brief Sets the value to be returned by ClientID().
//!
//! On Fuchsia, the client ID is under the control of the snapshot producer,
//! which may call this method to set the client ID. If this is not done,
//! ClientID() will return an identifier consisting entirely of zeroes.
void SetClientID(const UUID& client_id) { client_id_ = client_id; }
//! \brief Sets the value to be returned by AnnotationsSimpleMap().
//!
//! On Fuchsia, all process annotations are under the control of the snapshot
//! producer, which may call this method to establish these annotations.
//! Contrast this with module annotations, which are under the control of the
//! process being snapshotted.
void SetAnnotationsSimpleMap(
const std::map<std::string, std::string>& annotations_simple_map) {
annotations_simple_map_ = annotations_simple_map;
}
// ProcessSnapshot:
pid_t ProcessID() const override;
pid_t ParentProcessID() const override;
@ -87,6 +112,8 @@ class ProcessSnapshotFuchsia : public ProcessSnapshot {
std::vector<std::unique_ptr<internal::ModuleSnapshotElf>> modules_;
ProcessReaderFuchsia process_reader_;
std::map<std::string, std::string> annotations_simple_map_;
UUID report_id_;
UUID client_id_;
timeval snapshot_time_;
InitializationStateDcheck initialized_;

View File

@ -49,6 +49,7 @@ bool ThreadSnapshotFuchsia::Initialize(
// TODO(scottmg): https://crashpad.chromium.org/bug/196. Initialize stack_ and
// TLS address here. API request for stack range filed upstream at ZX-1748.
stack_.Initialize(process_reader, 0, 0);
thread_id_ = thread.id;