aboutsummaryrefslogtreecommitdiff
path: root/src/processor
diff options
context:
space:
mode:
Diffstat (limited to 'src/processor')
-rw-r--r--src/processor/contained_range_map.h2
-rw-r--r--src/processor/memory_region.h4
-rw-r--r--src/processor/minidump.cc16
-rw-r--r--src/processor/minidump.h30
-rw-r--r--src/processor/minidump_format.h2
-rw-r--r--src/processor/minidump_processor.cc4
-rw-r--r--src/processor/minidump_processor_unittest.cc1
-rw-r--r--src/processor/minidump_stackwalk.cc2
-rw-r--r--src/processor/postfix_evaluator-inl.h2
-rw-r--r--src/processor/postfix_evaluator_unittest.cc31
-rw-r--r--src/processor/range_map_unittest.cc3
-rw-r--r--src/processor/source_line_resolver.cc13
-rw-r--r--src/processor/source_line_resolver.h5
-rw-r--r--src/processor/stack_frame_info.h5
-rw-r--r--src/processor/stackwalker.cc2
-rw-r--r--src/processor/stackwalker.h4
-rw-r--r--src/processor/stackwalker_ppc.cc2
-rw-r--r--src/processor/stackwalker_ppc.h4
-rw-r--r--src/processor/stackwalker_selftest.cc4
-rw-r--r--src/processor/stackwalker_x86.cc5
-rw-r--r--src/processor/stackwalker_x86.h4
21 files changed, 82 insertions, 63 deletions
diff --git a/src/processor/contained_range_map.h b/src/processor/contained_range_map.h
index 12f79c5e..b1e2b721 100644
--- a/src/processor/contained_range_map.h
+++ b/src/processor/contained_range_map.h
@@ -87,7 +87,7 @@ class ContainedRangeMap {
bool StoreRange(const AddressType &base,
const AddressType &size,
const EntryType &entry);
-
+
// Retrieves the most specific (smallest) descendant range encompassing
// the specified address. This method will only return entries held by
// child ranges, and not the entry contained by |this|. This is necessary
diff --git a/src/processor/memory_region.h b/src/processor/memory_region.h
index 1ae94b96..0070ce32 100644
--- a/src/processor/memory_region.h
+++ b/src/processor/memory_region.h
@@ -70,7 +70,7 @@ class MemoryRegion {
};
-} // namespace google_airbag
+} // namespace google_airbag
-#endif // PROCESSOR_MEMORY_REGION_H__
+#endif // PROCESSOR_MEMORY_REGION_H__
diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc
index e195519a..f0d728c3 100644
--- a/src/processor/minidump.cc
+++ b/src/processor/minidump.cc
@@ -44,15 +44,16 @@ typedef SSIZE_T ssize_t;
#define open _open
#define read _read
#define lseek _lseek
-#else // _WIN32
+#else // _WIN32
#define O_BINARY 0
-#endif // _WIN32
+#endif // _WIN32
#include <map>
#include <vector>
-#include "processor/minidump.h"
#include "processor/range_map-inl.h"
+
+#include "processor/minidump.h"
#include "processor/scoped_ptr.h"
@@ -649,7 +650,7 @@ const u_int8_t* MinidumpMemoryRegion::GetMemory() {
scoped_ptr< vector<u_int8_t> > memory(
new vector<u_int8_t>(descriptor_->memory.data_size));
- if (!minidump_->ReadBytes(&(*memory)[0], descriptor_->memory.data_size))
+ if (!minidump_->ReadBytes(&(*memory)[0], descriptor_->memory.data_size))
return NULL;
memory_ = memory.release();
@@ -2126,7 +2127,7 @@ bool Minidump::Read() {
// Initialize the stream_map map, which speeds locating a stream by
// type.
unsigned int stream_type = directory_entry->stream_type;
- switch(stream_type) {
+ switch (stream_type) {
case THREAD_LIST_STREAM:
case MODULE_LIST_STREAM:
case MEMORY_LIST_STREAM:
@@ -2203,7 +2204,8 @@ void Minidump::Print() {
printf(" stream_count = %d\n", header_.stream_count);
printf(" stream_directory_rva = 0x%x\n", header_.stream_directory_rva);
printf(" checksum = 0x%x\n", header_.checksum);
- struct tm* timestruct = gmtime((time_t*)&header_.time_date_stamp);
+ struct tm* timestruct =
+ gmtime(reinterpret_cast<time_t*>(&header_.time_date_stamp));
char timestr[20];
strftime(timestr, 20, "%Y-%m-%d %H:%M:%S", timestruct);
printf(" time_date_stamp = 0x%x %s\n", header_.time_date_stamp,
@@ -2365,4 +2367,4 @@ T* Minidump::GetStream(T** stream) {
}
-} // namespace google_airbag
+} // namespace google_airbag
diff --git a/src/processor/minidump.h b/src/processor/minidump.h
index f67cd35e..700daa18 100644
--- a/src/processor/minidump.h
+++ b/src/processor/minidump.h
@@ -108,7 +108,7 @@ class MinidumpObject {
virtual ~MinidumpObject() {}
protected:
- MinidumpObject(Minidump* minidump);
+ explicit MinidumpObject(Minidump* minidump);
// Refers to the Minidump object that is the ultimate parent of this
// Some MinidumpObjects are owned by other MinidumpObjects, but at the
@@ -137,7 +137,7 @@ class MinidumpStream : public MinidumpObject {
virtual ~MinidumpStream() {}
protected:
- MinidumpStream(Minidump* minidump);
+ explicit MinidumpStream(Minidump* minidump);
private:
// Populate (and validate) the MinidumpStream. minidump_ is expected
@@ -184,7 +184,7 @@ class MinidumpContext : public MinidumpStream {
friend class MinidumpThread;
friend class MinidumpException;
- MinidumpContext(Minidump* minidump);
+ explicit MinidumpContext(Minidump* minidump);
bool Read(u_int32_t expected_size);
@@ -247,7 +247,7 @@ class MinidumpMemoryRegion : public MinidumpObject,
friend class MinidumpThread;
friend class MinidumpMemoryList;
- MinidumpMemoryRegion(Minidump* minidump);
+ explicit MinidumpMemoryRegion(Minidump* minidump);
// Identify the base address and size of the memory region, and the
// location it may be found in the minidump file.
@@ -291,7 +291,7 @@ class MinidumpThread : public MinidumpObject {
// These objects are managed by MinidumpThreadList.
friend class MinidumpThreadList;
- MinidumpThread(Minidump* minidump);
+ explicit MinidumpThread(Minidump* minidump);
// This works like MinidumpStream::Read, but is driven by
// MinidumpThreadList. No size checking is done, because
@@ -329,7 +329,7 @@ class MinidumpThreadList : public MinidumpStream {
static const u_int32_t kStreamType = THREAD_LIST_STREAM;
- MinidumpThreadList(Minidump* aMinidump);
+ explicit MinidumpThreadList(Minidump* aMinidump);
bool Read(u_int32_t aExpectedSize);
@@ -384,7 +384,7 @@ class MinidumpModule : public MinidumpObject {
// These objects are managed by MinidumpModuleList.
friend class MinidumpModuleList;
- MinidumpModule(Minidump* minidump);
+ explicit MinidumpModule(Minidump* minidump);
// This works like MinidumpStream::Read, but is driven by
// MinidumpModuleList. No size checking is done, because
@@ -439,7 +439,7 @@ class MinidumpModuleList : public MinidumpStream {
static const u_int32_t kStreamType = MODULE_LIST_STREAM;
- MinidumpModuleList(Minidump* minidump);
+ explicit MinidumpModuleList(Minidump* minidump);
bool Read(u_int32_t expected_size);
@@ -484,7 +484,7 @@ class MinidumpMemoryList : public MinidumpStream {
static const u_int32_t kStreamType = MEMORY_LIST_STREAM;
- MinidumpMemoryList(Minidump* minidump);
+ explicit MinidumpMemoryList(Minidump* minidump);
bool Read(u_int32_t expected_size);
@@ -531,7 +531,7 @@ class MinidumpException : public MinidumpStream {
static const u_int32_t kStreamType = EXCEPTION_STREAM;
- MinidumpException(Minidump* minidump);
+ explicit MinidumpException(Minidump* minidump);
bool Read(u_int32_t expected_size);
@@ -568,7 +568,7 @@ class MinidumpSystemInfo : public MinidumpStream {
static const u_int32_t kStreamType = SYSTEM_INFO_STREAM;
- MinidumpSystemInfo(Minidump* minidump);
+ explicit MinidumpSystemInfo(Minidump* minidump);
bool Read(u_int32_t expected_size);
@@ -598,7 +598,7 @@ class MinidumpMiscInfo : public MinidumpStream {
static const u_int32_t kStreamType = MISC_INFO_STREAM;
- MinidumpMiscInfo(Minidump* minidump_);
+ explicit MinidumpMiscInfo(Minidump* minidump_);
bool Read(u_int32_t expected_size_);
@@ -611,7 +611,7 @@ class MinidumpMiscInfo : public MinidumpStream {
class Minidump {
public:
// path is the pathname of a file containing the minidump.
- Minidump(const string& path);
+ explicit Minidump(const string& path);
~Minidump();
@@ -730,7 +730,7 @@ class Minidump {
};
-} // namespace google_airbag
+} // namespace google_airbag
-#endif // PROCESSOR_MINIDUMP_H__
+#endif // PROCESSOR_MINIDUMP_H__
diff --git a/src/processor/minidump_format.h b/src/processor/minidump_format.h
index b3661d8d..ef223754 100644
--- a/src/processor/minidump_format.h
+++ b/src/processor/minidump_format.h
@@ -483,7 +483,7 @@ typedef enum {
FUNCTION_TABLE_STREAM = 13,
UNLOADED_MODULE_LIST_STREAM = 14,
MISC_INFO_STREAM = 15, /* MDRawMiscInfo */
- LAST_RESERVED_STREAM = 0x0000FFFF
+ LAST_RESERVED_STREAM = 0x0000ffff
} MDStreamType; /* MINIDUMP_STREAM_TYPE */
diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc
index 62ad0092..d783654d 100644
--- a/src/processor/minidump_processor.cc
+++ b/src/processor/minidump_processor.cc
@@ -121,7 +121,7 @@ ProcessState* MinidumpProcessor::Process(const string &minidump_file) {
}
// Returns the MDRawSystemInfo from a minidump, or NULL if system info is
-// not available from the minidump. If system_info is non-NULL, it is used
+// not available from the minidump. If system_info is non-NULL, it is used
// to pass back the MinidumpSystemInfo object.
static const MDRawSystemInfo* GetSystemInfo(Minidump *dump,
MinidumpSystemInfo **system_info) {
@@ -271,7 +271,7 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, u_int64_t *address) {
if (!raw_system_info)
return reason;
- switch(raw_system_info->platform_id) {
+ switch (raw_system_info->platform_id) {
case MD_OS_WIN32_NT:
case MD_OS_WIN32_WINDOWS: {
switch (raw_exception->exception_record.exception_code) {
diff --git a/src/processor/minidump_processor_unittest.cc b/src/processor/minidump_processor_unittest.cc
index b3c69930..8df618c5 100644
--- a/src/processor/minidump_processor_unittest.cc
+++ b/src/processor/minidump_processor_unittest.cc
@@ -74,7 +74,6 @@ string TestSymbolSupplier::GetSymbolFile(MinidumpModule *module) {
using google_airbag::TestSymbolSupplier;
static bool RunTests() {
-
TestSymbolSupplier supplier;
MinidumpProcessor processor(&supplier);
diff --git a/src/processor/minidump_stackwalk.cc b/src/processor/minidump_stackwalk.cc
index 1bcf2a66..fa499362 100644
--- a/src/processor/minidump_stackwalk.cc
+++ b/src/processor/minidump_stackwalk.cc
@@ -83,7 +83,7 @@ int main(int argc, char **argv) {
}
MinidumpThread *exception_thread =
- thread_list->GetThreadByID(exception->GetThreadID());
+ thread_list->GetThreadByID(exception->GetThreadID());
if (!exception_thread) {
fprintf(stderr, "thread_list->GetThreadByID() failed\n");
exit(1);
diff --git a/src/processor/postfix_evaluator-inl.h b/src/processor/postfix_evaluator-inl.h
index c78037bc..227ebf8e 100644
--- a/src/processor/postfix_evaluator-inl.h
+++ b/src/processor/postfix_evaluator-inl.h
@@ -38,7 +38,7 @@ using std::ostringstream;
// before returning failure.
class AutoStackClearer {
public:
- AutoStackClearer(vector<string> *stack) : stack_(stack) {}
+ explicit AutoStackClearer(vector<string> *stack) : stack_(stack) {}
~AutoStackClearer() { stack_->clear(); }
private:
diff --git a/src/processor/postfix_evaluator_unittest.cc b/src/processor/postfix_evaluator_unittest.cc
index f6cab215..aa55dd98 100644
--- a/src/processor/postfix_evaluator_unittest.cc
+++ b/src/processor/postfix_evaluator_unittest.cc
@@ -20,9 +20,10 @@
#include <map>
#include <string>
+#include "processor/postfix_evaluator-inl.h"
+
#include "google/airbag_types.h"
#include "processor/memory_region.h"
-#include "processor/postfix_evaluator-inl.h"
using std::map;
@@ -38,14 +39,22 @@ class FakeMemoryRegion : public MemoryRegion {
public:
virtual u_int64_t GetBase() { return 0; }
virtual u_int32_t GetSize() { return 0; }
- virtual bool GetMemoryAtAddress(u_int64_t address, u_int8_t *value)
- { *value = address + 1; return true; }
- virtual bool GetMemoryAtAddress(u_int64_t address, u_int16_t *value)
- { *value = address + 1; return true; }
- virtual bool GetMemoryAtAddress(u_int64_t address, u_int32_t *value)
- { *value = address + 1; return true; }
- virtual bool GetMemoryAtAddress(u_int64_t address, u_int64_t *value)
- { *value = address + 1; return true; }
+ virtual bool GetMemoryAtAddress(u_int64_t address, u_int8_t *value) {
+ *value = address + 1;
+ return true;
+ }
+ virtual bool GetMemoryAtAddress(u_int64_t address, u_int16_t *value) {
+ *value = address + 1;
+ return true;
+ }
+ virtual bool GetMemoryAtAddress(u_int64_t address, u_int32_t *value) {
+ *value = address + 1;
+ return true;
+ }
+ virtual bool GetMemoryAtAddress(u_int64_t address, u_int64_t *value) {
+ *value = address + 1;
+ return true;
+ }
};
@@ -195,7 +204,7 @@ bool RunTests() {
const EvaluateTest *evaluate_test = &evaluate_tests[evaluate_test_index];
// Do the test.
- bool result = postfix_evaluator.Evaluate(evaluate_test->expression,
+ bool result = postfix_evaluator.Evaluate(evaluate_test->expression,
&assigned);
if (result != evaluate_test->evaluable) {
fprintf(stderr, "FAIL: evaluate set %d/%d, test %d/%d, "
@@ -210,7 +219,7 @@ bool RunTests() {
}
// Validate the results.
- for(map<string, unsigned int>::const_iterator validate_iterator =
+ for (map<string, unsigned int>::const_iterator validate_iterator =
evaluate_test_set->validate_data->begin();
validate_iterator != evaluate_test_set->validate_data->end();
++validate_iterator) {
diff --git a/src/processor/range_map_unittest.cc b/src/processor/range_map_unittest.cc
index af257cf0..11cf48e6 100644
--- a/src/processor/range_map_unittest.cc
+++ b/src/processor/range_map_unittest.cc
@@ -35,8 +35,9 @@
#include <climits>
#include <cstdio>
-#include "processor/linked_ptr.h"
#include "processor/range_map-inl.h"
+
+#include "processor/linked_ptr.h"
#include "processor/scoped_ptr.h"
diff --git a/src/processor/source_line_resolver.cc b/src/processor/source_line_resolver.cc
index a6f9d740..2d83e2ea 100644
--- a/src/processor/source_line_resolver.cc
+++ b/src/processor/source_line_resolver.cc
@@ -29,15 +29,18 @@
#include <stdio.h>
#include <string.h>
+
#include <map>
-#include <vector>
#include <utility>
-#include "processor/source_line_resolver.h"
-#include "google/stack_frame.h"
-#include "processor/linked_ptr.h"
+#include <vector>
+
#include "processor/address_map-inl.h"
#include "processor/contained_range_map-inl.h"
#include "processor/range_map-inl.h"
+
+#include "processor/source_line_resolver.h"
+#include "google/stack_frame.h"
+#include "processor/linked_ptr.h"
#include "processor/scoped_ptr.h"
#include "processor/stack_frame_info.h"
@@ -543,4 +546,4 @@ size_t SourceLineResolver::HashString::operator()(const string &s) const {
return hash<const char*>()(s.c_str());
}
-} // namespace google_airbag
+} // namespace google_airbag
diff --git a/src/processor/source_line_resolver.h b/src/processor/source_line_resolver.h
index cf93c69e..cb0c6801 100644
--- a/src/processor/source_line_resolver.h
+++ b/src/processor/source_line_resolver.h
@@ -36,6 +36,7 @@
#include <string>
#include <ext/hash_map>
+#include "google/airbag_types.h"
namespace google_airbag {
@@ -47,7 +48,7 @@ struct StackFrameInfo;
class SourceLineResolver {
public:
- typedef unsigned long long MemAddr;
+ typedef u_int64_t MemAddr;
SourceLineResolver();
~SourceLineResolver();
@@ -92,6 +93,6 @@ class SourceLineResolver {
void operator=(const SourceLineResolver&);
};
-} // namespace google_airbag
+} // namespace google_airbag
#endif // PROCESSOR_SOURCE_LINE_RESOLVER_H__
diff --git a/src/processor/stack_frame_info.h b/src/processor/stack_frame_info.h
index e6026c11..c1241845 100644
--- a/src/processor/stack_frame_info.h
+++ b/src/processor/stack_frame_info.h
@@ -95,7 +95,10 @@ struct StackFrameInfo {
// Clears the StackFrameInfo object so that users will see it as though
// it contains no information.
- void Clear() { valid = VALID_NONE; program_string.erase(); }
+ void Clear() {
+ valid = VALID_NONE;
+ program_string.erase();
+ }
// Identifies which fields in the structure are valid. This is of
// type Validity, but it is defined as an int because it's not
diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc
index 358df8ac..2ff991d9 100644
--- a/src/processor/stackwalker.cc
+++ b/src/processor/stackwalker.cc
@@ -135,4 +135,4 @@ Stackwalker* Stackwalker::StackwalkerForCPU(MinidumpContext *context,
}
-} // namespace google_airbag
+} // namespace google_airbag
diff --git a/src/processor/stackwalker.h b/src/processor/stackwalker.h
index 82421bb5..a24f31a6 100644
--- a/src/processor/stackwalker.h
+++ b/src/processor/stackwalker.h
@@ -117,7 +117,7 @@ class Stackwalker {
};
-} // namespace google_airbag
+} // namespace google_airbag
-#endif // PROCESSOR_STACKWALKER_H__
+#endif // PROCESSOR_STACKWALKER_H__
diff --git a/src/processor/stackwalker_ppc.cc b/src/processor/stackwalker_ppc.cc
index b3898ccd..0dc31e8f 100644
--- a/src/processor/stackwalker_ppc.cc
+++ b/src/processor/stackwalker_ppc.cc
@@ -133,4 +133,4 @@ StackFrame* StackwalkerPPC::GetCallerFrame(
}
-} // namespace google_airbag
+} // namespace google_airbag
diff --git a/src/processor/stackwalker_ppc.h b/src/processor/stackwalker_ppc.h
index 15e2e1ce..b8f3ba0f 100644
--- a/src/processor/stackwalker_ppc.h
+++ b/src/processor/stackwalker_ppc.h
@@ -75,7 +75,7 @@ class StackwalkerPPC : public Stackwalker {
};
-} // namespace google_airbag
+} // namespace google_airbag
-#endif // PROCESSOR_STACKWALKER_PPC_H__
+#endif // PROCESSOR_STACKWALKER_PPC_H__
diff --git a/src/processor/stackwalker_selftest.cc b/src/processor/stackwalker_selftest.cc
index 76136a64..45b9a5c0 100644
--- a/src/processor/stackwalker_selftest.cc
+++ b/src/processor/stackwalker_selftest.cc
@@ -161,7 +161,7 @@ static u_int32_t GetEIP() {
// GetSP returns the current value of the %r1 register, which by convention,
// is the stack pointer on ppc. Because it's implemented as a function,
-// %r1 itself contains GetSP's own stack pointer and not the caller's stack
+// %r1 itself contains GetSP's own stack pointer and not the caller's stack
// pointer. Dereference %r1 to obtain the caller's stack pointer, which the
// compiler-generated prolog stored on the stack. Because this function
// depends on the compiler-generated prolog, inlining is disabled.
@@ -222,7 +222,7 @@ static unsigned int CountCallerFrames() {
#ifdef PRINT_STACKS
printf("\n");
- for(unsigned int frame_index = 0;
+ for (unsigned int frame_index = 0;
frame_index < stack->frames()->size();
++frame_index) {
StackFrame *frame = stack->frames()->at(frame_index);
diff --git a/src/processor/stackwalker_x86.cc b/src/processor/stackwalker_x86.cc
index 04a7e8c4..9678cc50 100644
--- a/src/processor/stackwalker_x86.cc
+++ b/src/processor/stackwalker_x86.cc
@@ -34,12 +34,13 @@
// Author: Mark Mentovai
+#include "processor/postfix_evaluator-inl.h"
+
#include "processor/stackwalker_x86.h"
#include "google/call_stack.h"
#include "google/stack_frame_cpu.h"
#include "processor/linked_ptr.h"
#include "processor/minidump.h"
-#include "processor/postfix_evaluator-inl.h"
#include "processor/stack_frame_info.h"
namespace google_airbag {
@@ -309,4 +310,4 @@ StackFrame* StackwalkerX86::GetCallerFrame(
}
-} // namespace google_airbag
+} // namespace google_airbag
diff --git a/src/processor/stackwalker_x86.h b/src/processor/stackwalker_x86.h
index 80e5a30b..1dc6fedc 100644
--- a/src/processor/stackwalker_x86.h
+++ b/src/processor/stackwalker_x86.h
@@ -75,7 +75,7 @@ class StackwalkerX86 : public Stackwalker {
};
-} // namespace google_airbag
+} // namespace google_airbag
-#endif // PROCESSOR_STACKWALKER_X86_H__
+#endif // PROCESSOR_STACKWALKER_X86_H__