Fix minor style problems (#58). r=bryner

http://groups.google.com/group/airbag-dev/browse_thread/thread/bbcecab979fa82bc


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@49 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mmentovai 2006-10-25 21:25:41 +00:00
parent 0a7e6bf16c
commit 80e98391dc
24 changed files with 87 additions and 68 deletions

View File

@ -33,8 +33,8 @@
#ifndef _PDB_SOURCE_LINE_WRITER_H__
#define _PDB_SOURCE_LINE_WRITER_H__
#include <string>
#include <atlcomcli.h>
#include <string>
struct IDiaEnumLineNumbers;
struct IDiaSession;

View File

@ -45,7 +45,7 @@
#include <sys/types.h>
#else /* !_WIN32 */
#else /* !_WIN32 */
#include <WTypes.h>
@ -54,7 +54,7 @@ typedef unsigned __int16 u_int16_t;
typedef unsigned __int32 u_int32_t;
typedef unsigned __int64 u_int64_t;
#endif /* !_WIN32 */
#endif /* !_WIN32 */
typedef struct {
u_int64_t half[2];
@ -62,4 +62,4 @@ typedef struct {
typedef u_int64_t airbag_time_t;
#endif /* GOOGLE_AIRBAG_TYPES_H__ */
#endif /* GOOGLE_AIRBAG_TYPES_H__ */

View File

@ -44,7 +44,7 @@ class MinidumpProcessor {
public:
// Initializes this MinidumpProcessor. supplier should be an
// implementation of the SymbolSupplier abstract base class.
MinidumpProcessor(SymbolSupplier *supplier);
explicit MinidumpProcessor(SymbolSupplier *supplier);
~MinidumpProcessor();
// Returns a new ProcessState object produced by processing the minidump

View File

@ -70,7 +70,7 @@ class MemoryRegion {
};
} // namespace google_airbag
} // namespace google_airbag
#endif // PROCESSOR_MEMORY_REGION_H__
#endif // PROCESSOR_MEMORY_REGION_H__

View File

@ -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"
@ -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

View File

@ -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__

View File

@ -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 */

View File

@ -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) {

View File

@ -74,7 +74,6 @@ string TestSymbolSupplier::GetSymbolFile(MinidumpModule *module) {
using google_airbag::TestSymbolSupplier;
static bool RunTests() {
TestSymbolSupplier supplier;
MinidumpProcessor processor(&supplier);

View File

@ -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);

View File

@ -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:

View File

@ -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;
}
};
@ -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) {

View File

@ -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"

View File

@ -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

View File

@ -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__

View File

@ -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

View File

@ -135,4 +135,4 @@ Stackwalker* Stackwalker::StackwalkerForCPU(MinidumpContext *context,
}
} // namespace google_airbag
} // namespace google_airbag

View File

@ -117,7 +117,7 @@ class Stackwalker {
};
} // namespace google_airbag
} // namespace google_airbag
#endif // PROCESSOR_STACKWALKER_H__
#endif // PROCESSOR_STACKWALKER_H__

View File

@ -133,4 +133,4 @@ StackFrame* StackwalkerPPC::GetCallerFrame(
}
} // namespace google_airbag
} // namespace google_airbag

View File

@ -75,7 +75,7 @@ class StackwalkerPPC : public Stackwalker {
};
} // namespace google_airbag
} // namespace google_airbag
#endif // PROCESSOR_STACKWALKER_PPC_H__
#endif // PROCESSOR_STACKWALKER_PPC_H__

View File

@ -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);

View File

@ -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

View File

@ -75,7 +75,7 @@ class StackwalkerX86 : public Stackwalker {
};
} // namespace google_airbag
} // namespace google_airbag
#endif // PROCESSOR_STACKWALKER_X86_H__
#endif // PROCESSOR_STACKWALKER_X86_H__