From f33b8d2d07a057fdd667c2e0db629ba7cbc37cc3 Mon Sep 17 00:00:00 2001 From: bryner Date: Fri, 8 Dec 2006 04:13:51 +0000 Subject: Provide a mechanism for SymbolSuppliers to interrupt processing (#93) git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@80 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/processor/minidump_processor.cc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/processor/minidump_processor.cc') diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc index 99aa04cc..ab027e8a 100644 --- a/src/processor/minidump_processor.cc +++ b/src/processor/minidump_processor.cc @@ -45,13 +45,14 @@ MinidumpProcessor::MinidumpProcessor(SymbolSupplier *supplier) MinidumpProcessor::~MinidumpProcessor() { } -ProcessState* MinidumpProcessor::Process(const string &minidump_file) { +MinidumpProcessor::ProcessResult MinidumpProcessor::Process( + const string &minidump_file, ProcessState *process_state) { Minidump dump(minidump_file); if (!dump.Read()) { - return NULL; + return PROCESS_ERROR; } - scoped_ptr process_state(new ProcessState()); + process_state->Clear(); const MDRawHeader *header = dump.header(); assert(header); @@ -91,7 +92,7 @@ ProcessState* MinidumpProcessor::Process(const string &minidump_file) { MinidumpThreadList *threads = dump.GetThreadList(); if (!threads) { - return NULL; + return PROCESS_ERROR; } bool found_requesting_thread = false; @@ -101,12 +102,12 @@ ProcessState* MinidumpProcessor::Process(const string &minidump_file) { ++thread_index) { MinidumpThread *thread = threads->GetThreadAtIndex(thread_index); if (!thread) { - return NULL; + return PROCESS_ERROR; } u_int32_t thread_id; if (!thread->GetThreadID(&thread_id)) { - return NULL; + return PROCESS_ERROR; } // If this thread is the thread that produced the minidump, don't process @@ -122,7 +123,7 @@ ProcessState* MinidumpProcessor::Process(const string &minidump_file) { if (has_requesting_thread && thread_id == requesting_thread_id) { if (found_requesting_thread) { // There can't be more than one requesting thread. - return NULL; + return PROCESS_ERROR; } // Use processed_state->threads_.size() instead of thread_index. @@ -148,7 +149,7 @@ ProcessState* MinidumpProcessor::Process(const string &minidump_file) { MinidumpMemoryRegion *thread_memory = thread->GetMemory(); if (!thread_memory) { - return NULL; + return PROCESS_ERROR; } // Use process_state->modules_ instead of module_list, because the @@ -165,23 +166,22 @@ ProcessState* MinidumpProcessor::Process(const string &minidump_file) { process_state->modules_, supplier_)); if (!stackwalker.get()) { - return NULL; + return PROCESS_ERROR; } - scoped_ptr stack(stackwalker->Walk()); - if (!stack.get()) { - return NULL; + scoped_ptr stack(new CallStack()); + if (!stackwalker->Walk(stack.get())) { + return PROCESS_INTERRUPTED; } - process_state->threads_.push_back(stack.release()); } // If a requesting thread was indicated, it must be present. if (has_requesting_thread && !found_requesting_thread) { - return NULL; + return PROCESS_ERROR; } - return process_state.release(); + return PROCESS_OK; } // Returns the MDRawSystemInfo from a minidump, or NULL if system info is -- cgit v1.2.1