diff options
Diffstat (limited to 'src/processor')
93 files changed, 1053 insertions, 1054 deletions
diff --git a/src/processor/address_map-inl.h b/src/processor/address_map-inl.h index 251c4478..96d955ad 100644 --- a/src/processor/address_map-inl.h +++ b/src/processor/address_map-inl.h @@ -45,8 +45,8 @@ namespace google_breakpad { template<typename AddressType, typename EntryType> -bool AddressMap<AddressType, EntryType>::Store(const AddressType &address, - const EntryType &entry) { +bool AddressMap<AddressType, EntryType>::Store(const AddressType& address, + const EntryType& entry) { // Ensure that the specified address doesn't conflict with something already // in the map. if (map_.find(address) != map_.end()) { @@ -61,8 +61,8 @@ bool AddressMap<AddressType, EntryType>::Store(const AddressType &address, template<typename AddressType, typename EntryType> bool AddressMap<AddressType, EntryType>::Retrieve( - const AddressType &address, - EntryType *entry, AddressType *entry_address) const { + const AddressType& address, + EntryType* entry, AddressType* entry_address) const { BPLOG_IF(ERROR, !entry) << "AddressMap::Retrieve requires |entry|"; assert(entry); diff --git a/src/processor/address_map.h b/src/processor/address_map.h index 2972cbb9..87321a7f 100644 --- a/src/processor/address_map.h +++ b/src/processor/address_map.h @@ -53,15 +53,15 @@ class AddressMap { // Inserts an entry into the map. Returns false without storing the entry // if an entry is already stored in the map at the same address as specified // by the address argument. - bool Store(const AddressType &address, const EntryType &entry); + bool Store(const AddressType& address, const EntryType& entry); // Locates the entry stored at the highest address less than or equal to // the address argument. If there is no such range, returns false. The // entry is returned in entry, which is a required argument. If // entry_address is not NULL, it will be set to the address that the entry // was stored at. - bool Retrieve(const AddressType &address, - EntryType *entry, AddressType *entry_address) const; + bool Retrieve(const AddressType& address, + EntryType* entry, AddressType* entry_address) const; // Empties the address map, restoring it to the same state as when it was // initially created. diff --git a/src/processor/address_map_unittest.cc b/src/processor/address_map_unittest.cc index 9b4095b1..7c85f5eb 100644 --- a/src/processor/address_map_unittest.cc +++ b/src/processor/address_map_unittest.cc @@ -189,7 +189,7 @@ static bool RunTests() { } // namespace -int main(int argc, char **argv) { +int main(int argc, char** argv) { BPLOG_INIT(&argc, &argv); return RunTests() ? 0 : 1; diff --git a/src/processor/basic_code_module.h b/src/processor/basic_code_module.h index 35d66a60..75272897 100644 --- a/src/processor/basic_code_module.h +++ b/src/processor/basic_code_module.h @@ -66,11 +66,11 @@ class BasicCodeModule : public CodeModule { is_unloaded_(that->is_unloaded()) {} BasicCodeModule(uint64_t base_address, uint64_t size, - const string &code_file, - const string &code_identifier, - const string &debug_file, - const string &debug_identifier, - const string &version, + const string& code_file, + const string& code_identifier, + const string& debug_file, + const string& debug_identifier, + const string& version, const bool is_unloaded = false) : base_address_(base_address), size_(size), @@ -112,8 +112,8 @@ class BasicCodeModule : public CodeModule { bool is_unloaded_; // Disallow copy constructor and assignment operator. - BasicCodeModule(const BasicCodeModule &that); - void operator=(const BasicCodeModule &that); + BasicCodeModule(const BasicCodeModule& that); + void operator=(const BasicCodeModule& that); }; } // namespace google_breakpad diff --git a/src/processor/basic_code_modules.h b/src/processor/basic_code_modules.h index 45ebc53b..8c26abb1 100644 --- a/src/processor/basic_code_modules.h +++ b/src/processor/basic_code_modules.h @@ -88,8 +88,8 @@ class BasicCodeModules : public CodeModules { private: // Disallow copy constructor and assignment operator. - BasicCodeModules(const BasicCodeModules &that); - void operator=(const BasicCodeModules &that); + BasicCodeModules(const BasicCodeModules& that); + void operator=(const BasicCodeModules& that); }; } // namespace google_breakpad diff --git a/src/processor/basic_source_line_resolver.cc b/src/processor/basic_source_line_resolver.cc index c4aa949c..64d40015 100644 --- a/src/processor/basic_source_line_resolver.cc +++ b/src/processor/basic_source_line_resolver.cc @@ -69,11 +69,11 @@ namespace { // field, and max_tokens is the maximum number of tokens including the optional // field. Refer to the documentation for Tokenize for descriptions of the other // arguments. -bool TokenizeWithOptionalField(char *line, - const char *optional_field, - const char *separators, +bool TokenizeWithOptionalField(char* line, + const char* optional_field, + const char* separators, int max_tokens, - vector<char*> *tokens) { + vector<char*>* tokens) { // First tokenize assuming the optional field is not present. If we then see // the optional field, additionally tokenize the last token into two tokens. if (!Tokenize(line, separators, max_tokens - 1, tokens)) { @@ -98,7 +98,7 @@ bool TokenizeWithOptionalField(char *line, } // namespace -static const char *kWhitespace = " \r\n"; +static const char* kWhitespace = " \r\n"; static const int kMaxErrorsPrinted = 5; static const int kMaxErrorsBeforeBailing = 100; @@ -107,9 +107,9 @@ BasicSourceLineResolver::BasicSourceLineResolver() : // static void BasicSourceLineResolver::Module::LogParseError( - const string &message, + const string& message, int line_number, - int *num_errors) { + int* num_errors) { if (++(*num_errors) <= kMaxErrorsPrinted) { if (line_number > 0) { BPLOG(ERROR) << "Line " << line_number << ": " << message; @@ -120,12 +120,12 @@ void BasicSourceLineResolver::Module::LogParseError( } bool BasicSourceLineResolver::Module::LoadMapFromMemory( - char *memory_buffer, + char* memory_buffer, size_t memory_buffer_size) { linked_ptr<Function> cur_func; int line_number = 0; int num_errors = 0; - char *save_ptr; + char* save_ptr; // If the length is 0, we can still pretend we have a symbol file. This is // for scenarios that want to test symbol lookup, but don't necessarily care @@ -160,7 +160,7 @@ bool BasicSourceLineResolver::Module::LoadMapFromMemory( &num_errors); } - char *buffer; + char* buffer; buffer = strtok_r(memory_buffer, "\r\n", &save_ptr); while (buffer != NULL) { @@ -207,7 +207,7 @@ bool BasicSourceLineResolver::Module::LoadMapFromMemory( LogParseError("Found source line data without a function", line_number, &num_errors); } else { - Line *line = ParseLine(buffer); + Line* line = ParseLine(buffer); if (!line) { LogParseError("ParseLine failed", line_number, &num_errors); } else { @@ -225,7 +225,7 @@ bool BasicSourceLineResolver::Module::LoadMapFromMemory( return true; } -void BasicSourceLineResolver::Module::LookupAddress(StackFrame *frame) const { +void BasicSourceLineResolver::Module::LookupAddress(StackFrame* frame) const { MemAddr address = frame->instruction - frame->module->base_address(); // First, look for a FUNC record that covers address. Use @@ -264,8 +264,8 @@ void BasicSourceLineResolver::Module::LookupAddress(StackFrame *frame) const { } } -WindowsFrameInfo *BasicSourceLineResolver::Module::FindWindowsFrameInfo( - const StackFrame *frame) const { +WindowsFrameInfo* BasicSourceLineResolver::Module::FindWindowsFrameInfo( + const StackFrame* frame) const { MemAddr address = frame->instruction - frame->module->base_address(); scoped_ptr<WindowsFrameInfo> result(new WindowsFrameInfo()); @@ -313,8 +313,8 @@ WindowsFrameInfo *BasicSourceLineResolver::Module::FindWindowsFrameInfo( return NULL; } -CFIFrameInfo *BasicSourceLineResolver::Module::FindCFIFrameInfo( - const StackFrame *frame) const { +CFIFrameInfo* BasicSourceLineResolver::Module::FindCFIFrameInfo( + const StackFrame* frame) const { MemAddr address = frame->instruction - frame->module->base_address(); MemAddr initial_base, initial_size; string initial_rules; @@ -347,9 +347,9 @@ CFIFrameInfo *BasicSourceLineResolver::Module::FindCFIFrameInfo( return rules.release(); } -bool BasicSourceLineResolver::Module::ParseFile(char *file_line) { +bool BasicSourceLineResolver::Module::ParseFile(char* file_line) { long index; - char *filename; + char* filename; if (SymbolParseHelper::ParseFile(file_line, &index, &filename)) { files_.insert(make_pair(index, string(filename))); return true; @@ -358,12 +358,12 @@ bool BasicSourceLineResolver::Module::ParseFile(char *file_line) { } BasicSourceLineResolver::Function* -BasicSourceLineResolver::Module::ParseFunction(char *function_line) { +BasicSourceLineResolver::Module::ParseFunction(char* function_line) { bool is_multiple; uint64_t address; uint64_t size; long stack_param_size; - char *name; + char* name; if (SymbolParseHelper::ParseFunction(function_line, &is_multiple, &address, &size, &stack_param_size, &name)) { return new Function(name, address, size, stack_param_size, is_multiple); @@ -372,7 +372,7 @@ BasicSourceLineResolver::Module::ParseFunction(char *function_line) { } BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine( - char *line_line) { + char* line_line) { uint64_t address; uint64_t size; long line_number; @@ -385,11 +385,11 @@ BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine( return NULL; } -bool BasicSourceLineResolver::Module::ParsePublicSymbol(char *public_line) { +bool BasicSourceLineResolver::Module::ParsePublicSymbol(char* public_line) { bool is_multiple; uint64_t address; long stack_param_size; - char *name; + char* name; if (SymbolParseHelper::ParsePublicSymbol(public_line, &is_multiple, &address, &stack_param_size, &name)) { @@ -411,7 +411,7 @@ bool BasicSourceLineResolver::Module::ParsePublicSymbol(char *public_line) { return false; } -bool BasicSourceLineResolver::Module::ParseStackInfo(char *stack_info_line) { +bool BasicSourceLineResolver::Module::ParseStackInfo(char* stack_info_line) { // Skip "STACK " prefix. stack_info_line += 6; @@ -419,7 +419,7 @@ bool BasicSourceLineResolver::Module::ParseStackInfo(char *stack_info_line) { // information this is. while (*stack_info_line == ' ') stack_info_line++; - const char *platform = stack_info_line; + const char* platform = stack_info_line; while (!strchr(kWhitespace, *stack_info_line)) stack_info_line++; *stack_info_line++ = '\0'; @@ -468,23 +468,23 @@ bool BasicSourceLineResolver::Module::ParseStackInfo(char *stack_info_line) { } bool BasicSourceLineResolver::Module::ParseCFIFrameInfo( - char *stack_info_line) { - char *cursor; + char* stack_info_line) { + char* cursor; // Is this an INIT record or a delta record? - char *init_or_address = strtok_r(stack_info_line, " \r\n", &cursor); + char* init_or_address = strtok_r(stack_info_line, " \r\n", &cursor); if (!init_or_address) return false; if (strcmp(init_or_address, "INIT") == 0) { // This record has the form "STACK INIT <address> <size> <rules...>". - char *address_field = strtok_r(NULL, " \r\n", &cursor); + char* address_field = strtok_r(NULL, " \r\n", &cursor); if (!address_field) return false; - char *size_field = strtok_r(NULL, " \r\n", &cursor); + char* size_field = strtok_r(NULL, " \r\n", &cursor); if (!size_field) return false; - char *initial_rules = strtok_r(NULL, "\r\n", &cursor); + char* initial_rules = strtok_r(NULL, "\r\n", &cursor); if (!initial_rules) return false; MemAddr address = strtoul(address_field, NULL, 16); @@ -494,8 +494,8 @@ bool BasicSourceLineResolver::Module::ParseCFIFrameInfo( } // This record has the form "STACK <address> <rules...>". - char *address_field = init_or_address; - char *delta_rules = strtok_r(NULL, "\r\n", &cursor); + char* address_field = init_or_address; + char* delta_rules = strtok_r(NULL, "\r\n", &cursor); if (!delta_rules) return false; MemAddr address = strtoul(address_field, NULL, 16); cfi_delta_rules_[address] = delta_rules; @@ -503,8 +503,8 @@ bool BasicSourceLineResolver::Module::ParseCFIFrameInfo( } // static -bool SymbolParseHelper::ParseFile(char *file_line, long *index, - char **filename) { +bool SymbolParseHelper::ParseFile(char* file_line, long* index, + char** filename) { // FILE <id> <filename> assert(strncmp(file_line, "FILE ", 5) == 0); file_line += 5; // skip prefix @@ -514,7 +514,7 @@ bool SymbolParseHelper::ParseFile(char *file_line, long *index, return false; } - char *after_number; + char* after_number; *index = strtol(tokens[0], &after_number, 10); if (!IsValidAfterNumber(after_number) || *index < 0 || *index == std::numeric_limits<long>::max()) { @@ -530,9 +530,9 @@ bool SymbolParseHelper::ParseFile(char *file_line, long *index, } // static -bool SymbolParseHelper::ParseFunction(char *function_line, bool *is_multiple, - uint64_t *address, uint64_t *size, - long *stack_param_size, char **name) { +bool SymbolParseHelper::ParseFunction(char* function_line, bool* is_multiple, + uint64_t* address, uint64_t* size, + long* stack_param_size, char** name) { // FUNC [<multiple>] <address> <size> <stack_param_size> <name> assert(strncmp(function_line, "FUNC ", 5) == 0); function_line += 5; // skip prefix @@ -545,7 +545,7 @@ bool SymbolParseHelper::ParseFunction(char *function_line, bool *is_multiple, *is_multiple = strcmp(tokens[0], "m") == 0; int next_token = *is_multiple ? 1 : 0; - char *after_number; + char* after_number; *address = strtoull(tokens[next_token++], &after_number, 16); if (!IsValidAfterNumber(after_number) || *address == std::numeric_limits<unsigned long long>::max()) { @@ -568,16 +568,16 @@ bool SymbolParseHelper::ParseFunction(char *function_line, bool *is_multiple, } // static -bool SymbolParseHelper::ParseLine(char *line_line, uint64_t *address, - uint64_t *size, long *line_number, - long *source_file) { +bool SymbolParseHelper::ParseLine(char* line_line, uint64_t* address, + uint64_t* size, long* line_number, + long* source_file) { // <address> <size> <line number> <source file id> vector<char*> tokens; if (!Tokenize(line_line, kWhitespace, 4, &tokens)) { return false; } - char *after_number; + char* after_number; *address = strtoull(tokens[0], &after_number, 16); if (!IsValidAfterNumber(after_number) || *address == std::numeric_limits<unsigned long long>::max()) { @@ -613,10 +613,10 @@ bool SymbolParseHelper::ParseLine(char *line_line, uint64_t *address, } // static -bool SymbolParseHelper::ParsePublicSymbol(char *public_line, bool *is_multiple, - uint64_t *address, - long *stack_param_size, - char **name) { +bool SymbolParseHelper::ParsePublicSymbol(char* public_line, bool* is_multiple, + uint64_t* address, + long* stack_param_size, + char** name) { // PUBLIC [<multiple>] <address> <stack_param_size> <name> assert(strncmp(public_line, "PUBLIC ", 7) == 0); public_line += 7; // skip prefix @@ -629,7 +629,7 @@ bool SymbolParseHelper::ParsePublicSymbol(char *public_line, bool *is_multiple, *is_multiple = strcmp(tokens[0], "m") == 0; int next_token = *is_multiple ? 1 : 0; - char *after_number; + char* after_number; *address = strtoull(tokens[next_token++], &after_number, 16); if (!IsValidAfterNumber(after_number) || *address == std::numeric_limits<unsigned long long>::max()) { @@ -647,7 +647,7 @@ bool SymbolParseHelper::ParsePublicSymbol(char *public_line, bool *is_multiple, } // static -bool SymbolParseHelper::IsValidAfterNumber(char *after_number) { +bool SymbolParseHelper::IsValidAfterNumber(char* after_number) { if (after_number != NULL && strchr(kWhitespace, *after_number) != NULL) { return true; } diff --git a/src/processor/basic_source_line_resolver_types.h b/src/processor/basic_source_line_resolver_types.h index 89eb57e8..c103040d 100644 --- a/src/processor/basic_source_line_resolver_types.h +++ b/src/processor/basic_source_line_resolver_types.h @@ -57,7 +57,7 @@ namespace google_breakpad { struct BasicSourceLineResolver::Function : public SourceLineResolverBase::Function { - Function(const string &function_name, + Function(const string& function_name, MemAddr function_address, MemAddr code_size, int set_parameter_size, @@ -75,7 +75,7 @@ BasicSourceLineResolver::Function : public SourceLineResolverBase::Function { class BasicSourceLineResolver::Module : public SourceLineResolverBase::Module { public: - explicit Module(const string &name) : name_(name), is_corrupt_(false) { } + explicit Module(const string& name) : name_(name), is_corrupt_(false) { } virtual ~Module() { } // Loads a map from the given buffer in char* type. @@ -83,7 +83,7 @@ class BasicSourceLineResolver::Module : public SourceLineResolverBase::Module { // The passed in |memory buffer| is of size |memory_buffer_size|. If it is // not null terminated, LoadMapFromMemory() will null terminate it by // modifying the passed in buffer. - virtual bool LoadMapFromMemory(char *memory_buffer, + virtual bool LoadMapFromMemory(char* memory_buffer, size_t memory_buffer_size); // Tells whether the loaded symbol data is corrupt. Return value is @@ -92,20 +92,20 @@ class BasicSourceLineResolver::Module : public SourceLineResolverBase::Module { // Looks up the given relative address, and fills the StackFrame struct // with the result. - virtual void LookupAddress(StackFrame *frame) const; + virtual void LookupAddress(StackFrame* frame) const; // If Windows stack walking information is available covering ADDRESS, // return a WindowsFrameInfo structure describing it. If the information // is not available, returns NULL. A NULL return value does not indicate // an error. The caller takes ownership of any returned WindowsFrameInfo // object. - virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame) const; + virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame) const; // If CFI stack walking information is available covering ADDRESS, // return a CFIFrameInfo structure describing it. If the information // is not available, return NULL. The caller takes ownership of any // returned CFIFrameInfo object. - virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame) const; + virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame) const; private: // Friend declarations. @@ -118,29 +118,29 @@ class BasicSourceLineResolver::Module : public SourceLineResolverBase::Module { // Logs parse errors. |*num_errors| is increased every time LogParseError is // called. static void LogParseError( - const string &message, + const string& message, int line_number, - int *num_errors); + int* num_errors); // Parses a file declaration - bool ParseFile(char *file_line); + bool ParseFile(char* file_line); // Parses a function declaration, returning a new Function object. - Function* ParseFunction(char *function_line); + Function* ParseFunction(char* function_line); // Parses a line declaration, returning a new Line object. - Line* ParseLine(char *line_line); + Line* ParseLine(char* line_line); // Parses a PUBLIC symbol declaration, storing it in public_symbols_. // Returns false if an error occurs. - bool ParsePublicSymbol(char *public_line); + bool ParsePublicSymbol(char* public_line); // Parses a STACK WIN or STACK CFI frame info declaration, storing // it in the appropriate table. - bool ParseStackInfo(char *stack_info_line); + bool ParseStackInfo(char* stack_info_line); // Parses a STACK CFI record, storing it in cfi_frame_info_. - bool ParseCFIFrameInfo(char *stack_info_line); + bool ParseCFIFrameInfo(char* stack_info_line); string name_; FileMap files_; diff --git a/src/processor/basic_source_line_resolver_unittest.cc b/src/processor/basic_source_line_resolver_unittest.cc index 90c34172..2cb2967c 100644 --- a/src/processor/basic_source_line_resolver_unittest.cc +++ b/src/processor/basic_source_line_resolver_unittest.cc @@ -83,15 +83,15 @@ class TestCodeModule : public CodeModule { class MockMemoryRegion: public MemoryRegion { uint64_t GetBase() const { return 0x10000; } uint32_t GetSize() const { return 0x01000; } - bool GetMemoryAtAddress(uint64_t address, uint8_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const { *value = address & 0xff; return true; } - bool GetMemoryAtAddress(uint64_t address, uint16_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const { *value = address & 0xffff; return true; } - bool GetMemoryAtAddress(uint64_t address, uint32_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const { switch (address) { case 0x10008: *value = 0x98ecadc3; break; // saved %ebx case 0x1000c: *value = 0x878f7524; break; // saved %esi @@ -102,7 +102,7 @@ class MockMemoryRegion: public MemoryRegion { } return true; } - bool GetMemoryAtAddress(uint64_t address, uint64_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const { *value = address; return true; } @@ -116,9 +116,9 @@ class MockMemoryRegion: public MemoryRegion { // EXPECTED's.) Also verify that ACTUAL has associations for ".ra" and // ".cfa". static bool VerifyRegisters( - const char *file, int line, - const CFIFrameInfo::RegisterValueMap<uint32_t> &expected, - const CFIFrameInfo::RegisterValueMap<uint32_t> &actual) { + const char* file, int line, + const CFIFrameInfo::RegisterValueMap<uint32_t>& expected, + const CFIFrameInfo::RegisterValueMap<uint32_t>& actual) { CFIFrameInfo::RegisterValueMap<uint32_t>::const_iterator a; a = actual.find(".cfa"); if (a == actual.end()) @@ -148,7 +148,7 @@ static bool VerifyRegisters( } -static bool VerifyEmpty(const StackFrame &frame) { +static bool VerifyEmpty(const StackFrame& frame) { if (frame.function_name.empty() && frame.source_file_name.empty() && frame.source_line == 0) @@ -156,7 +156,7 @@ static bool VerifyEmpty(const StackFrame &frame) { return false; } -static void ClearSourceLineInfo(StackFrame *frame) { +static void ClearSourceLineInfo(StackFrame* frame) { frame->function_name.clear(); frame->module = NULL; frame->source_file_name.clear(); @@ -417,7 +417,7 @@ TEST_F(TestBasicSourceLineResolver, TestUnload) // FILE <id> <filename> TEST(SymbolParseHelper, ParseFileValid) { long index; - char *filename; + char* filename; char kTestLine[] = "FILE 1 file name"; ASSERT_TRUE(SymbolParseHelper::ParseFile(kTestLine, &index, &filename)); @@ -435,7 +435,7 @@ TEST(SymbolParseHelper, ParseFileValid) { // FILE <id> <filename> TEST(SymbolParseHelper, ParseFileInvalid) { long index; - char *filename; + char* filename; // Test missing file name. char kTestLine[] = "FILE 1 "; @@ -461,7 +461,7 @@ TEST(SymbolParseHelper, ParseFunctionValid) { uint64_t address; uint64_t size; long stack_param_size; - char *name; + char* name; char kTestLine[] = "FUNC 1 2 3 function name"; ASSERT_TRUE(SymbolParseHelper::ParseFunction(kTestLine, &multiple, &address, @@ -513,7 +513,7 @@ TEST(SymbolParseHelper, ParseFunctionInvalid) { uint64_t address; uint64_t size; long stack_param_size; - char *name; + char* name; // Test missing function name. char kTestLine[] = "FUNC 1 2 3 "; @@ -649,7 +649,7 @@ TEST(SymbolParseHelper, ParsePublicSymbolValid) { bool multiple; uint64_t address; long stack_param_size; - char *name; + char* name; char kTestLine[] = "PUBLIC 1 2 3"; ASSERT_TRUE(SymbolParseHelper::ParsePublicSymbol(kTestLine, &multiple, @@ -697,7 +697,7 @@ TEST(SymbolParseHelper, ParsePublicSymbolInvalid) { bool multiple; uint64_t address; long stack_param_size; - char *name; + char* name; // Test missing source function name. char kTestLine[] = "PUBLIC 1 2 "; @@ -738,7 +738,7 @@ TEST(SymbolParseHelper, ParsePublicSymbolInvalid) { } // namespace -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/src/processor/call_stack.cc b/src/processor/call_stack.cc index 925f0846..f219e843 100644 --- a/src/processor/call_stack.cc +++ b/src/processor/call_stack.cc @@ -43,7 +43,7 @@ CallStack::~CallStack() { } void CallStack::Clear() { - for (vector<StackFrame *>::const_iterator iterator = frames_.begin(); + for (vector<StackFrame*>::const_iterator iterator = frames_.begin(); iterator != frames_.end(); ++iterator) { delete *iterator; diff --git a/src/processor/cfi_frame_info-inl.h b/src/processor/cfi_frame_info-inl.h index 7e7af0af..52d2f5fc 100644 --- a/src/processor/cfi_frame_info-inl.h +++ b/src/processor/cfi_frame_info-inl.h @@ -42,12 +42,12 @@ namespace google_breakpad { template <typename RegisterType, class RawContextType> bool SimpleCFIWalker<RegisterType, RawContextType>::FindCallerRegisters( - const MemoryRegion &memory, - const CFIFrameInfo &cfi_frame_info, - const RawContextType &callee_context, + const MemoryRegion& memory, + const CFIFrameInfo& cfi_frame_info, + const RawContextType& callee_context, int callee_validity, - RawContextType *caller_context, - int *caller_validity) const { + RawContextType* caller_context, + int* caller_validity) const { typedef CFIFrameInfo::RegisterValueMap<RegisterType> ValueMap; ValueMap callee_registers; ValueMap caller_registers; @@ -56,7 +56,7 @@ bool SimpleCFIWalker<RegisterType, RawContextType>::FindCallerRegisters( // Populate callee_registers with register values from callee_context. for (size_t i = 0; i < map_size_; i++) { - const RegisterSet &r = register_map_[i]; + const RegisterSet& r = register_map_[i]; if (callee_validity & r.validity_flag) callee_registers[r.name] = callee_context.*r.context_member; } @@ -71,7 +71,7 @@ bool SimpleCFIWalker<RegisterType, RawContextType>::FindCallerRegisters( memset(caller_context, 0xda, sizeof(*caller_context)); *caller_validity = 0; for (size_t i = 0; i < map_size_; i++) { - const RegisterSet &r = register_map_[i]; + const RegisterSet& r = register_map_[i]; typename ValueMap::const_iterator caller_entry; // Did the rules provide a value for this register by its name? diff --git a/src/processor/cfi_frame_info.cc b/src/processor/cfi_frame_info.cc index 0c4af7ba..280620f2 100644 --- a/src/processor/cfi_frame_info.cc +++ b/src/processor/cfi_frame_info.cc @@ -48,9 +48,9 @@ namespace google_breakpad { #endif template<typename V> -bool CFIFrameInfo::FindCallerRegs(const RegisterValueMap<V> ®isters, - const MemoryRegion &memory, - RegisterValueMap<V> *caller_registers) const { +bool CFIFrameInfo::FindCallerRegs(const RegisterValueMap<V>& registers, + const MemoryRegion& memory, + RegisterValueMap<V>* caller_registers) const { // If there are not rules for both .ra and .cfa in effect at this address, // don't use this CFI data for stack walking. if (cfa_rule_.empty() || ra_rule_.empty()) @@ -93,13 +93,13 @@ bool CFIFrameInfo::FindCallerRegs(const RegisterValueMap<V> ®isters, // Explicit instantiations for 32-bit and 64-bit architectures. template bool CFIFrameInfo::FindCallerRegs<uint32_t>( - const RegisterValueMap<uint32_t> ®isters, - const MemoryRegion &memory, - RegisterValueMap<uint32_t> *caller_registers) const; + const RegisterValueMap<uint32_t>& registers, + const MemoryRegion& memory, + RegisterValueMap<uint32_t>* caller_registers) const; template bool CFIFrameInfo::FindCallerRegs<uint64_t>( - const RegisterValueMap<uint64_t> ®isters, - const MemoryRegion &memory, - RegisterValueMap<uint64_t> *caller_registers) const; + const RegisterValueMap<uint64_t>& registers, + const MemoryRegion& memory, + RegisterValueMap<uint64_t>* caller_registers) const; string CFIFrameInfo::Serialize() const { std::ostringstream stream; @@ -123,7 +123,7 @@ string CFIFrameInfo::Serialize() const { return stream.str(); } -bool CFIRuleParser::Parse(const string &rule_set) { +bool CFIRuleParser::Parse(const string& rule_set) { size_t rule_set_len = rule_set.size(); scoped_array<char> working_copy(new char[rule_set_len + 1]); memcpy(working_copy.get(), rule_set.data(), rule_set_len); @@ -132,9 +132,9 @@ bool CFIRuleParser::Parse(const string &rule_set) { name_.clear(); expression_.clear(); - char *cursor; + char* cursor; static const char token_breaks[] = " \t\r\n"; - char *token = strtok_r(working_copy.get(), token_breaks, &cursor); + char* token = strtok_r(working_copy.get(), token_breaks, &cursor); for (;;) { // End of rule set? @@ -170,16 +170,16 @@ bool CFIRuleParser::Report() { return true; } -void CFIFrameInfoParseHandler::CFARule(const string &expression) { +void CFIFrameInfoParseHandler::CFARule(const string& expression) { frame_info_->SetCFARule(expression); } -void CFIFrameInfoParseHandler::RARule(const string &expression) { +void CFIFrameInfoParseHandler::RARule(const string& expression) { frame_info_->SetRARule(expression); } -void CFIFrameInfoParseHandler::RegisterRule(const string &name, - const string &expression) { +void CFIFrameInfoParseHandler::RegisterRule(const string& name, + const string& expression) { frame_info_->SetRegisterRule(name, expression); } diff --git a/src/processor/cfi_frame_info.h b/src/processor/cfi_frame_info.h index 90a1b3d7..2bc93336 100644 --- a/src/processor/cfi_frame_info.h +++ b/src/processor/cfi_frame_info.h @@ -72,9 +72,9 @@ class CFIFrameInfo { // Set the expression for computing a call frame address, return // address, or register's value. At least the CFA rule and the RA // rule must be set before calling FindCallerRegs. - void SetCFARule(const string &expression) { cfa_rule_ = expression; } - void SetRARule(const string &expression) { ra_rule_ = expression; } - void SetRegisterRule(const string ®ister_name, const string &expression) { + void SetCFARule(const string& expression) { cfa_rule_ = expression; } + void SetRARule(const string& expression) { ra_rule_ = expression; } + void SetRegisterRule(const string& register_name, const string& expression) { register_rules_[register_name] = expression; } @@ -96,9 +96,9 @@ class CFIFrameInfo { // These may be helpful in computing the caller's PC and stack // pointer, if their values are not explicitly specified. template<typename ValueType> - bool FindCallerRegs(const RegisterValueMap<ValueType> ®isters, - const MemoryRegion &memory, - RegisterValueMap<ValueType> *caller_registers) const; + bool FindCallerRegs(const RegisterValueMap<ValueType>& registers, + const MemoryRegion& memory, + RegisterValueMap<ValueType>* caller_registers) const; // Serialize the rules in this object into a string in the format // of STACK CFI records. @@ -148,28 +148,28 @@ class CFIRuleParser { virtual ~Handler() { } // The input specifies EXPRESSION as the CFA/RA computation rule. - virtual void CFARule(const string &expression) = 0; - virtual void RARule(const string &expression) = 0; + virtual void CFARule(const string& expression) = 0; + virtual void RARule(const string& expression) = 0; // The input specifies EXPRESSION as the recovery rule for register NAME. - virtual void RegisterRule(const string &name, const string &expression) = 0; + virtual void RegisterRule(const string& name, const string& expression) = 0; }; // Construct a parser which feeds its results to HANDLER. - CFIRuleParser(Handler *handler) : handler_(handler) { } + CFIRuleParser(Handler* handler) : handler_(handler) { } // Parse RULE_SET as a set of CFA computation and RA/register // recovery rules, as appearing in STACK CFI records. Report the // results of parsing by making the appropriate calls to handler_. // Return true if parsing was successful, false otherwise. - bool Parse(const string &rule_set); + bool Parse(const string& rule_set); private: // Report any accumulated rule to handler_ bool Report(); // The handler to which the parser reports its findings. - Handler *handler_; + Handler* handler_; // Working data. string name_, expression_; @@ -180,15 +180,15 @@ class CFIRuleParser { class CFIFrameInfoParseHandler: public CFIRuleParser::Handler { public: // Populate FRAME_INFO with the results of parsing. - CFIFrameInfoParseHandler(CFIFrameInfo *frame_info) + CFIFrameInfoParseHandler(CFIFrameInfo* frame_info) : frame_info_(frame_info) { } - void CFARule(const string &expression); - void RARule(const string &expression); - void RegisterRule(const string &name, const string &expression); + void CFARule(const string& expression); + void RARule(const string& expression); + void RegisterRule(const string& name, const string& expression); private: - CFIFrameInfo *frame_info_; + CFIFrameInfo* frame_info_; }; // A utility class template for simple 'STACK CFI'-driven stack walkers. @@ -212,14 +212,14 @@ class SimpleCFIWalker { // A structure describing one architecture register. struct RegisterSet { // The register name, as it appears in STACK CFI rules. - const char *name; + const char* name; // An alternate name that the register's value might be found // under in a register value dictionary, or NULL. When generating // names, prefer NAME to this value. It's common to list ".cfa" as // an alternative name for the stack pointer, and ".ra" as an // alternative name for the instruction pointer. - const char *alternate_name; + const char* alternate_name; // True if the callee is expected to preserve the value of this // register. If this flag is true for some register R, and the STACK @@ -240,7 +240,7 @@ class SimpleCFIWalker { // architecture's register set. REGISTER_MAP is an array of // RegisterSet structures; MAP_SIZE is the number of elements in the // array. - SimpleCFIWalker(const RegisterSet *register_map, size_t map_size) + SimpleCFIWalker(const RegisterSet* register_map, size_t map_size) : register_map_(register_map), map_size_(map_size) { } // Compute the calling frame's raw context given the callee's raw @@ -256,15 +256,15 @@ class SimpleCFIWalker { // fill in CALLER_CONTEXT with the caller's register values, and set // CALLER_VALIDITY to indicate which registers are valid in // CALLER_CONTEXT. Return true on success, or false on failure. - bool FindCallerRegisters(const MemoryRegion &memory, - const CFIFrameInfo &cfi_frame_info, - const RawContextType &callee_context, + bool FindCallerRegisters(const MemoryRegion& memory, + const CFIFrameInfo& cfi_frame_info, + const RawContextType& callee_context, int callee_validity, - RawContextType *caller_context, - int *caller_validity) const; + RawContextType* caller_context, + int* caller_validity) const; private: - const RegisterSet *register_map_; + const RegisterSet* register_map_; size_t map_size_; }; diff --git a/src/processor/cfi_frame_info_unittest.cc b/src/processor/cfi_frame_info_unittest.cc index 542b2849..8111437a 100644 --- a/src/processor/cfi_frame_info_unittest.cc +++ b/src/processor/cfi_frame_info_unittest.cc @@ -56,10 +56,10 @@ class MockMemoryRegion: public MemoryRegion { public: MOCK_CONST_METHOD0(GetBase, uint64_t()); MOCK_CONST_METHOD0(GetSize, uint32_t()); - MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint8_t *)); - MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint16_t *)); - MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint32_t *)); - MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint64_t *)); + MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint8_t*)); + MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint16_t*)); + MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint32_t*)); + MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint64_t*)); MOCK_CONST_METHOD0(Print, void()); }; @@ -70,10 +70,10 @@ struct CFIFixture { void ExpectNoMemoryReferences() { EXPECT_CALL(memory, GetBase()).Times(0); EXPECT_CALL(memory, GetSize()).Times(0); - EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint8_t *>())).Times(0); - EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint16_t *>())).Times(0); - EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint32_t *>())).Times(0); - EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint64_t *>())).Times(0); + EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint8_t*>())).Times(0); + EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint16_t*>())).Times(0); + EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint32_t*>())).Times(0); + EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint64_t*>())).Times(0); } CFIFrameInfo cfi; @@ -292,9 +292,9 @@ TEST_F(Scope, SeparateTempsRA) { class MockCFIRuleParserHandler: public CFIRuleParser::Handler { public: - MOCK_METHOD1(CFARule, void(const string &)); - MOCK_METHOD1(RARule, void(const string &)); - MOCK_METHOD2(RegisterRule, void(const string &, const string &)); + MOCK_METHOD1(CFARule, void(const string&)); + MOCK_METHOD1(RARule, void(const string&)); + MOCK_METHOD2(RegisterRule, void(const string&, const string&)); }; // A fixture class for testing CFIRuleParser. @@ -509,12 +509,12 @@ TEST_F(SimpleWalker, Walk) { // Saved r0. EXPECT_CALL(memory, - GetMemoryAtAddress(stack_top, A<uint64_t *>())) + GetMemoryAtAddress(stack_top, A<uint64_t*>())) .WillRepeatedly(DoAll(SetArgumentPointee<1>(0xdc1975eba8602302ULL), Return(true))); // Saved return address. EXPECT_CALL(memory, - GetMemoryAtAddress(stack_top + 16, A<uint64_t *>())) + GetMemoryAtAddress(stack_top + 16, A<uint64_t*>())) .WillRepeatedly(DoAll(SetArgumentPointee<1>(0xba5ad6d9acce28deULL), Return(true))); diff --git a/src/processor/contained_range_map-inl.h b/src/processor/contained_range_map-inl.h index 4c0ad41f..edd11d7c 100644 --- a/src/processor/contained_range_map-inl.h +++ b/src/processor/contained_range_map-inl.h @@ -55,7 +55,7 @@ ContainedRangeMap<AddressType, EntryType>::~ContainedRangeMap() { template<typename AddressType, typename EntryType> bool ContainedRangeMap<AddressType, EntryType>::StoreRange( - const AddressType &base, const AddressType &size, const EntryType &entry) { + const AddressType& base, const AddressType& size, const EntryType& entry) { AddressType high = base + size - 1; // Check for undersize or overflow. @@ -125,7 +125,7 @@ bool ContainedRangeMap<AddressType, EntryType>::StoreRange( // Optimization: if the iterators are equal, no child ranges would be // moved. Create the new child range with a NULL map to conserve space // in leaf nodes, of which there will be many. - AddressToRangeMap *child_map = NULL; + AddressToRangeMap* child_map = NULL; if (iterator_base != iterator_high) { // The children of this range that are contained by the new range must @@ -149,7 +149,7 @@ bool ContainedRangeMap<AddressType, EntryType>::StoreRange( template<typename AddressType, typename EntryType> bool ContainedRangeMap<AddressType, EntryType>::RetrieveRange( - const AddressType &address, EntryType *entry) const { + const AddressType& address, EntryType* entry) const { BPLOG_IF(ERROR, !entry) << "ContainedRangeMap::RetrieveRange requires " "|entry|"; assert(entry); diff --git a/src/processor/contained_range_map.h b/src/processor/contained_range_map.h index 1015ae8c..18d03af7 100644 --- a/src/processor/contained_range_map.h +++ b/src/processor/contained_range_map.h @@ -86,16 +86,16 @@ class ContainedRangeMap { // grandchildren of this ContainedRangeMap. Returns false for a // parameter error, or if the ContainedRangeMap hierarchy guarantees // would be violated. - bool StoreRange(const AddressType &base, - const AddressType &size, - const EntryType &entry); + 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 // to support a sparsely-populated root range. If no descendant range // encompasses the address, returns false. - bool RetrieveRange(const AddressType &address, EntryType *entry) const; + bool RetrieveRange(const AddressType& address, EntryType* entry) const; // Removes all children. Note that Clear only removes descendants, // leaving the node on which it is called intact. Because the only @@ -110,7 +110,7 @@ class ContainedRangeMap { // AddressToRangeMap stores pointers. This makes reparenting simpler in // StoreRange, because it doesn't need to copy entire objects. - typedef std::map<AddressType, ContainedRangeMap *> AddressToRangeMap; + typedef std::map<AddressType, ContainedRangeMap*> AddressToRangeMap; typedef typename AddressToRangeMap::const_iterator MapConstIterator; typedef typename AddressToRangeMap::iterator MapIterator; typedef typename AddressToRangeMap::value_type MapValue; @@ -118,8 +118,8 @@ class ContainedRangeMap { // Creates a new ContainedRangeMap with the specified base address, entry, // and initial child map, which may be NULL. This is only used internally // by ContainedRangeMap when it creates a new child. - ContainedRangeMap(const AddressType &base, const EntryType &entry, - AddressToRangeMap *map) + ContainedRangeMap(const AddressType& base, const EntryType& entry, + AddressToRangeMap* map) : base_(base), entry_(entry), map_(map) {} // The base address of this range. The high address does not need to @@ -140,7 +140,7 @@ class ContainedRangeMap { // The map containing child ranges, keyed by each child range's high // address. This is a pointer to avoid allocating map structures for // leaf nodes, where they are not needed. - AddressToRangeMap *map_; + AddressToRangeMap* map_; }; diff --git a/src/processor/contained_range_map_unittest.cc b/src/processor/contained_range_map_unittest.cc index e5910da0..a97c5d0f 100644 --- a/src/processor/contained_range_map_unittest.cc +++ b/src/processor/contained_range_map_unittest.cc @@ -256,7 +256,7 @@ static bool RunTests() { } // namespace -int main(int argc, char **argv) { +int main(int argc, char** argv) { BPLOG_INIT(&argc, &argv); return RunTests() ? 0 : 1; diff --git a/src/processor/disassembler_x86.cc b/src/processor/disassembler_x86.cc index 55902240..01267678 100644 --- a/src/processor/disassembler_x86.cc +++ b/src/processor/disassembler_x86.cc @@ -30,7 +30,7 @@ namespace google_breakpad { -DisassemblerX86::DisassemblerX86(const uint8_t *bytecode, +DisassemblerX86::DisassemblerX86(const uint8_t* bytecode, uint32_t size, uint32_t virtual_address) : bytecode_(bytecode), @@ -62,7 +62,7 @@ uint32_t DisassemblerX86::NextInstruction() { return 0; } uint32_t instr_size = 0; - instr_size = libdis::x86_disasm((unsigned char *)bytecode_, size_, + instr_size = libdis::x86_disasm((unsigned char*)bytecode_, size_, virtual_address_, current_byte_offset_, ¤t_instr_); if (instr_size == 0) { @@ -78,8 +78,8 @@ uint32_t DisassemblerX86::NextInstruction() { if (current_instr_.type == libdis::insn_return) end_of_block_ = true; - libdis::x86_op_t *src = libdis::x86_get_src_operand(¤t_instr_); - libdis::x86_op_t *dest = libdis::x86_get_dest_operand(¤t_instr_); + libdis::x86_op_t* src = libdis::x86_get_src_operand(¤t_instr_); + libdis::x86_op_t* dest = libdis::x86_get_dest_operand(¤t_instr_); if (register_valid_) { switch (current_instr_.group) { @@ -213,7 +213,7 @@ bool DisassemblerX86::setBadRead() { if (!instr_valid_) return false; - libdis::x86_op_t *operand = libdis::x86_get_src_operand(¤t_instr_); + libdis::x86_op_t* operand = libdis::x86_get_src_operand(¤t_instr_); if (!operand || operand->type != libdis::op_expression) return false; @@ -227,7 +227,7 @@ bool DisassemblerX86::setBadWrite() { if (!instr_valid_) return false; - libdis::x86_op_t *operand = libdis::x86_get_dest_operand(¤t_instr_); + libdis::x86_op_t* operand = libdis::x86_get_dest_operand(¤t_instr_); if (!operand || operand->type != libdis::op_expression) return false; diff --git a/src/processor/disassembler_x86.h b/src/processor/disassembler_x86.h index 71069410..ca65b6e8 100644 --- a/src/processor/disassembler_x86.h +++ b/src/processor/disassembler_x86.h @@ -63,7 +63,7 @@ class DisassemblerX86 { // TODO(cdn): Modify this class to take a MemoryRegion instead of just // a raw buffer. This will make it easier to use this on arbitrary // minidumps without first copying out the code segment. - DisassemblerX86(const uint8_t *bytecode, uint32_t, uint32_t); + DisassemblerX86(const uint8_t* bytecode, uint32_t, uint32_t); ~DisassemblerX86(); // This walks to the next instruction in the memory region and @@ -102,7 +102,7 @@ class DisassemblerX86 { bool setBadWrite(); protected: - const uint8_t *bytecode_; + const uint8_t* bytecode_; uint32_t size_; uint32_t virtual_address_; uint32_t current_byte_offset_; diff --git a/src/processor/exploitability_linux.cc b/src/processor/exploitability_linux.cc index ccc9f145..798056df 100644 --- a/src/processor/exploitability_linux.cc +++ b/src/processor/exploitability_linux.cc @@ -77,13 +77,13 @@ const unsigned int MAX_OBJDUMP_BUFFER_LEN = 4096; namespace google_breakpad { -ExploitabilityLinux::ExploitabilityLinux(Minidump *dump, - ProcessState *process_state) +ExploitabilityLinux::ExploitabilityLinux(Minidump* dump, + ProcessState* process_state) : Exploitability(dump, process_state), enable_objdump_(false) { } -ExploitabilityLinux::ExploitabilityLinux(Minidump *dump, - ProcessState *process_state, +ExploitabilityLinux::ExploitabilityLinux(Minidump* dump, + ProcessState* process_state, bool enable_objdump) : Exploitability(dump, process_state), enable_objdump_(enable_objdump) { } @@ -111,12 +111,12 @@ ExploitabilityRating ExploitabilityLinux::CheckPlatformExploitability() { } // Getting exception data. (It should exist for all minidumps.) - MinidumpException *exception = dump_->GetException(); + MinidumpException* exception = dump_->GetException(); if (exception == NULL) { BPLOG(INFO) << "No exception record."; return EXPLOITABILITY_ERR_PROCESSING; } - const MDRawExceptionStream *raw_exception_stream = exception->exception(); + const MDRawExceptionStream* raw_exception_stream = exception->exception(); if (raw_exception_stream == NULL) { BPLOG(INFO) << "No raw exception stream."; return EXPLOITABILITY_ERR_PROCESSING; @@ -132,7 +132,7 @@ ExploitabilityRating ExploitabilityLinux::CheckPlatformExploitability() { uint64_t instruction_ptr = 0; uint64_t stack_ptr = 0; - const MinidumpContext *context = exception->GetContext(); + const MinidumpContext* context = exception->GetContext(); if (context == NULL) { BPLOG(INFO) << "No exception context."; return EXPLOITABILITY_ERR_PROCESSING; @@ -174,8 +174,8 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) { BPLOG(INFO) << "MinGW does not support fork and exec. Terminating method."; #else // Get memory region containing instruction pointer. - MinidumpMemoryList *memory_list = dump_->GetMemoryList(); - MinidumpMemoryRegion *memory_region = + MinidumpMemoryList* memory_list = dump_->GetMemoryList(); + MinidumpMemoryRegion* memory_region = memory_list ? memory_list->GetMemoryRegionForAddress(instruction_ptr) : NULL; if (!memory_region) { @@ -185,15 +185,15 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) { // Get exception data to find architecture. string architecture = ""; - MinidumpException *exception = dump_->GetException(); + MinidumpException* exception = dump_->GetException(); // This should never evaluate to true, since this should not be reachable // without checking for exception data earlier. if (!exception) { BPLOG(INFO) << "No exception data."; return false; } - const MDRawExceptionStream *raw_exception_stream = exception->exception(); - const MinidumpContext *context = exception->GetContext(); + const MDRawExceptionStream* raw_exception_stream = exception->exception(); + const MinidumpContext* context = exception->GetContext(); // This should not evaluate to true, for the same reason mentioned above. if (!raw_exception_stream || !context) { BPLOG(INFO) << "No exception or architecture data."; @@ -217,7 +217,7 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) { // Get memory region around instruction pointer and the number of bytes // before and after the instruction pointer in the memory region. - const uint8_t *raw_memory = memory_region->GetMemory(); + const uint8_t* raw_memory = memory_region->GetMemory(); const uint64_t base = memory_region->GetBase(); if (base > instruction_ptr) { BPLOG(ERROR) << "Memory region base value exceeds instruction pointer."; @@ -275,9 +275,9 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) { } #ifndef _WIN32 -bool ExploitabilityLinux::CalculateAddress(const string &address_expression, - const DumpContext &context, - uint64_t *write_address) { +bool ExploitabilityLinux::CalculateAddress(const string& address_expression, + const DumpContext& context, + uint64_t* write_address) { // The destination should be the format reg+a or reg-a, where reg // is a register and a is a hexadecimal constant. Although more complex // expressions can make valid instructions, objdump's disassembly outputs @@ -395,8 +395,8 @@ bool ExploitabilityLinux::CalculateAddress(const string &address_expression, // static bool ExploitabilityLinux::GetObjdumpInstructionLine( - const char *objdump_output_buffer, - string *instruction_line) { + const char* objdump_output_buffer, + string* instruction_line) { // Put buffer data into stream to output line-by-line. std::stringstream objdump_stream; objdump_stream.str(string(objdump_output_buffer)); @@ -420,10 +420,10 @@ bool ExploitabilityLinux::GetObjdumpInstructionLine( return true; } -bool ExploitabilityLinux::TokenizeObjdumpInstruction(const string &line, - string *operation, - string *dest, - string *src) { +bool ExploitabilityLinux::TokenizeObjdumpInstruction(const string& line, + string* operation, + string* dest, + string* src) { if (!operation || !dest || !src) { BPLOG(ERROR) << "Null parameters passed."; return false; @@ -483,10 +483,10 @@ bool ExploitabilityLinux::TokenizeObjdumpInstruction(const string &line, return true; } -bool ExploitabilityLinux::DisassembleBytes(const string &architecture, - const uint8_t *raw_bytes, +bool ExploitabilityLinux::DisassembleBytes(const string& architecture, + const uint8_t* raw_bytes, const unsigned int buffer_len, - char *objdump_output_buffer) { + char* objdump_output_buffer) { if (!raw_bytes || !objdump_output_buffer) { BPLOG(ERROR) << "Bad input parameters."; return false; @@ -514,7 +514,7 @@ bool ExploitabilityLinux::DisassembleBytes(const string &architecture, "objdump -D -b binary -M intel -m %s %s", architecture.c_str(), raw_bytes_tmpfile); - FILE *objdump_fp = popen(cmd, "r"); + FILE* objdump_fp = popen(cmd, "r"); if (!objdump_fp) { fclose(objdump_fp); unlink(raw_bytes_tmpfile); @@ -534,12 +534,12 @@ bool ExploitabilityLinux::DisassembleBytes(const string &architecture, #endif // _WIN32 bool ExploitabilityLinux::StackPointerOffStack(uint64_t stack_ptr) { - MinidumpLinuxMapsList *linux_maps_list = dump_->GetLinuxMapsList(); + MinidumpLinuxMapsList* linux_maps_list = dump_->GetLinuxMapsList(); // Inconclusive if there are no mappings available. if (!linux_maps_list) { return false; } - const MinidumpLinuxMaps *linux_maps = + const MinidumpLinuxMaps* linux_maps = linux_maps_list->GetLinuxMapsForAddress(stack_ptr); // Checks if the stack pointer maps to a valid mapping and if the mapping // is not the stack. If the mapping has no name, it is inconclusive whether @@ -550,10 +550,10 @@ bool ExploitabilityLinux::StackPointerOffStack(uint64_t stack_ptr) { } bool ExploitabilityLinux::ExecutableStackOrHeap() { - MinidumpLinuxMapsList *linux_maps_list = dump_->GetLinuxMapsList(); + MinidumpLinuxMapsList* linux_maps_list = dump_->GetLinuxMapsList(); if (linux_maps_list) { for (size_t i = 0; i < linux_maps_list->get_maps_count(); i++) { - const MinidumpLinuxMaps *linux_maps = + const MinidumpLinuxMaps* linux_maps = linux_maps_list->GetLinuxMapsAtIndex(i); // Check for executable stack or heap for each mapping. if (linux_maps && (!linux_maps->GetPathname().compare( @@ -574,15 +574,15 @@ bool ExploitabilityLinux::InstructionPointerInCode(uint64_t instruction_ptr) { // whether it is in a valid code region. If there is no mapping for the // instruction pointer, it is indicative that the instruction pointer is // not within a module, which implies that it is outside a valid area. - MinidumpLinuxMapsList *linux_maps_list = dump_->GetLinuxMapsList(); - const MinidumpLinuxMaps *linux_maps = + MinidumpLinuxMapsList* linux_maps_list = dump_->GetLinuxMapsList(); + const MinidumpLinuxMaps* linux_maps = linux_maps_list ? linux_maps_list->GetLinuxMapsForAddress(instruction_ptr) : NULL; return linux_maps ? linux_maps->IsExecutable() : false; } -bool ExploitabilityLinux::BenignCrashTrigger(const MDRawExceptionStream - *raw_exception_stream) { +bool ExploitabilityLinux::BenignCrashTrigger( + const MDRawExceptionStream* raw_exception_stream) { // Check the cause of crash. // If the exception of the crash is a benign exception, // it is probably not exploitable. diff --git a/src/processor/exploitability_linux.h b/src/processor/exploitability_linux.h index e3ff13b6..36647959 100644 --- a/src/processor/exploitability_linux.h +++ b/src/processor/exploitability_linux.h @@ -44,8 +44,8 @@ namespace google_breakpad { class ExploitabilityLinux : public Exploitability { public: - ExploitabilityLinux(Minidump *dump, - ProcessState *process_state); + ExploitabilityLinux(Minidump* dump, + ProcessState* process_state); // Parameters are the minidump to analyze, the object representing process // state, and whether to enable objdump disassembly. @@ -53,8 +53,8 @@ class ExploitabilityLinux : public Exploitability { // objdump for diassembly. It is used to check the identity of the // instruction that caused the program to crash. If there are any // portability concerns, this should not be enabled. - ExploitabilityLinux(Minidump *dump, - ProcessState *process_state, + ExploitabilityLinux(Minidump* dump, + ProcessState* process_state, bool enable_objdump); virtual ExploitabilityRating CheckPlatformExploitability(); @@ -68,7 +68,7 @@ class ExploitabilityLinux : public Exploitability { // Checks the exception that triggered the creation of the // minidump and reports whether the exception suggests no exploitability. - bool BenignCrashTrigger(const MDRawExceptionStream *raw_exception_stream); + bool BenignCrashTrigger(const MDRawExceptionStream* raw_exception_stream); // This method checks if the crash occurred during a write to read-only or // invalid memory. It does so by checking if the instruction at the @@ -81,34 +81,34 @@ class ExploitabilityLinux : public Exploitability { // buffer, given the desired architecture, the file from which objdump will // read, and the buffer length. The method returns whether the disassembly // was a success, and the caller owns all pointers. - static bool DisassembleBytes(const string &architecture, - const uint8_t *raw_bytes, + static bool DisassembleBytes(const string& architecture, + const uint8_t* raw_bytes, const unsigned int MAX_OBJDUMP_BUFFER_LEN, - char *objdump_output_buffer); + char* objdump_output_buffer); // Parses the objdump output given in |objdump_output_buffer| and extracts // the line of the first instruction into |instruction_line|. Returns true // when the instruction line is successfully extracted. static bool GetObjdumpInstructionLine( - const char *objdump_output_buffer, - string *instruction_line); + const char* objdump_output_buffer, + string* instruction_line); // Tokenizes out the operation and operands from a line of instruction // disassembled by objdump. This method modifies the pointers to match the // tokens of the instruction, and returns if the tokenizing was a success. // The caller owns all pointers. - static bool TokenizeObjdumpInstruction(const string &line, - string *operation, - string *dest, - string *src); + static bool TokenizeObjdumpInstruction(const string& line, + string* operation, + string* dest, + string* src); // Calculates the effective address of an expression in the form reg+a or // reg-a, where 'reg' is a register and 'a' is a constant, and writes the // result in the pointer. The method returns whether the calculation was // a success. The caller owns the pointer. - static bool CalculateAddress(const string &address_expression, - const DumpContext &context, - uint64_t *write_address); + static bool CalculateAddress(const string& address_expression, + const DumpContext& context, + uint64_t* write_address); #endif // _WIN32 // Checks if the stack pointer points to a memory mapping that is not diff --git a/src/processor/exploitability_win.cc b/src/processor/exploitability_win.cc index a1f8703a..b74a7496 100644 --- a/src/processor/exploitability_win.cc +++ b/src/processor/exploitability_win.cc @@ -69,30 +69,30 @@ static const size_t kHugeBump = 90; // The maximum number of bytes to disassemble past the program counter. static const size_t kDisassembleBytesBeyondPC = 2048; -ExploitabilityWin::ExploitabilityWin(Minidump *dump, - ProcessState *process_state) +ExploitabilityWin::ExploitabilityWin(Minidump* dump, + ProcessState* process_state) : Exploitability(dump, process_state) { } ExploitabilityRating ExploitabilityWin::CheckPlatformExploitability() { - MinidumpException *exception = dump_->GetException(); + MinidumpException* exception = dump_->GetException(); if (!exception) { BPLOG(INFO) << "Minidump does not have exception record."; return EXPLOITABILITY_ERR_PROCESSING; } - const MDRawExceptionStream *raw_exception = exception->exception(); + const MDRawExceptionStream* raw_exception = exception->exception(); if (!raw_exception) { BPLOG(INFO) << "Could not obtain raw exception info."; return EXPLOITABILITY_ERR_PROCESSING; } - const MinidumpContext *context = exception->GetContext(); + const MinidumpContext* context = exception->GetContext(); if (!context) { BPLOG(INFO) << "Could not obtain exception context."; return EXPLOITABILITY_ERR_PROCESSING; } - MinidumpMemoryList *memory_list = dump_->GetMemoryList(); + MinidumpMemoryList* memory_list = dump_->GetMemoryList(); bool memory_available = true; if (!memory_list) { BPLOG(INFO) << "Minidump memory segments not available."; @@ -195,7 +195,7 @@ ExploitabilityRating ExploitabilityWin::CheckPlatformExploitability() { return EXPLOITABILITY_ERR_PROCESSING; break; } - MinidumpMemoryRegion *instruction_region = 0; + MinidumpMemoryRegion* instruction_region = 0; if (memory_available) { instruction_region = memory_list->GetMemoryRegionForAddress(instruction_ptr); @@ -211,7 +211,7 @@ ExploitabilityRating ExploitabilityWin::CheckPlatformExploitability() { available_memory = available_memory > kDisassembleBytesBeyondPC ? kDisassembleBytesBeyondPC : available_memory; if (available_memory) { - const uint8_t *raw_memory = + const uint8_t* raw_memory = instruction_region->GetMemory() + memory_offset; DisassemblerX86 disassembler(raw_memory, available_memory, diff --git a/src/processor/fast_source_line_resolver.cc b/src/processor/fast_source_line_resolver.cc index 4a3d0007..3f8ec508 100644 --- a/src/processor/fast_source_line_resolver.cc +++ b/src/processor/fast_source_line_resolver.cc @@ -61,7 +61,7 @@ bool FastSourceLineResolver::ShouldDeleteMemoryBufferAfterLoadModule() { return false; } -void FastSourceLineResolver::Module::LookupAddress(StackFrame *frame) const { +void FastSourceLineResolver::Module::LookupAddress(StackFrame* frame) const { MemAddr address = frame->instruction - frame->module->base_address(); // First, look for a FUNC record that covers address. Use @@ -109,7 +109,7 @@ void FastSourceLineResolver::Module::LookupAddress(StackFrame *frame) const { // WFI: WindowsFrameInfo. // Returns a WFI object reading from a raw memory chunk of data -WindowsFrameInfo FastSourceLineResolver::CopyWFI(const char *raw) { +WindowsFrameInfo FastSourceLineResolver::CopyWFI(const char* raw) { const WindowsFrameInfo::StackInfoTypes type = static_cast<const WindowsFrameInfo::StackInfoTypes>( *reinterpret_cast<const int32_t*>(raw)); @@ -117,7 +117,7 @@ WindowsFrameInfo FastSourceLineResolver::CopyWFI(const char *raw) { // The first 8 bytes of int data are unused. // They correspond to "StackInfoTypes type_;" and "int valid;" // data member of WFI. - const uint32_t *para_uint32 = reinterpret_cast<const uint32_t*>( + const uint32_t* para_uint32 = reinterpret_cast<const uint32_t*>( raw + 2 * sizeof(int32_t)); uint32_t prolog_size = para_uint32[0];; @@ -126,7 +126,7 @@ WindowsFrameInfo FastSourceLineResolver::CopyWFI(const char *raw) { uint32_t saved_register_size = para_uint32[3]; uint32_t local_size = para_uint32[4]; uint32_t max_stack_size = para_uint32[5]; - const char *boolean = reinterpret_cast<const char*>(para_uint32 + 6); + const char* boolean = reinterpret_cast<const char*>(para_uint32 + 6); bool allocates_base_pointer = (*boolean != 0); string program_string = boolean + 1; @@ -145,15 +145,15 @@ WindowsFrameInfo FastSourceLineResolver::CopyWFI(const char *raw) { // Does NOT take ownership of mem_buffer. // In addition, treat mem_buffer as const char*. bool FastSourceLineResolver::Module::LoadMapFromMemory( - char *memory_buffer, + char* memory_buffer, size_t memory_buffer_size) { if (!memory_buffer) return false; // Read the "is_corrupt" flag. - const char *mem_buffer = memory_buffer; + const char* mem_buffer = memory_buffer; mem_buffer = SimpleSerializer<bool>::Read(mem_buffer, &is_corrupt_); - const uint32_t *map_sizes = reinterpret_cast<const uint32_t*>(mem_buffer); + const uint32_t* map_sizes = reinterpret_cast<const uint32_t*>(mem_buffer); unsigned int header_size = kNumberMaps_ * sizeof(unsigned int); @@ -185,8 +185,8 @@ bool FastSourceLineResolver::Module::LoadMapFromMemory( return true; } -WindowsFrameInfo *FastSourceLineResolver::Module::FindWindowsFrameInfo( - const StackFrame *frame) const { +WindowsFrameInfo* FastSourceLineResolver::Module::FindWindowsFrameInfo( + const StackFrame* frame) const { MemAddr address = frame->instruction - frame->module->base_address(); scoped_ptr<WindowsFrameInfo> result(new WindowsFrameInfo()); @@ -238,8 +238,8 @@ WindowsFrameInfo *FastSourceLineResolver::Module::FindWindowsFrameInfo( return NULL; } -CFIFrameInfo *FastSourceLineResolver::Module::FindCFIFrameInfo( - const StackFrame *frame) const { +CFIFrameInfo* FastSourceLineResolver::Module::FindCFIFrameInfo( + const StackFrame* frame) const { MemAddr address = frame->instruction - frame->module->base_address(); MemAddr initial_base, initial_size; const char* initial_rules = NULL; diff --git a/src/processor/fast_source_line_resolver_types.h b/src/processor/fast_source_line_resolver_types.h index 2c010470..2b2b5827 100644 --- a/src/processor/fast_source_line_resolver_types.h +++ b/src/processor/fast_source_line_resolver_types.h @@ -54,16 +54,16 @@ namespace google_breakpad { struct FastSourceLineResolver::Line : public SourceLineResolverBase::Line { - void CopyFrom(const Line *line_ptr) { - const char *raw = reinterpret_cast<const char*>(line_ptr); + void CopyFrom(const Line* line_ptr) { + const char* raw = reinterpret_cast<const char*>(line_ptr); CopyFrom(raw); } // De-serialize the memory data of a Line. - void CopyFrom(const char *raw) { + void CopyFrom(const char* raw) { address = *(reinterpret_cast<const MemAddr*>(raw)); size = *(reinterpret_cast<const MemAddr*>(raw + sizeof(address))); - source_file_id = *(reinterpret_cast<const int32_t *>( + source_file_id = *(reinterpret_cast<const int32_t*>( raw + 2 * sizeof(address))); line = *(reinterpret_cast<const int32_t*>( raw + 2 * sizeof(address) + sizeof(source_file_id))); @@ -72,13 +72,13 @@ struct FastSourceLineResolver::Line : public SourceLineResolverBase::Line { struct FastSourceLineResolver::Function : public SourceLineResolverBase::Function { - void CopyFrom(const Function *func_ptr) { - const char *raw = reinterpret_cast<const char*>(func_ptr); + void CopyFrom(const Function* func_ptr) { + const char* raw = reinterpret_cast<const char*>(func_ptr); CopyFrom(raw); } // De-serialize the memory data of a Function. - void CopyFrom(const char *raw) { + void CopyFrom(const char* raw) { size_t name_size = strlen(raw) + 1; name = raw; address = *(reinterpret_cast<const MemAddr*>(raw + name_size)); @@ -95,13 +95,13 @@ public SourceLineResolverBase::Function { struct FastSourceLineResolver::PublicSymbol : public SourceLineResolverBase::PublicSymbol { - void CopyFrom(const PublicSymbol *public_symbol_ptr) { - const char *raw = reinterpret_cast<const char*>(public_symbol_ptr); + void CopyFrom(const PublicSymbol* public_symbol_ptr) { + const char* raw = reinterpret_cast<const char*>(public_symbol_ptr); CopyFrom(raw); } // De-serialize the memory data of a PublicSymbol. - void CopyFrom(const char *raw) { + void CopyFrom(const char* raw) { size_t name_size = strlen(raw) + 1; name = raw; address = *(reinterpret_cast<const MemAddr*>(raw + name_size)); @@ -112,15 +112,15 @@ public SourceLineResolverBase::PublicSymbol { class FastSourceLineResolver::Module: public SourceLineResolverBase::Module { public: - explicit Module(const string &name) : name_(name), is_corrupt_(false) { } + explicit Module(const string& name) : name_(name), is_corrupt_(false) { } virtual ~Module() { } // Looks up the given relative address, and fills the StackFrame struct // with the result. - virtual void LookupAddress(StackFrame *frame) const; + virtual void LookupAddress(StackFrame* frame) const; // Loads a map from the given buffer in char* type. - virtual bool LoadMapFromMemory(char *memory_buffer, + virtual bool LoadMapFromMemory(char* memory_buffer, size_t memory_buffer_size); // Tells whether the loaded symbol data is corrupt. Return value is @@ -132,13 +132,13 @@ class FastSourceLineResolver::Module: public SourceLineResolverBase::Module { // is not available, returns NULL. A NULL return value does not indicate // an error. The caller takes ownership of any returned WindowsFrameInfo // object. - virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame) const; + virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame) const; // If CFI stack walking information is available covering ADDRESS, // return a CFIFrameInfo structure describing it. If the information // is not available, return NULL. The caller takes ownership of any // returned CFIFrameInfo object. - virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame) const; + virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame) const; // Number of serialized map components of Module. static const int kNumberMaps_ = 5 + WindowsFrameInfo::STACK_INFO_LAST; diff --git a/src/processor/fast_source_line_resolver_unittest.cc b/src/processor/fast_source_line_resolver_unittest.cc index 87b13c52..0ec5f91d 100644 --- a/src/processor/fast_source_line_resolver_unittest.cc +++ b/src/processor/fast_source_line_resolver_unittest.cc @@ -94,15 +94,15 @@ class TestCodeModule : public CodeModule { class MockMemoryRegion: public MemoryRegion { uint64_t GetBase() const { return 0x10000; } uint32_t GetSize() const { return 0x01000; } - bool GetMemoryAtAddress(uint64_t address, uint8_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const { *value = address & 0xff; return true; } - bool GetMemoryAtAddress(uint64_t address, uint16_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const { *value = address & 0xffff; return true; } - bool GetMemoryAtAddress(uint64_t address, uint32_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const { switch (address) { case 0x10008: *value = 0x98ecadc3; break; // saved %ebx case 0x1000c: *value = 0x878f7524; break; // saved %esi @@ -113,7 +113,7 @@ class MockMemoryRegion: public MemoryRegion { } return true; } - bool GetMemoryAtAddress(uint64_t address, uint64_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const { *value = address; return true; } @@ -127,9 +127,9 @@ class MockMemoryRegion: public MemoryRegion { // EXPECTED's.) Also verify that ACTUAL has associations for ".ra" and // ".cfa". static bool VerifyRegisters( - const char *file, int line, - const CFIFrameInfo::RegisterValueMap<uint32_t> &expected, - const CFIFrameInfo::RegisterValueMap<uint32_t> &actual) { + const char* file, int line, + const CFIFrameInfo::RegisterValueMap<uint32_t>& expected, + const CFIFrameInfo::RegisterValueMap<uint32_t>& actual) { CFIFrameInfo::RegisterValueMap<uint32_t>::const_iterator a; a = actual.find(".cfa"); if (a == actual.end()) @@ -158,7 +158,7 @@ static bool VerifyRegisters( return true; } -static bool VerifyEmpty(const StackFrame &frame) { +static bool VerifyEmpty(const StackFrame& frame) { if (frame.function_name.empty() && frame.source_file_name.empty() && frame.source_line == 0) @@ -166,7 +166,7 @@ static bool VerifyEmpty(const StackFrame &frame) { return false; } -static void ClearSourceLineInfo(StackFrame *frame) { +static void ClearSourceLineInfo(StackFrame* frame) { frame->function_name.clear(); frame->module = NULL; frame->source_file_name.clear(); @@ -467,7 +467,7 @@ TEST_F(TestFastSourceLineResolver, TestUnload) { } TEST_F(TestFastSourceLineResolver, CompareModule) { - char *symbol_data; + char* symbol_data; size_t symbol_data_size; string symbol_data_string; string filename; @@ -486,7 +486,7 @@ TEST_F(TestFastSourceLineResolver, CompareModule) { } // namespace -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/src/processor/logging.cc b/src/processor/logging.cc index d59175a7..3c5b1616 100644 --- a/src/processor/logging.cc +++ b/src/processor/logging.cc @@ -47,8 +47,8 @@ namespace google_breakpad { -LogStream::LogStream(std::ostream &stream, Severity severity, - const char *file, int line) +LogStream::LogStream(std::ostream& stream, Severity severity, + const char* file, int line) : stream_(stream) { time_t clock; time(&clock); @@ -61,7 +61,7 @@ LogStream::LogStream(std::ostream &stream, Severity severity, char time_string[20]; strftime(time_string, sizeof(time_string), "%Y-%m-%d %H:%M:%S", &tm_struct); - const char *severity_string = "UNKNOWN_SEVERITY"; + const char* severity_string = "UNKNOWN_SEVERITY"; switch (severity) { case SEVERITY_INFO: severity_string = "INFO"; @@ -100,7 +100,7 @@ string HexString(int number) { return string(buffer); } -int ErrnoString(string *error_string) { +int ErrnoString(string* error_string) { assert(error_string); // strerror isn't necessarily thread-safe. strerror_r would be preferrable, diff --git a/src/processor/logging.h b/src/processor/logging.h index 43f3cfc9..e6c6eee2 100644 --- a/src/processor/logging.h +++ b/src/processor/logging.h @@ -89,22 +89,22 @@ class LogStream { // Begin logging a message to the stream identified by |stream|, at the // indicated severity. The file and line parameters should be set so as to // identify the line of source code that is producing a message. - LogStream(std::ostream &stream, Severity severity, - const char *file, int line); + LogStream(std::ostream& stream, Severity severity, + const char* file, int line); // Finish logging by printing a newline and flushing the output stream. ~LogStream(); - template<typename T> std::ostream& operator<<(const T &t) { + template<typename T> std::ostream& operator<<(const T& t) { return stream_ << t; } private: - std::ostream &stream_; + std::ostream& stream_; // Disallow copy constructor and assignment operator - explicit LogStream(const LogStream &that); - void operator=(const LogStream &that); + explicit LogStream(const LogStream& that); + void operator=(const LogStream& that); }; // This class is used to explicitly ignore values in the conditional logging @@ -116,7 +116,7 @@ class LogMessageVoidify { // This has to be an operator with a precedence lower than << but higher // than ?: - void operator&(std::ostream &) {} + void operator&(std::ostream&) {} }; // Returns number formatted as a hexadecimal string, such as "0x7b". @@ -127,7 +127,7 @@ string HexString(int number); // Returns the error code as set in the global errno variable, and sets // error_string, a required argument, to a string describing that error // code. -int ErrnoString(string *error_string); +int ErrnoString(string* error_string); } // namespace google_breakpad diff --git a/src/processor/map_serializers-inl.h b/src/processor/map_serializers-inl.h index 61c7bbd7..4933f907 100644 --- a/src/processor/map_serializers-inl.h +++ b/src/processor/map_serializers-inl.h @@ -53,7 +53,7 @@ namespace google_breakpad { template<typename Key, typename Value> size_t StdMapSerializer<Key, Value>::SizeOf( - const std::map<Key, Value> &m) const { + const std::map<Key, Value>& m) const { size_t size = 0; size_t header_size = (1 + m.size()) * sizeof(uint32_t); size += header_size; @@ -67,22 +67,22 @@ size_t StdMapSerializer<Key, Value>::SizeOf( } template<typename Key, typename Value> -char *StdMapSerializer<Key, Value>::Write(const std::map<Key, Value> &m, - char *dest) const { +char* StdMapSerializer<Key, Value>::Write(const std::map<Key, Value>& m, + char* dest) const { if (!dest) { BPLOG(ERROR) << "StdMapSerializer failed: write to NULL address."; return NULL; } - char *start_address = dest; + char* start_address = dest; // Write header: // Number of nodes. dest = SimpleSerializer<uint32_t>::Write(m.size(), dest); // Nodes offsets. - uint32_t *offsets = reinterpret_cast<uint32_t*>(dest); + uint32_t* offsets = reinterpret_cast<uint32_t*>(dest); dest += sizeof(uint32_t) * m.size(); - char *key_address = dest; + char* key_address = dest; dest += sizeof(Key) * m.size(); // Traverse map. @@ -97,12 +97,12 @@ char *StdMapSerializer<Key, Value>::Write(const std::map<Key, Value> &m, } template<typename Key, typename Value> -char *StdMapSerializer<Key, Value>::Serialize( - const std::map<Key, Value> &m, unsigned int *size) const { +char* StdMapSerializer<Key, Value>::Serialize( + const std::map<Key, Value>& m, unsigned int* size) const { // Compute size of memory to be allocated. unsigned int size_to_alloc = SizeOf(m); // Allocate memory. - char *serialized_data = new char[size_to_alloc]; + char* serialized_data = new char[size_to_alloc]; if (!serialized_data) { BPLOG(INFO) << "StdMapSerializer memory allocation failed."; if (size) *size = 0; @@ -117,7 +117,7 @@ char *StdMapSerializer<Key, Value>::Serialize( template<typename Address, typename Entry> size_t RangeMapSerializer<Address, Entry>::SizeOf( - const RangeMap<Address, Entry> &m) const { + const RangeMap<Address, Entry>& m) const { size_t size = 0; size_t header_size = (1 + m.map_.size()) * sizeof(uint32_t); size += header_size; @@ -135,22 +135,22 @@ size_t RangeMapSerializer<Address, Entry>::SizeOf( } template<typename Address, typename Entry> -char *RangeMapSerializer<Address, Entry>::Write( - const RangeMap<Address, Entry> &m, char *dest) const { +char* RangeMapSerializer<Address, Entry>::Write( + const RangeMap<Address, Entry>& m, char* dest) const { if (!dest) { BPLOG(ERROR) << "RangeMapSerializer failed: write to NULL address."; return NULL; } - char *start_address = dest; + char* start_address = dest; // Write header: // Number of nodes. dest = SimpleSerializer<uint32_t>::Write(m.map_.size(), dest); // Nodes offsets. - uint32_t *offsets = reinterpret_cast<uint32_t*>(dest); + uint32_t* offsets = reinterpret_cast<uint32_t*>(dest); dest += sizeof(uint32_t) * m.map_.size(); - char *key_address = dest; + char* key_address = dest; dest += sizeof(Address) * m.map_.size(); // Traverse map. @@ -166,12 +166,12 @@ char *RangeMapSerializer<Address, Entry>::Write( } template<typename Address, typename Entry> -char *RangeMapSerializer<Address, Entry>::Serialize( - const RangeMap<Address, Entry> &m, unsigned int *size) const { +char* RangeMapSerializer<Address, Entry>::Serialize( + const RangeMap<Address, Entry>& m, unsigned int* size) const { // Compute size of memory to be allocated. unsigned int size_to_alloc = SizeOf(m); // Allocate memory. - char *serialized_data = new char[size_to_alloc]; + char* serialized_data = new char[size_to_alloc]; if (!serialized_data) { BPLOG(INFO) << "RangeMapSerializer memory allocation failed."; if (size) *size = 0; @@ -188,7 +188,7 @@ char *RangeMapSerializer<Address, Entry>::Serialize( template<class AddrType, class EntryType> size_t ContainedRangeMapSerializer<AddrType, EntryType>::SizeOf( - const ContainedRangeMap<AddrType, EntryType> *m) const { + const ContainedRangeMap<AddrType, EntryType>* m) const { size_t size = 0; size_t header_size = addr_serializer_.SizeOf(m->base_) + entry_serializer_.SizeOf(m->entry_) @@ -209,8 +209,8 @@ size_t ContainedRangeMapSerializer<AddrType, EntryType>::SizeOf( } template<class AddrType, class EntryType> -char *ContainedRangeMapSerializer<AddrType, EntryType>::Write( - const ContainedRangeMap<AddrType, EntryType> *m, char *dest) const { +char* ContainedRangeMapSerializer<AddrType, EntryType>::Write( + const ContainedRangeMap<AddrType, EntryType>* m, char* dest) const { if (!dest) { BPLOG(ERROR) << "StdMapSerializer failed: write to NULL address."; return NULL; @@ -221,15 +221,15 @@ char *ContainedRangeMapSerializer<AddrType, EntryType>::Write( dest = entry_serializer_.Write(m->entry_, dest); // Write map<<AddrType, ContainedRangeMap*>: - char *map_address = dest; + char* map_address = dest; if (m->map_ == NULL) { dest = SimpleSerializer<uint32_t>::Write(0, dest); } else { dest = SimpleSerializer<uint32_t>::Write(m->map_->size(), dest); - uint32_t *offsets = reinterpret_cast<uint32_t*>(dest); + uint32_t* offsets = reinterpret_cast<uint32_t*>(dest); dest += sizeof(uint32_t) * m->map_->size(); - char *key_address = dest; + char* key_address = dest; dest += sizeof(AddrType) * m->map_->size(); // Traverse map. @@ -246,11 +246,11 @@ char *ContainedRangeMapSerializer<AddrType, EntryType>::Write( } template<class AddrType, class EntryType> -char *ContainedRangeMapSerializer<AddrType, EntryType>::Serialize( - const ContainedRangeMap<AddrType, EntryType> *m, unsigned int *size) const { +char* ContainedRangeMapSerializer<AddrType, EntryType>::Serialize( + const ContainedRangeMap<AddrType, EntryType>* m, unsigned int* size) const { unsigned int size_to_alloc = SizeOf(m); // Allocating memory. - char *serialized_data = new char[size_to_alloc]; + char* serialized_data = new char[size_to_alloc]; if (!serialized_data) { BPLOG(INFO) << "ContainedRangeMapSerializer memory allocation failed."; if (size) *size = 0; diff --git a/src/processor/map_serializers.h b/src/processor/map_serializers.h index a0b9d3fd..3d504158 100644 --- a/src/processor/map_serializers.h +++ b/src/processor/map_serializers.h @@ -53,20 +53,20 @@ template<typename Key, typename Value> class StdMapSerializer { public: // Calculate the memory size of serialized data. - size_t SizeOf(const std::map<Key, Value> &m) const; + size_t SizeOf(const std::map<Key, Value>& m) const; // Writes the serialized data to memory with start address = dest, // and returns the "end" of data, i.e., return the address follow the final // byte of data. // NOTE: caller has to allocate enough memory before invoke Write() method. - char* Write(const std::map<Key, Value> &m, char* dest) const; + char* Write(const std::map<Key, Value>& m, char* dest) const; // Serializes a std::map object into a chunk of memory data with format // described in "StaticMap.h" comment. // Returns a pointer to the serialized data. If size != NULL, *size is set // to the size of serialized data, i.e., SizeOf(m). // Caller has the ownership of memory allocated as "new char[]". - char* Serialize(const std::map<Key, Value> &m, unsigned int *size) const; + char* Serialize(const std::map<Key, Value>& m, unsigned int* size) const; private: SimpleSerializer<Key> key_serializer_; @@ -79,14 +79,14 @@ template<typename Addr, typename Entry> class AddressMapSerializer { public: // Calculate the memory size of serialized data. - size_t SizeOf(const AddressMap<Addr, Entry> &m) const { + size_t SizeOf(const AddressMap<Addr, Entry>& m) const { return std_map_serializer_.SizeOf(m.map_); } // Write the serialized data to specified memory location. Return the "end" // of data, i.e., return the address after the final byte of data. // NOTE: caller has to allocate enough memory before invoke Write() method. - char* Write(const AddressMap<Addr, Entry> &m, char *dest) const { + char* Write(const AddressMap<Addr, Entry>& m, char* dest) const { return std_map_serializer_.Write(m.map_, dest); } @@ -94,7 +94,7 @@ class AddressMapSerializer { // Returns a pointer to the serialized data. If size != NULL, *size is set // to the size of serialized data, i.e., SizeOf(m). // Caller has the ownership of memory allocated as "new char[]". - char* Serialize(const AddressMap<Addr, Entry> &m, unsigned int *size) const { + char* Serialize(const AddressMap<Addr, Entry>& m, unsigned int* size) const { return std_map_serializer_.Serialize(m.map_, size); } @@ -110,18 +110,18 @@ template<typename Address, typename Entry> class RangeMapSerializer { public: // Calculate the memory size of serialized data. - size_t SizeOf(const RangeMap<Address, Entry> &m) const; + size_t SizeOf(const RangeMap<Address, Entry>& m) const; // Write the serialized data to specified memory location. Return the "end" // of data, i.e., return the address after the final byte of data. // NOTE: caller has to allocate enough memory before invoke Write() method. - char* Write(const RangeMap<Address, Entry> &m, char* dest) const; + char* Write(const RangeMap<Address, Entry>& m, char* dest) const; // Serializes a RangeMap object into a chunk of memory data. // Returns a pointer to the serialized data. If size != NULL, *size is set // to the size of serialized data, i.e., SizeOf(m). // Caller has the ownership of memory allocated as "new char[]". - char* Serialize(const RangeMap<Address, Entry> &m, unsigned int *size) const; + char* Serialize(const RangeMap<Address, Entry>& m, unsigned int* size) const; private: // Convenient type name for Range. @@ -139,20 +139,20 @@ template<class AddrType, class EntryType> class ContainedRangeMapSerializer { public: // Calculate the memory size of serialized data. - size_t SizeOf(const ContainedRangeMap<AddrType, EntryType> *m) const; + size_t SizeOf(const ContainedRangeMap<AddrType, EntryType>* m) const; // Write the serialized data to specified memory location. Return the "end" // of data, i.e., return the address after the final byte of data. // NOTE: caller has to allocate enough memory before invoke Write() method. - char* Write(const ContainedRangeMap<AddrType, EntryType> *m, + char* Write(const ContainedRangeMap<AddrType, EntryType>* m, char* dest) const; // Serializes a ContainedRangeMap object into a chunk of memory data. // Returns a pointer to the serialized data. If size != NULL, *size is set // to the size of serialized data, i.e., SizeOf(m). // Caller has the ownership of memory allocated as "new char[]". - char* Serialize(const ContainedRangeMap<AddrType, EntryType> *m, - unsigned int *size) const; + char* Serialize(const ContainedRangeMap<AddrType, EntryType>* m, + unsigned int* size) const; private: // Convenient type name for the underlying map type. diff --git a/src/processor/map_serializers_unittest.cc b/src/processor/map_serializers_unittest.cc index 0d872ec2..48b9c4b2 100644 --- a/src/processor/map_serializers_unittest.cc +++ b/src/processor/map_serializers_unittest.cc @@ -63,7 +63,7 @@ class TestStdMapSerializer : public ::testing::Test { std::map<AddrType, EntryType> std_map_; google_breakpad::StdMapSerializer<AddrType, EntryType> serializer_; uint32_t serialized_size_; - char *serialized_data_; + char* serialized_data_; }; TEST_F(TestStdMapSerializer, EmptyMapTestCase) { @@ -135,7 +135,7 @@ class TestAddressMapSerializer : public ::testing::Test { google_breakpad::AddressMap<AddrType, EntryType> address_map_; google_breakpad::AddressMapSerializer<AddrType, EntryType> serializer_; uint32_t serialized_size_; - char *serialized_data_; + char* serialized_data_; }; TEST_F(TestAddressMapSerializer, EmptyMapTestCase) { @@ -210,7 +210,7 @@ class TestRangeMapSerializer : public ::testing::Test { google_breakpad::RangeMap<AddrType, EntryType> range_map_; google_breakpad::RangeMapSerializer<AddrType, EntryType> serializer_; uint32_t serialized_size_; - char *serialized_data_; + char* serialized_data_; }; TEST_F(TestRangeMapSerializer, EmptyMapTestCase) { @@ -283,7 +283,7 @@ class TestContainedRangeMapSerializer : public ::testing::Test { google_breakpad::ContainedRangeMap<AddrType, EntryType> crm_map_; google_breakpad::ContainedRangeMapSerializer<AddrType, EntryType> serializer_; uint32_t serialized_size_; - char *serialized_data_; + char* serialized_data_; }; TEST_F(TestContainedRangeMapSerializer, EmptyMapTestCase) { @@ -379,7 +379,7 @@ TEST_F(TestContainedRangeMapSerializer, MapWithTwoLevelsTestCase) { } -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/src/processor/microdump_stackwalk.cc b/src/processor/microdump_stackwalk.cc index 220396ed..03fa77e1 100644 --- a/src/processor/microdump_stackwalk.cc +++ b/src/processor/microdump_stackwalk.cc @@ -140,7 +140,7 @@ static void SetupOptions(int argc, const char *argv[], Options* options) { options->machine_readable = false; options->output_stack_contents = false; - while ((ch = getopt(argc, (char * const *)argv, "hms")) != -1) { + while ((ch = getopt(argc, (char * const*)argv, "hms")) != -1) { switch (ch) { case 'h': Usage(argc, argv, false); diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc index f0075eb2..1f479558 100644 --- a/src/processor/minidump.cc +++ b/src/processor/minidump.cc @@ -1611,7 +1611,7 @@ MinidumpContext* MinidumpThread::GetContext() { } -bool MinidumpThread::GetThreadID(uint32_t *thread_id) const { +bool MinidumpThread::GetThreadID(uint32_t* thread_id) const { BPLOG_IF(ERROR, !thread_id) << "MinidumpThread::GetThreadID requires " "|thread_id|"; assert(thread_id); @@ -1973,14 +1973,14 @@ string MinidumpModule::code_identifier() const { if (!has_debug_info_) return ""; - MinidumpSystemInfo *minidump_system_info = minidump_->GetSystemInfo(); + MinidumpSystemInfo* minidump_system_info = minidump_->GetSystemInfo(); if (!minidump_system_info) { BPLOG(ERROR) << "MinidumpModule code_identifier requires " "MinidumpSystemInfo"; return ""; } - const MDRawSystemInfo *raw_system_info = minidump_system_info->system_info(); + const MDRawSystemInfo* raw_system_info = minidump_system_info->system_info(); if (!raw_system_info) { BPLOG(ERROR) << "MinidumpModule code_identifier requires MDRawSystemInfo"; return ""; @@ -2093,7 +2093,7 @@ string MinidumpModule::debug_file() const { // No usable CodeView record. Try the miscellaneous debug record. if (misc_record_) { const MDImageDebugMisc* misc_record = - reinterpret_cast<const MDImageDebugMisc *>(&(*misc_record_)[0]); + reinterpret_cast<const MDImageDebugMisc*>(&(*misc_record_)[0]); if (!misc_record->unicode) { // If it's not Unicode, just stuff it into the string. It's unclear // if misc_record->data is 0-terminated, so use an explicit size. @@ -2549,7 +2549,7 @@ void MinidumpModule::Print() { code_identifier().c_str()); uint32_t cv_record_size; - const uint8_t *cv_record = GetCVRecord(&cv_record_size); + const uint8_t* cv_record = GetCVRecord(&cv_record_size); if (cv_record) { if (cv_record_signature_ == MD_CVINFOPDB70_SIGNATURE) { const MDCVInfoPDB70* cv_record_70 = @@ -3215,7 +3215,7 @@ bool MinidumpException::Read(uint32_t expected_size) { } -bool MinidumpException::GetThreadID(uint32_t *thread_id) const { +bool MinidumpException::GetThreadID(uint32_t* thread_id) const { BPLOG_IF(ERROR, !thread_id) << "MinidumpException::GetThreadID requires " "|thread_id|"; assert(thread_id); @@ -3699,14 +3699,14 @@ string MinidumpUnloadedModule::code_identifier() const { return ""; } - MinidumpSystemInfo *minidump_system_info = minidump_->GetSystemInfo(); + MinidumpSystemInfo* minidump_system_info = minidump_->GetSystemInfo(); if (!minidump_system_info) { BPLOG(ERROR) << "MinidumpUnloadedModule code_identifier requires " "MinidumpSystemInfo"; return ""; } - const MDRawSystemInfo *raw_system_info = minidump_system_info->system_info(); + const MDRawSystemInfo* raw_system_info = minidump_system_info->system_info(); if (!raw_system_info) { BPLOG(ERROR) << "MinidumpUnloadedModule code_identifier requires " << "MDRawSystemInfo"; @@ -4356,7 +4356,7 @@ bool MinidumpBreakpadInfo::Read(uint32_t expected_size) { } -bool MinidumpBreakpadInfo::GetDumpThreadID(uint32_t *thread_id) const { +bool MinidumpBreakpadInfo::GetDumpThreadID(uint32_t* thread_id) const { BPLOG_IF(ERROR, !thread_id) << "MinidumpBreakpadInfo::GetDumpThreadID " "requires |thread_id|"; assert(thread_id); @@ -4377,7 +4377,7 @@ bool MinidumpBreakpadInfo::GetDumpThreadID(uint32_t *thread_id) const { } -bool MinidumpBreakpadInfo::GetRequestingThreadID(uint32_t *thread_id) +bool MinidumpBreakpadInfo::GetRequestingThreadID(uint32_t* thread_id) const { BPLOG_IF(ERROR, !thread_id) << "MinidumpBreakpadInfo::GetRequestingThreadID " "requires |thread_id|"; @@ -4695,7 +4695,7 @@ void MinidumpMemoryInfoList::Print() { // MinidumpLinuxMaps // -MinidumpLinuxMaps::MinidumpLinuxMaps(Minidump *minidump) +MinidumpLinuxMaps::MinidumpLinuxMaps(Minidump* minidump) : MinidumpObject(minidump) { } @@ -4711,7 +4711,7 @@ void MinidumpLinuxMaps::Print() const { // MinidumpLinuxMapsList // -MinidumpLinuxMapsList::MinidumpLinuxMapsList(Minidump *minidump) +MinidumpLinuxMapsList::MinidumpLinuxMapsList(Minidump* minidump) : MinidumpStream(minidump), maps_(NULL), maps_count_(0) { @@ -4726,7 +4726,7 @@ MinidumpLinuxMapsList::~MinidumpLinuxMapsList() { } } -const MinidumpLinuxMaps *MinidumpLinuxMapsList::GetLinuxMapsForAddress( +const MinidumpLinuxMaps* MinidumpLinuxMapsList::GetLinuxMapsForAddress( uint64_t address) const { if (!valid_ || (maps_ == NULL)) { BPLOG(ERROR) << "Invalid MinidumpLinuxMapsList for GetLinuxMapsForAddress"; @@ -4748,7 +4748,7 @@ const MinidumpLinuxMaps *MinidumpLinuxMapsList::GetLinuxMapsForAddress( return NULL; } -const MinidumpLinuxMaps *MinidumpLinuxMapsList::GetLinuxMapsAtIndex( +const MinidumpLinuxMaps* MinidumpLinuxMapsList::GetLinuxMapsAtIndex( unsigned int index) const { if (!valid_ || (maps_ == NULL)) { BPLOG(ERROR) << "Invalid MinidumpLinuxMapsList for GetLinuxMapsAtIndex"; @@ -5090,7 +5090,7 @@ bool Minidump::Open() { return true; } -bool Minidump::GetContextCPUFlagsFromSystemInfo(uint32_t *context_cpu_flags) { +bool Minidump::GetContextCPUFlagsFromSystemInfo(uint32_t* context_cpu_flags) { // Initialize output parameters *context_cpu_flags = 0; @@ -5366,8 +5366,8 @@ MinidumpMemoryInfoList* Minidump::GetMemoryInfoList() { return GetStream(&memory_info_list); } -MinidumpLinuxMapsList *Minidump::GetLinuxMapsList() { - MinidumpLinuxMapsList *linux_maps_list; +MinidumpLinuxMapsList* Minidump::GetLinuxMapsList() { + MinidumpLinuxMapsList* linux_maps_list; return GetStream(&linux_maps_list); } diff --git a/src/processor/minidump_dump.cc b/src/processor/minidump_dump.cc index 4716aa08..06802f24 100644 --- a/src/processor/minidump_dump.cc +++ b/src/processor/minidump_dump.cc @@ -91,7 +91,7 @@ static void DumpRawStream(Minidump *minidump, // in compatibility warnings. uint32_t int_remaining = remaining; printf("%.*s", int_remaining, &contents[current_offset]); - char *next_null = reinterpret_cast<char *>( + char *next_null = reinterpret_cast<char*>( memchr(&contents[current_offset], 0, remaining)); if (next_null == NULL) break; @@ -241,7 +241,7 @@ static void SetupOptions(int argc, char *argv[], Options *options) { int ch; - while ((ch = getopt(argc, (char * const *)argv, "xh")) != -1) { + while ((ch = getopt(argc, (char * const*)argv, "xh")) != -1) { switch (ch) { case 'x': options->hexdump = true; diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc index a90e6188..04b7e129 100644 --- a/src/processor/minidump_processor.cc +++ b/src/processor/minidump_processor.cc @@ -48,16 +48,16 @@ namespace google_breakpad { -MinidumpProcessor::MinidumpProcessor(SymbolSupplier *supplier, - SourceLineResolverInterface *resolver) +MinidumpProcessor::MinidumpProcessor(SymbolSupplier* supplier, + SourceLineResolverInterface* resolver) : frame_symbolizer_(new StackFrameSymbolizer(supplier, resolver)), own_frame_symbolizer_(true), enable_exploitability_(false), enable_objdump_(false) { } -MinidumpProcessor::MinidumpProcessor(SymbolSupplier *supplier, - SourceLineResolverInterface *resolver, +MinidumpProcessor::MinidumpProcessor(SymbolSupplier* supplier, + SourceLineResolverInterface* resolver, bool enable_exploitability) : frame_symbolizer_(new StackFrameSymbolizer(supplier, resolver)), own_frame_symbolizer_(true), @@ -65,7 +65,7 @@ MinidumpProcessor::MinidumpProcessor(SymbolSupplier *supplier, enable_objdump_(false) { } -MinidumpProcessor::MinidumpProcessor(StackFrameSymbolizer *frame_symbolizer, +MinidumpProcessor::MinidumpProcessor(StackFrameSymbolizer* frame_symbolizer, bool enable_exploitability) : frame_symbolizer_(frame_symbolizer), own_frame_symbolizer_(false), @@ -79,13 +79,13 @@ MinidumpProcessor::~MinidumpProcessor() { } ProcessResult MinidumpProcessor::Process( - Minidump *dump, ProcessState *process_state) { + Minidump* dump, ProcessState* process_state) { assert(dump); assert(process_state); process_state->Clear(); - const MDRawHeader *header = dump->header(); + const MDRawHeader* header = dump->header(); if (!header) { BPLOG(ERROR) << "Minidump " << dump->path() << " has no header"; return PROCESS_ERROR_NO_MINIDUMP_HEADER; @@ -103,14 +103,14 @@ ProcessResult MinidumpProcessor::Process( uint32_t requesting_thread_id = 0; bool has_requesting_thread = false; - MinidumpBreakpadInfo *breakpad_info = dump->GetBreakpadInfo(); + MinidumpBreakpadInfo* breakpad_info = dump->GetBreakpadInfo(); if (breakpad_info) { has_dump_thread = breakpad_info->GetDumpThreadID(&dump_thread_id); has_requesting_thread = breakpad_info->GetRequestingThreadID(&requesting_thread_id); } - MinidumpException *exception = dump->GetException(); + MinidumpException* exception = dump->GetException(); if (exception) { process_state->crashed_ = true; has_requesting_thread = exception->GetThreadID(&requesting_thread_id); @@ -143,7 +143,7 @@ ProcessResult MinidumpProcessor::Process( // This will just return an empty string if it doesn't exist. process_state->assertion_ = GetAssertion(dump); - MinidumpModuleList *module_list = dump->GetModuleList(); + MinidumpModuleList* module_list = dump->GetModuleList(); // Put a copy of the module list into ProcessState object. This is not // necessarily a MinidumpModuleList, but it adheres to the CodeModules @@ -163,19 +163,19 @@ ProcessResult MinidumpProcessor::Process( } } - MinidumpUnloadedModuleList *unloaded_module_list = + MinidumpUnloadedModuleList* unloaded_module_list = dump->GetUnloadedModuleList(); if (unloaded_module_list) { process_state->unloaded_modules_ = unloaded_module_list->Copy(); } - MinidumpMemoryList *memory_list = dump->GetMemoryList(); + MinidumpMemoryList* memory_list = dump->GetMemoryList(); if (memory_list) { BPLOG(INFO) << "Found " << memory_list->region_count() << " memory regions."; } - MinidumpThreadList *threads = dump->GetThreadList(); + MinidumpThreadList* threads = dump->GetThreadList(); if (!threads) { BPLOG(ERROR) << "Minidump " << dump->path() << " has no thread list"; return PROCESS_ERROR_NO_THREAD_LIST; @@ -207,7 +207,7 @@ ProcessResult MinidumpProcessor::Process( thread_index, thread_count); string thread_string = dump->path() + ":" + thread_string_buffer; - MinidumpThread *thread = threads->GetThreadAtIndex(thread_index); + MinidumpThread* thread = threads->GetThreadAtIndex(thread_index); if (!thread) { BPLOG(ERROR) << "Could not get thread for " << thread_string; return PROCESS_ERROR_GETTING_THREAD; @@ -230,7 +230,7 @@ ProcessResult MinidumpProcessor::Process( continue; } - MinidumpContext *context = thread->GetContext(); + MinidumpContext* context = thread->GetContext(); if (has_requesting_thread && thread_id == requesting_thread_id) { if (found_requesting_thread) { @@ -257,7 +257,7 @@ ProcessResult MinidumpProcessor::Process( // would not result in the expected stack trace from the time of the // crash. If the exception context is invalid, however, we fall back // on the thread context. - MinidumpContext *ctx = exception->GetContext(); + MinidumpContext* ctx = exception->GetContext(); context = ctx ? ctx : thread->GetContext(); } } @@ -265,7 +265,7 @@ ProcessResult MinidumpProcessor::Process( // If the memory region for the stack cannot be read using the RVA stored // in the memory descriptor inside MINIDUMP_THREAD, try to locate and use // a memory region (containing the stack) from the minidump memory list. - MinidumpMemoryRegion *thread_memory = thread->GetMemory(); + MinidumpMemoryRegion* thread_memory = thread->GetMemory(); if (!thread_memory && memory_list) { uint64_t start_stack_memory_range = thread->GetStartOfStackMemoryRange(); if (start_stack_memory_range) { @@ -350,7 +350,7 @@ ProcessResult MinidumpProcessor::Process( } ProcessResult MinidumpProcessor::Process( - const string &minidump_file, ProcessState *process_state) { + const string& minidump_file, ProcessState* process_state) { BPLOG(INFO) << "Processing minidump in file " << minidump_file; Minidump dump(minidump_file); @@ -365,9 +365,9 @@ ProcessResult MinidumpProcessor::Process( // 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 // to pass back the MinidumpSystemInfo object. -static const MDRawSystemInfo* GetSystemInfo(Minidump *dump, - MinidumpSystemInfo **system_info) { - MinidumpSystemInfo *minidump_system_info = dump->GetSystemInfo(); +static const MDRawSystemInfo* GetSystemInfo(Minidump* dump, + MinidumpSystemInfo** system_info) { + MinidumpSystemInfo* minidump_system_info = dump->GetSystemInfo(); if (!minidump_system_info) return NULL; @@ -520,15 +520,15 @@ static void GetARMCpuInfo(const MDRawSystemInfo* raw_info, } // static -bool MinidumpProcessor::GetCPUInfo(Minidump *dump, SystemInfo *info) { +bool MinidumpProcessor::GetCPUInfo(Minidump* dump, SystemInfo* info) { assert(dump); assert(info); info->cpu.clear(); info->cpu_info.clear(); - MinidumpSystemInfo *system_info; - const MDRawSystemInfo *raw_system_info = GetSystemInfo(dump, &system_info); + MinidumpSystemInfo* system_info; + const MDRawSystemInfo* raw_system_info = GetSystemInfo(dump, &system_info); if (!raw_system_info) return false; @@ -541,7 +541,7 @@ bool MinidumpProcessor::GetCPUInfo(Minidump *dump, SystemInfo *info) { else info->cpu = "amd64"; - const string *cpu_vendor = system_info->GetCPUVendor(); + const string* cpu_vendor = system_info->GetCPUVendor(); if (cpu_vendor) { info->cpu_info = *cpu_vendor; info->cpu_info.append(" "); @@ -608,7 +608,7 @@ bool MinidumpProcessor::GetCPUInfo(Minidump *dump, SystemInfo *info) { } // static -bool MinidumpProcessor::GetOSInfo(Minidump *dump, SystemInfo *info) { +bool MinidumpProcessor::GetOSInfo(Minidump* dump, SystemInfo* info) { assert(dump); assert(info); @@ -616,8 +616,8 @@ bool MinidumpProcessor::GetOSInfo(Minidump *dump, SystemInfo *info) { info->os_short.clear(); info->os_version.clear(); - MinidumpSystemInfo *system_info; - const MDRawSystemInfo *raw_system_info = GetSystemInfo(dump, &system_info); + MinidumpSystemInfo* system_info; + const MDRawSystemInfo* raw_system_info = GetSystemInfo(dump, &system_info); if (!raw_system_info) return false; @@ -691,7 +691,7 @@ bool MinidumpProcessor::GetOSInfo(Minidump *dump, SystemInfo *info) { raw_system_info->build_number); info->os_version = os_version_string; - const string *csd_version = system_info->GetCSDVersion(); + const string* csd_version = system_info->GetCSDVersion(); if (csd_version) { info->os_version.append(" "); info->os_version.append(*csd_version); @@ -727,12 +727,12 @@ bool MinidumpProcessor::GetProcessCreateTime(Minidump* dump, } // static -string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) { - MinidumpException *exception = dump->GetException(); +string MinidumpProcessor::GetCrashReason(Minidump* dump, uint64_t* address) { + MinidumpException* exception = dump->GetException(); if (!exception) return ""; - const MDRawExceptionStream *raw_exception = exception->exception(); + const MDRawExceptionStream* raw_exception = exception->exception(); if (!raw_exception) return ""; @@ -752,7 +752,7 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) { flags_string); string reason = reason_string; - const MDRawSystemInfo *raw_system_info = GetSystemInfo(dump, NULL); + const MDRawSystemInfo* raw_system_info = GetSystemInfo(dump, NULL); if (!raw_system_info) return reason; @@ -1743,12 +1743,12 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) { } // static -string MinidumpProcessor::GetAssertion(Minidump *dump) { - MinidumpAssertion *assertion = dump->GetAssertion(); +string MinidumpProcessor::GetAssertion(Minidump* dump) { + MinidumpAssertion* assertion = dump->GetAssertion(); if (!assertion) return ""; - const MDRawAssertionInfo *raw_assertion = assertion->assertion(); + const MDRawAssertionInfo* raw_assertion = assertion->assertion(); if (!raw_assertion) return ""; diff --git a/src/processor/minidump_processor_unittest.cc b/src/processor/minidump_processor_unittest.cc index a4ac3685..306c2f0b 100644 --- a/src/processor/minidump_processor_unittest.cc +++ b/src/processor/minidump_processor_unittest.cc @@ -127,16 +127,16 @@ class MockMinidumpMemoryRegion : public MinidumpMemoryRegion { uint64_t GetBase() const { return region_.GetBase(); } uint32_t GetSize() const { return region_.GetSize(); } - bool GetMemoryAtAddress(uint64_t address, uint8_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const { return region_.GetMemoryAtAddress(address, value); } - bool GetMemoryAtAddress(uint64_t address, uint16_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const { return region_.GetMemoryAtAddress(address, value); } - bool GetMemoryAtAddress(uint64_t address, uint32_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const { return region_.GetMemoryAtAddress(address, value); } - bool GetMemoryAtAddress(uint64_t address, uint64_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const { return region_.GetMemoryAtAddress(address, value); } @@ -188,11 +188,11 @@ using ::testing::Property; using ::testing::Return; using ::testing::SetArgumentPointee; -static const char *kSystemInfoOS = "Windows NT"; -static const char *kSystemInfoOSShort = "windows"; -static const char *kSystemInfoOSVersion = "5.1.2600 Service Pack 2"; -static const char *kSystemInfoCPU = "x86"; -static const char *kSystemInfoCPUInfo = +static const char* kSystemInfoOS = "Windows NT"; +static const char* kSystemInfoOSShort = "windows"; +static const char* kSystemInfoOSVersion = "5.1.2600 Service Pack 2"; +static const char* kSystemInfoCPU = "x86"; +static const char* kSystemInfoCPUInfo = "GenuineIntel family 6 model 13 stepping 8"; #define ASSERT_TRUE_ABORT(cond) \ @@ -204,7 +204,7 @@ static const char *kSystemInfoCPUInfo = #define ASSERT_EQ_ABORT(e1, e2) ASSERT_TRUE_ABORT((e1) == (e2)) static string GetTestDataPath() { - char *srcdir = getenv("srcdir"); + char* srcdir = getenv("srcdir"); return string(srcdir ? srcdir : ".") + "/src/processor/testdata/"; } @@ -213,35 +213,35 @@ class TestSymbolSupplier : public SymbolSupplier { public: TestSymbolSupplier() : interrupt_(false) {} - virtual SymbolResult GetSymbolFile(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file); + virtual SymbolResult GetSymbolFile(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file); - virtual SymbolResult GetSymbolFile(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - string *symbol_data); + virtual SymbolResult GetSymbolFile(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + string* symbol_data); - virtual SymbolResult GetCStringSymbolData(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - char **symbol_data, - size_t *symbol_data_size); + virtual SymbolResult GetCStringSymbolData(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + char** symbol_data, + size_t* symbol_data_size); - virtual void FreeSymbolData(const CodeModule *module); + virtual void FreeSymbolData(const CodeModule* module); // When set to true, causes the SymbolSupplier to return INTERRUPT void set_interrupt(bool interrupt) { interrupt_ = interrupt; } private: bool interrupt_; - map<string, char *> memory_buffers_; + map<string, char*> memory_buffers_; }; SymbolSupplier::SymbolResult TestSymbolSupplier::GetSymbolFile( - const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file) { + const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file) { ASSERT_TRUE_ABORT(module); ASSERT_TRUE_ABORT(system_info); ASSERT_EQ_ABORT(system_info->cpu, kSystemInfoCPU); @@ -264,10 +264,10 @@ SymbolSupplier::SymbolResult TestSymbolSupplier::GetSymbolFile( } SymbolSupplier::SymbolResult TestSymbolSupplier::GetSymbolFile( - const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - string *symbol_data) { + const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + string* symbol_data) { SymbolSupplier::SymbolResult s = GetSymbolFile(module, system_info, symbol_file); if (s == FOUND) { @@ -281,11 +281,11 @@ SymbolSupplier::SymbolResult TestSymbolSupplier::GetSymbolFile( } SymbolSupplier::SymbolResult TestSymbolSupplier::GetCStringSymbolData( - const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - char **symbol_data, - size_t *symbol_data_size) { + const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + char** symbol_data, + size_t* symbol_data_size) { string symbol_data_string; SymbolSupplier::SymbolResult s = GetSymbolFile(module, system_info, @@ -307,8 +307,8 @@ SymbolSupplier::SymbolResult TestSymbolSupplier::GetCStringSymbolData( return s; } -void TestSymbolSupplier::FreeSymbolData(const CodeModule *module) { - map<string, char *>::iterator it = memory_buffers_.find(module->code_file()); +void TestSymbolSupplier::FreeSymbolData(const CodeModule* module) { + map<string, char*>::iterator it = memory_buffers_.find(module->code_file()); if (it != memory_buffers_.end()) { delete [] it->second; memory_buffers_.erase(it); @@ -523,7 +523,7 @@ TEST_F(MinidumpProcessorTest, TestBasicProcessing) { EXPECT_EQ(1171480435U, state.time_date_stamp()); EXPECT_EQ(1171480435U, state.process_create_time()); - CallStack *stack = state.threads()->at(0); + CallStack* stack = state.threads()->at(0); ASSERT_TRUE(stack); ASSERT_EQ(stack->frames()->size(), 4U); @@ -763,7 +763,7 @@ TEST_F(MinidumpProcessorTest, Test32BitCrashingAddress) { } // namespace -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/src/processor/minidump_stackwalk.cc b/src/processor/minidump_stackwalk.cc index acf80972..aedd0271 100644 --- a/src/processor/minidump_stackwalk.cc +++ b/src/processor/minidump_stackwalk.cc @@ -138,7 +138,7 @@ static void SetupOptions(int argc, const char *argv[], Options* options) { options->machine_readable = false; options->output_stack_contents = false; - while ((ch = getopt(argc, (char * const *)argv, "hms")) != -1) { + while ((ch = getopt(argc, (char * const*)argv, "hms")) != -1) { switch (ch) { case 'h': Usage(argc, argv, false); diff --git a/src/processor/minidump_unittest.cc b/src/processor/minidump_unittest.cc index 036d03f1..49b007fe 100644 --- a/src/processor/minidump_unittest.cc +++ b/src/processor/minidump_unittest.cc @@ -95,9 +95,9 @@ TEST_F(MinidumpTest, TestMinidumpFromFile) { ASSERT_NE(header, (MDRawHeader*)NULL); ASSERT_EQ(header->signature, uint32_t(MD_HEADER_SIGNATURE)); - MinidumpModuleList *md_module_list = minidump.GetModuleList(); + MinidumpModuleList* md_module_list = minidump.GetModuleList(); ASSERT_TRUE(md_module_list != NULL); - const MinidumpModule *md_module = md_module_list->GetModuleAtIndex(0); + const MinidumpModule* md_module = md_module_list->GetModuleAtIndex(0); ASSERT_TRUE(md_module != NULL); ASSERT_EQ("c:\\test_app.exe", md_module->code_file()); ASSERT_EQ("c:\\test_app.pdb", md_module->debug_file()); @@ -167,7 +167,7 @@ TEST(Dump, OneStream) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(1U, minidump.GetDirectoryEntryCount()); - const MDRawDirectory *dir = minidump.GetDirectoryEntryAtIndex(0); + const MDRawDirectory* dir = minidump.GetDirectoryEntryAtIndex(0); ASSERT_TRUE(dir != NULL); EXPECT_EQ(0xfbb7fa2bU, dir->stream_type); @@ -203,18 +203,18 @@ TEST(Dump, OneMemory) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(1U, minidump.GetDirectoryEntryCount()); - const MDRawDirectory *dir = minidump.GetDirectoryEntryAtIndex(0); + const MDRawDirectory* dir = minidump.GetDirectoryEntryAtIndex(0); ASSERT_TRUE(dir != NULL); EXPECT_EQ((uint32_t) MD_MEMORY_LIST_STREAM, dir->stream_type); - MinidumpMemoryList *memory_list = minidump.GetMemoryList(); + MinidumpMemoryList* memory_list = minidump.GetMemoryList(); ASSERT_TRUE(memory_list != NULL); ASSERT_EQ(1U, memory_list->region_count()); - MinidumpMemoryRegion *region1 = memory_list->GetMemoryRegionAtIndex(0); + MinidumpMemoryRegion* region1 = memory_list->GetMemoryRegionAtIndex(0); ASSERT_EQ(0x309d68010bd21b2cULL, region1->GetBase()); ASSERT_EQ(15U, region1->GetSize()); - const uint8_t *region1_bytes = region1->GetMemory(); + const uint8_t* region1_bytes = region1->GetMemory(); ASSERT_TRUE(memcmp("memory contents", region1_bytes, 15) == 0); } @@ -257,33 +257,33 @@ TEST(Dump, OneThread) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(2U, minidump.GetDirectoryEntryCount()); - MinidumpMemoryList *md_memory_list = minidump.GetMemoryList(); + MinidumpMemoryList* md_memory_list = minidump.GetMemoryList(); ASSERT_TRUE(md_memory_list != NULL); ASSERT_EQ(1U, md_memory_list->region_count()); - MinidumpMemoryRegion *md_region = md_memory_list->GetMemoryRegionAtIndex(0); + MinidumpMemoryRegion* md_region = md_memory_list->GetMemoryRegionAtIndex(0); ASSERT_EQ(0x2326a0faU, md_region->GetBase()); ASSERT_EQ(16U, md_region->GetSize()); - const uint8_t *region_bytes = md_region->GetMemory(); + const uint8_t* region_bytes = md_region->GetMemory(); ASSERT_TRUE(memcmp("stack for thread", region_bytes, 16) == 0); - MinidumpThreadList *thread_list = minidump.GetThreadList(); + MinidumpThreadList* thread_list = minidump.GetThreadList(); ASSERT_TRUE(thread_list != NULL); ASSERT_EQ(1U, thread_list->thread_count()); - MinidumpThread *md_thread = thread_list->GetThreadAtIndex(0); + MinidumpThread* md_thread = thread_list->GetThreadAtIndex(0); ASSERT_TRUE(md_thread != NULL); uint32_t thread_id; ASSERT_TRUE(md_thread->GetThreadID(&thread_id)); ASSERT_EQ(0xa898f11bU, thread_id); - MinidumpMemoryRegion *md_stack = md_thread->GetMemory(); + MinidumpMemoryRegion* md_stack = md_thread->GetMemory(); ASSERT_TRUE(md_stack != NULL); ASSERT_EQ(0x2326a0faU, md_stack->GetBase()); ASSERT_EQ(16U, md_stack->GetSize()); - const uint8_t *md_stack_bytes = md_stack->GetMemory(); + const uint8_t* md_stack_bytes = md_stack->GetMemory(); ASSERT_TRUE(memcmp("stack for thread", md_stack_bytes, 16) == 0); - MinidumpContext *md_context = md_thread->GetContext(); + MinidumpContext* md_context = md_thread->GetContext(); ASSERT_TRUE(md_context != NULL); ASSERT_EQ((uint32_t) MD_CONTEXT_X86, md_context->GetContextCPU()); @@ -291,7 +291,7 @@ TEST(Dump, OneThread) { ASSERT_TRUE(md_context->GetInstructionPointer(&eip)); EXPECT_EQ(kExpectedEIP, eip); - const MDRawContextX86 *md_raw_context = md_context->GetContextX86(); + const MDRawContextX86* md_raw_context = md_context->GetContextX86(); ASSERT_TRUE(md_raw_context != NULL); ASSERT_EQ((uint32_t) (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL), (md_raw_context->context_flags @@ -425,16 +425,16 @@ TEST(Dump, OneUnloadedModule) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(2U, minidump.GetDirectoryEntryCount()); - const MDRawDirectory *dir = minidump.GetDirectoryEntryAtIndex(1); + const MDRawDirectory* dir = minidump.GetDirectoryEntryAtIndex(1); ASSERT_TRUE(dir != NULL); EXPECT_EQ((uint32_t) MD_UNLOADED_MODULE_LIST_STREAM, dir->stream_type); - MinidumpUnloadedModuleList *md_unloaded_module_list = + MinidumpUnloadedModuleList* md_unloaded_module_list = minidump.GetUnloadedModuleList(); ASSERT_TRUE(md_unloaded_module_list != NULL); ASSERT_EQ(1U, md_unloaded_module_list->module_count()); - const MinidumpUnloadedModule *md_unloaded_module = + const MinidumpUnloadedModule* md_unloaded_module = md_unloaded_module_list->GetModuleAtIndex(0); ASSERT_TRUE(md_unloaded_module != NULL); ASSERT_EQ(0xa90206ca83eb2852ULL, md_unloaded_module->base_address()); @@ -445,7 +445,7 @@ TEST(Dump, OneUnloadedModule) { ASSERT_EQ("B1054D2Aada542bd", md_unloaded_module->code_identifier()); ASSERT_EQ("", md_unloaded_module->debug_identifier()); - const MDRawUnloadedModule *md_raw_unloaded_module = + const MDRawUnloadedModule* md_raw_unloaded_module = md_unloaded_module->module(); ASSERT_TRUE(md_raw_unloaded_module != NULL); ASSERT_EQ(0xb1054d2aU, md_raw_unloaded_module->time_date_stamp); @@ -506,15 +506,15 @@ TEST(Dump, OneModule) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(2U, minidump.GetDirectoryEntryCount()); - const MDRawDirectory *dir = minidump.GetDirectoryEntryAtIndex(1); + const MDRawDirectory* dir = minidump.GetDirectoryEntryAtIndex(1); ASSERT_TRUE(dir != NULL); EXPECT_EQ((uint32_t) MD_MODULE_LIST_STREAM, dir->stream_type); - MinidumpModuleList *md_module_list = minidump.GetModuleList(); + MinidumpModuleList* md_module_list = minidump.GetModuleList(); ASSERT_TRUE(md_module_list != NULL); ASSERT_EQ(1U, md_module_list->module_count()); - const MinidumpModule *md_module = md_module_list->GetModuleAtIndex(0); + const MinidumpModule* md_module = md_module_list->GetModuleAtIndex(0); ASSERT_TRUE(md_module != NULL); ASSERT_EQ(0xa90206ca83eb2852ULL, md_module->base_address()); ASSERT_EQ(0xada542bd, md_module->size()); @@ -524,7 +524,7 @@ TEST(Dump, OneModule) { ASSERT_EQ("B1054D2Aada542bd", md_module->code_identifier()); ASSERT_EQ("ABCD1234F00DBEEF01020304050607081", md_module->debug_identifier()); - const MDRawModule *md_raw_module = md_module->module(); + const MDRawModule* md_raw_module = md_module->module(); ASSERT_TRUE(md_raw_module != NULL); ASSERT_EQ(0xb1054d2aU, md_raw_module->time_date_stamp); ASSERT_EQ(0x34571371U, md_raw_module->checksum); @@ -588,11 +588,11 @@ TEST(Dump, OneModuleCVELF) { Minidump minidump(minidump_stream); ASSERT_TRUE(minidump.Read()); - MinidumpModuleList *md_module_list = minidump.GetModuleList(); + MinidumpModuleList* md_module_list = minidump.GetModuleList(); ASSERT_TRUE(md_module_list != NULL); ASSERT_EQ(1U, md_module_list->module_count()); - const MinidumpModule *md_module = md_module_list->GetModuleAtIndex(0); + const MinidumpModule* md_module = md_module_list->GetModuleAtIndex(0); ASSERT_TRUE(md_module != NULL); ASSERT_EQ(0xa90206ca83eb2852ULL, md_module->base_address()); ASSERT_EQ(0xada542bd, md_module->size()); @@ -606,7 +606,7 @@ TEST(Dump, OneModuleCVELF) { // age appended ASSERT_EQ("B4CDA95F53101BDF86FAB733B4DF37380", md_module->debug_identifier()); - const MDRawModule *md_raw_module = md_module->module(); + const MDRawModule* md_raw_module = md_module->module(); ASSERT_TRUE(md_raw_module != NULL); ASSERT_EQ(0xb1054d2aU, md_raw_module->time_date_stamp); ASSERT_EQ(0x34571371U, md_raw_module->checksum); @@ -670,11 +670,11 @@ TEST(Dump, CVELFShort) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(2U, minidump.GetDirectoryEntryCount()); - MinidumpModuleList *md_module_list = minidump.GetModuleList(); + MinidumpModuleList* md_module_list = minidump.GetModuleList(); ASSERT_TRUE(md_module_list != NULL); ASSERT_EQ(1U, md_module_list->module_count()); - const MinidumpModule *md_module = md_module_list->GetModuleAtIndex(0); + const MinidumpModule* md_module = md_module_list->GetModuleAtIndex(0); ASSERT_TRUE(md_module != NULL); // just the build_id, directly ASSERT_EQ("5fa9cdb4", md_module->code_identifier()); @@ -742,11 +742,11 @@ TEST(Dump, CVELFLong) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(2U, minidump.GetDirectoryEntryCount()); - MinidumpModuleList *md_module_list = minidump.GetModuleList(); + MinidumpModuleList* md_module_list = minidump.GetModuleList(); ASSERT_TRUE(md_module_list != NULL); ASSERT_EQ(1U, md_module_list->module_count()); - const MinidumpModule *md_module = md_module_list->GetModuleAtIndex(0); + const MinidumpModule* md_module = md_module_list->GetModuleAtIndex(0); ASSERT_TRUE(md_module != NULL); // just the build_id, directly ASSERT_EQ( @@ -773,11 +773,11 @@ TEST(Dump, OneSystemInfo) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(1U, minidump.GetDirectoryEntryCount()); - const MDRawDirectory *dir = minidump.GetDirectoryEntryAtIndex(0); + const MDRawDirectory* dir = minidump.GetDirectoryEntryAtIndex(0); ASSERT_TRUE(dir != NULL); EXPECT_EQ((uint32_t) MD_SYSTEM_INFO_STREAM, dir->stream_type); - MinidumpSystemInfo *md_system_info = minidump.GetSystemInfo(); + MinidumpSystemInfo* md_system_info = minidump.GetSystemInfo(); ASSERT_TRUE(md_system_info != NULL); ASSERT_EQ("windows", md_system_info->GetOS()); ASSERT_EQ("x86", md_system_info->GetCPU()); @@ -912,7 +912,7 @@ TEST(Dump, BigDump) { ASSERT_EQ(5U, minidump.GetDirectoryEntryCount()); // Check the threads. - MinidumpThreadList *thread_list = minidump.GetThreadList(); + MinidumpThreadList* thread_list = minidump.GetThreadList(); ASSERT_TRUE(thread_list != NULL); ASSERT_EQ(5U, thread_list->thread_count()); uint32_t thread_id; @@ -957,7 +957,7 @@ TEST(Dump, BigDump) { ->eip); // Check the modules. - MinidumpModuleList *md_module_list = minidump.GetModuleList(); + MinidumpModuleList* md_module_list = minidump.GetModuleList(); ASSERT_TRUE(md_module_list != NULL); ASSERT_EQ(3U, md_module_list->module_count()); EXPECT_EQ(0xeb77da57b5d4cbdaULL, @@ -968,7 +968,7 @@ TEST(Dump, BigDump) { md_module_list->GetModuleAtIndex(2)->base_address()); // Check unloaded modules - MinidumpUnloadedModuleList *md_unloaded_module_list = + MinidumpUnloadedModuleList* md_unloaded_module_list = minidump.GetUnloadedModuleList(); ASSERT_TRUE(md_unloaded_module_list != NULL); ASSERT_EQ(3U, md_unloaded_module_list->module_count()); @@ -979,7 +979,7 @@ TEST(Dump, BigDump) { EXPECT_EQ(umodule3_base, md_unloaded_module_list->GetModuleAtIndex(2)->base_address()); - const MinidumpUnloadedModule *umodule = + const MinidumpUnloadedModule* umodule = md_unloaded_module_list->GetModuleForAddress( umodule1_base + umodule1_size / 2); EXPECT_EQ(umodule1_base, umodule->base_address()); @@ -1025,22 +1025,22 @@ TEST(Dump, OneMemoryInfo) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(1U, minidump.GetDirectoryEntryCount()); - const MDRawDirectory *dir = minidump.GetDirectoryEntryAtIndex(0); + const MDRawDirectory* dir = minidump.GetDirectoryEntryAtIndex(0); ASSERT_TRUE(dir != NULL); EXPECT_EQ((uint32_t) MD_MEMORY_INFO_LIST_STREAM, dir->stream_type); - MinidumpMemoryInfoList *info_list = minidump.GetMemoryInfoList(); + MinidumpMemoryInfoList* info_list = minidump.GetMemoryInfoList(); ASSERT_TRUE(info_list != NULL); ASSERT_EQ(1U, info_list->info_count()); - const MinidumpMemoryInfo *info1 = info_list->GetMemoryInfoAtIndex(0); + const MinidumpMemoryInfo* info1 = info_list->GetMemoryInfoAtIndex(0); ASSERT_EQ(kBaseAddress, info1->GetBase()); ASSERT_EQ(kRegionSize, info1->GetSize()); ASSERT_TRUE(info1->IsExecutable()); ASSERT_TRUE(info1->IsWritable()); // Should get back the same memory region here. - const MinidumpMemoryInfo *info2 = + const MinidumpMemoryInfo* info2 = info_list->GetMemoryInfoForAddress(kBaseAddress + kRegionSize / 2); ASSERT_EQ(kBaseAddress, info2->GetBase()); ASSERT_EQ(kRegionSize, info2->GetSize()); @@ -1083,7 +1083,7 @@ TEST(Dump, OneExceptionX86) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(1U, minidump.GetDirectoryEntryCount()); - MinidumpException *md_exception = minidump.GetException(); + MinidumpException* md_exception = minidump.GetException(); ASSERT_TRUE(md_exception != NULL); uint32_t thread_id; @@ -1097,10 +1097,10 @@ TEST(Dump, OneExceptionX86) { EXPECT_EQ(0x0919a9b9c9d9e9f9ULL, raw_exception->exception_record.exception_address); - MinidumpContext *md_context = md_exception->GetContext(); + MinidumpContext* md_context = md_exception->GetContext(); ASSERT_TRUE(md_context != NULL); ASSERT_EQ((uint32_t) MD_CONTEXT_X86, md_context->GetContextCPU()); - const MDRawContextX86 *md_raw_context = md_context->GetContextX86(); + const MDRawContextX86* md_raw_context = md_context->GetContextX86(); ASSERT_TRUE(md_raw_context != NULL); ASSERT_EQ((uint32_t) (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL), (md_raw_context->context_flags @@ -1157,7 +1157,7 @@ TEST(Dump, OneExceptionX86XState) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(1U, minidump.GetDirectoryEntryCount()); - MinidumpException *md_exception = minidump.GetException(); + MinidumpException* md_exception = minidump.GetException(); ASSERT_TRUE(md_exception != NULL); uint32_t thread_id; @@ -1171,10 +1171,10 @@ TEST(Dump, OneExceptionX86XState) { EXPECT_EQ(0x0919a9b9c9d9e9f9ULL, raw_exception->exception_record.exception_address); - MinidumpContext *md_context = md_exception->GetContext(); + MinidumpContext* md_context = md_exception->GetContext(); ASSERT_TRUE(md_context != NULL); ASSERT_EQ((uint32_t) MD_CONTEXT_X86, md_context->GetContextCPU()); - const MDRawContextX86 *md_raw_context = md_context->GetContextX86(); + const MDRawContextX86* md_raw_context = md_context->GetContextX86(); ASSERT_TRUE(md_raw_context != NULL); ASSERT_EQ((uint32_t) (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL), (md_raw_context->context_flags @@ -1242,7 +1242,7 @@ TEST(Dump, OneExceptionX86NoCPUFlags) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(2U, minidump.GetDirectoryEntryCount()); - MinidumpException *md_exception = minidump.GetException(); + MinidumpException* md_exception = minidump.GetException(); ASSERT_TRUE(md_exception != NULL); uint32_t thread_id; @@ -1256,11 +1256,11 @@ TEST(Dump, OneExceptionX86NoCPUFlags) { EXPECT_EQ(0x0919a9b9c9d9e9f9ULL, raw_exception->exception_record.exception_address); - MinidumpContext *md_context = md_exception->GetContext(); + MinidumpContext* md_context = md_exception->GetContext(); ASSERT_TRUE(md_context != NULL); ASSERT_EQ((uint32_t) MD_CONTEXT_X86, md_context->GetContextCPU()); - const MDRawContextX86 *md_raw_context = md_context->GetContextX86(); + const MDRawContextX86* md_raw_context = md_context->GetContextX86(); ASSERT_TRUE(md_raw_context != NULL); // Even though the CPU flags were missing from the context_flags, the @@ -1324,7 +1324,7 @@ TEST(Dump, OneExceptionX86NoCPUFlagsNoSystemInfo) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(1U, minidump.GetDirectoryEntryCount()); - MinidumpException *md_exception = minidump.GetException(); + MinidumpException* md_exception = minidump.GetException(); ASSERT_TRUE(md_exception != NULL); uint32_t thread_id; @@ -1341,7 +1341,7 @@ TEST(Dump, OneExceptionX86NoCPUFlagsNoSystemInfo) { // The context record of the exception is unusable because the context_flags // don't have CPU type information and at the same time the minidump lacks // system info stream so it is impossible to deduce the CPU type. - MinidumpContext *md_context = md_exception->GetContext(); + MinidumpContext* md_context = md_exception->GetContext(); ASSERT_EQ(NULL, md_context); } @@ -1387,7 +1387,7 @@ TEST(Dump, OneExceptionARM) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(1U, minidump.GetDirectoryEntryCount()); - MinidumpException *md_exception = minidump.GetException(); + MinidumpException* md_exception = minidump.GetException(); ASSERT_TRUE(md_exception != NULL); uint32_t thread_id; @@ -1401,10 +1401,10 @@ TEST(Dump, OneExceptionARM) { EXPECT_EQ(0x0919a9b9c9d9e9f9ULL, raw_exception->exception_record.exception_address); - MinidumpContext *md_context = md_exception->GetContext(); + MinidumpContext* md_context = md_exception->GetContext(); ASSERT_TRUE(md_context != NULL); ASSERT_EQ((uint32_t) MD_CONTEXT_ARM, md_context->GetContextCPU()); - const MDRawContextARM *md_raw_context = md_context->GetContextARM(); + const MDRawContextARM* md_raw_context = md_context->GetContextARM(); ASSERT_TRUE(md_raw_context != NULL); ASSERT_EQ((uint32_t) MD_CONTEXT_ARM_INTEGER, (md_raw_context->context_flags @@ -1471,7 +1471,7 @@ TEST(Dump, OneExceptionARMOldFlags) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(1U, minidump.GetDirectoryEntryCount()); - MinidumpException *md_exception = minidump.GetException(); + MinidumpException* md_exception = minidump.GetException(); ASSERT_TRUE(md_exception != NULL); uint32_t thread_id; @@ -1485,10 +1485,10 @@ TEST(Dump, OneExceptionARMOldFlags) { EXPECT_EQ(0x0919a9b9c9d9e9f9ULL, raw_exception->exception_record.exception_address); - MinidumpContext *md_context = md_exception->GetContext(); + MinidumpContext* md_context = md_exception->GetContext(); ASSERT_TRUE(md_context != NULL); ASSERT_EQ((uint32_t) MD_CONTEXT_ARM, md_context->GetContextCPU()); - const MDRawContextARM *md_raw_context = md_context->GetContextARM(); + const MDRawContextARM* md_raw_context = md_context->GetContextARM(); ASSERT_TRUE(md_raw_context != NULL); ASSERT_EQ((uint32_t) MD_CONTEXT_ARM_INTEGER, (md_raw_context->context_flags @@ -1570,7 +1570,7 @@ TEST(Dump, OneExceptionMIPS) { ASSERT_TRUE(minidump.Read()); ASSERT_EQ(1U, minidump.GetDirectoryEntryCount()); - MinidumpException *md_exception = minidump.GetException(); + MinidumpException* md_exception = minidump.GetException(); ASSERT_TRUE(md_exception != NULL); uint32_t thread_id; diff --git a/src/processor/module_comparer.cc b/src/processor/module_comparer.cc index 025ab883..669f1133 100644 --- a/src/processor/module_comparer.cc +++ b/src/processor/module_comparer.cc @@ -52,7 +52,7 @@ namespace google_breakpad { -bool ModuleComparer::Compare(const string &symbol_data) { +bool ModuleComparer::Compare(const string& symbol_data) { scoped_ptr<BasicModule> basic_module(new BasicModule("test_module")); scoped_ptr<FastModule> fast_module(new FastModule("test_module")); @@ -284,7 +284,7 @@ bool ModuleComparer::CompareCRM( while (iter1 != basic_crm->map_->end() && iter2 != fast_crm->map_.end()) { ASSERT_TRUE(iter1->first == iter2.GetKey()); - StaticContainedRangeMap<MemAddr, char> *child = + StaticContainedRangeMap<MemAddr, char>* child = new StaticContainedRangeMap<MemAddr, char>( reinterpret_cast<const char*>(iter2.GetValuePtr())); ASSERT_TRUE(CompareCRM(iter1->second, child)); diff --git a/src/processor/module_comparer.h b/src/processor/module_comparer.h index fcbd5177..3691081d 100644 --- a/src/processor/module_comparer.h +++ b/src/processor/module_comparer.h @@ -64,7 +64,7 @@ class ModuleComparer { // FastSourceLineResolver loads its module using the serialized memory chunk, // Then, traverse both modules together and compare underlying data // return true if both modules contain exactly same data. - bool Compare(const string &symbol_data); + bool Compare(const string& symbol_data); private: typedef BasicSourceLineResolver::Module BasicModule; diff --git a/src/processor/module_factory.h b/src/processor/module_factory.h index 7aa7caa5..c6465f42 100644 --- a/src/processor/module_factory.h +++ b/src/processor/module_factory.h @@ -46,14 +46,14 @@ class ModuleFactory { public: virtual ~ModuleFactory() { }; virtual SourceLineResolverBase::Module* CreateModule( - const string &name) const = 0; + const string& name) const = 0; }; class BasicModuleFactory : public ModuleFactory { public: virtual ~BasicModuleFactory() { } virtual BasicSourceLineResolver::Module* CreateModule( - const string &name) const { + const string& name) const { return new BasicSourceLineResolver::Module(name); } }; @@ -62,7 +62,7 @@ class FastModuleFactory : public ModuleFactory { public: virtual ~FastModuleFactory() { } virtual FastSourceLineResolver::Module* CreateModule( - const string &name) const { + const string& name) const { return new FastSourceLineResolver::Module(name); } }; diff --git a/src/processor/module_serializer.cc b/src/processor/module_serializer.cc index 6ac60c1f..04cadc80 100644 --- a/src/processor/module_serializer.cc +++ b/src/processor/module_serializer.cc @@ -48,7 +48,7 @@ namespace google_breakpad { RangeMapSerializer< MemAddr, linked_ptr<BasicSourceLineResolver::Line> > SimpleSerializer<BasicSourceLineResolver::Function>::range_map_serializer_; -size_t ModuleSerializer::SizeOf(const BasicSourceLineResolver::Module &module) { +size_t ModuleSerializer::SizeOf(const BasicSourceLineResolver::Module& module) { size_t total_size_alloc_ = 0; // Size of the "is_corrupt" flag. @@ -80,8 +80,8 @@ size_t ModuleSerializer::SizeOf(const BasicSourceLineResolver::Module &module) { return total_size_alloc_; } -char *ModuleSerializer::Write(const BasicSourceLineResolver::Module &module, - char *dest) { +char* ModuleSerializer::Write(const BasicSourceLineResolver::Module& module, + char* dest) { // Write the is_corrupt flag. dest = SimpleSerializer<bool>::Write(module.is_corrupt_, dest); // Write header. @@ -101,12 +101,12 @@ char *ModuleSerializer::Write(const BasicSourceLineResolver::Module &module, } char* ModuleSerializer::Serialize( - const BasicSourceLineResolver::Module &module, unsigned int *size) { + const BasicSourceLineResolver::Module& module, unsigned int* size) { // Compute size of memory to allocate. unsigned int size_to_alloc = SizeOf(module); // Allocate memory for serialized data. - char *serialized_data = new char[size_to_alloc]; + char* serialized_data = new char[size_to_alloc]; if (!serialized_data) { BPLOG(ERROR) << "ModuleSerializer: memory allocation failed, " << "size to alloc: " << size_to_alloc; @@ -115,7 +115,7 @@ char* ModuleSerializer::Serialize( } // Write serialized data to allocated memory chunk. - char *end_address = Write(module, serialized_data); + char* end_address = Write(module, serialized_data); // Verify the allocated memory size is equal to the size of data been written. unsigned int size_written = static_cast<unsigned int>(end_address - serialized_data); @@ -131,8 +131,8 @@ char* ModuleSerializer::Serialize( } bool ModuleSerializer::SerializeModuleAndLoadIntoFastResolver( - const BasicSourceLineResolver::ModuleMap::const_iterator &iter, - FastSourceLineResolver *fast_resolver) { + const BasicSourceLineResolver::ModuleMap::const_iterator& iter, + FastSourceLineResolver* fast_resolver) { BPLOG(INFO) << "Converting symbol " << iter->first.c_str(); // Cast SourceLineResolverBase::Module* to BasicSourceLineResolver::Module*. @@ -161,8 +161,8 @@ bool ModuleSerializer::SerializeModuleAndLoadIntoFastResolver( } void ModuleSerializer::ConvertAllModules( - const BasicSourceLineResolver *basic_resolver, - FastSourceLineResolver *fast_resolver) { + const BasicSourceLineResolver* basic_resolver, + FastSourceLineResolver* fast_resolver) { // Check for NULL pointer. if (!basic_resolver || !fast_resolver) return; @@ -175,9 +175,9 @@ void ModuleSerializer::ConvertAllModules( } bool ModuleSerializer::ConvertOneModule( - const string &moduleid, - const BasicSourceLineResolver *basic_resolver, - FastSourceLineResolver *fast_resolver) { + const string& moduleid, + const BasicSourceLineResolver* basic_resolver, + FastSourceLineResolver* fast_resolver) { // Check for NULL pointer. if (!basic_resolver || !fast_resolver) return false; @@ -191,7 +191,7 @@ bool ModuleSerializer::ConvertOneModule( } char* ModuleSerializer::SerializeSymbolFileData( - const string &symbol_data, unsigned int *size) { + const string& symbol_data, unsigned int* size) { scoped_ptr<BasicSourceLineResolver::Module> module( new BasicSourceLineResolver::Module("no name")); scoped_array<char> buffer(new char[symbol_data.size() + 1]); diff --git a/src/processor/module_serializer.h b/src/processor/module_serializer.h index effb0091..932ac3d7 100644 --- a/src/processor/module_serializer.h +++ b/src/processor/module_serializer.h @@ -61,38 +61,38 @@ class ModuleSerializer { public: // Compute the size of memory required to serialize a module. Return the // total size needed for serialization. - size_t SizeOf(const BasicSourceLineResolver::Module &module); + size_t SizeOf(const BasicSourceLineResolver::Module& module); // Write a module into an allocated memory chunk with required size. // Return the "end" of data, i.e., the address after the final byte of data. - char* Write(const BasicSourceLineResolver::Module &module, char *dest); + char* Write(const BasicSourceLineResolver::Module& module, char* dest); // Serializes a loaded Module object into a chunk of memory data and returns // the address of memory chunk. If size != NULL, *size is set to the memory // size allocated for the serialized data. // Caller takes the ownership of the memory chunk (allocated on heap), and // owner should call delete [] to free the memory after use. - char* Serialize(const BasicSourceLineResolver::Module &module, - unsigned int *size = NULL); + char* Serialize(const BasicSourceLineResolver::Module& module, + unsigned int* size = NULL); // Given the string format symbol_data, produces a chunk of serialized data. // Caller takes ownership of the serialized data (on heap), and owner should // call delete [] to free the memory after use. - char* SerializeSymbolFileData(const string &symbol_data, - unsigned int *size = NULL); + char* SerializeSymbolFileData(const string& symbol_data, + unsigned int* size = NULL); // Serializes one loaded module with given moduleid in the basic source line // resolver, and loads the serialized data into the fast source line resolver. // Return false if the basic source line doesn't have a module with the given // moduleid. - bool ConvertOneModule(const string &moduleid, - const BasicSourceLineResolver *basic_resolver, - FastSourceLineResolver *fast_resolver); + bool ConvertOneModule(const string& moduleid, + const BasicSourceLineResolver* basic_resolver, + FastSourceLineResolver* fast_resolver); // Serializes all the loaded modules in a basic source line resolver, and // loads the serialized data into a fast source line resolver. - void ConvertAllModules(const BasicSourceLineResolver *basic_resolver, - FastSourceLineResolver *fast_resolver); + void ConvertAllModules(const BasicSourceLineResolver* basic_resolver, + FastSourceLineResolver* fast_resolver); private: // Convenient type names. @@ -102,8 +102,8 @@ class ModuleSerializer { // Internal implementation for ConvertOneModule and ConvertAllModules methods. bool SerializeModuleAndLoadIntoFastResolver( - const BasicSourceLineResolver::ModuleMap::const_iterator &iter, - FastSourceLineResolver *fast_resolver); + const BasicSourceLineResolver::ModuleMap::const_iterator& iter, + FastSourceLineResolver* fast_resolver); // Number of Maps that Module class contains. static const int32_t kNumberMaps_ = diff --git a/src/processor/pathname_stripper.cc b/src/processor/pathname_stripper.cc index 839287bd..c425b46a 100644 --- a/src/processor/pathname_stripper.cc +++ b/src/processor/pathname_stripper.cc @@ -38,7 +38,7 @@ namespace google_breakpad { // static -string PathnameStripper::File(const string &path) { +string PathnameStripper::File(const string& path) { string::size_type slash = path.rfind('/'); string::size_type backslash = path.rfind('\\'); diff --git a/src/processor/pathname_stripper.h b/src/processor/pathname_stripper.h index 423ca0d0..fdf15e03 100644 --- a/src/processor/pathname_stripper.h +++ b/src/processor/pathname_stripper.h @@ -45,7 +45,7 @@ class PathnameStripper { // Given path, a pathname with components separated by slashes (/) or // backslashes (\), returns the trailing component, without any separator. // If path ends in a separator character, returns an empty string. - static string File(const string &path); + static string File(const string& path); }; } // namespace google_breakpad diff --git a/src/processor/pathname_stripper_unittest.cc b/src/processor/pathname_stripper_unittest.cc index 1bff4cb0..61f74fa5 100644 --- a/src/processor/pathname_stripper_unittest.cc +++ b/src/processor/pathname_stripper_unittest.cc @@ -80,7 +80,7 @@ static bool RunTests() { } // namespace -int main(int argc, char **argv) { +int main(int argc, char** argv) { BPLOG_INIT(&argc, &argv); return RunTests() ? 0 : 1; diff --git a/src/processor/postfix_evaluator-inl.h b/src/processor/postfix_evaluator-inl.h index d7dbeac2..f567b1c8 100644 --- a/src/processor/postfix_evaluator-inl.h +++ b/src/processor/postfix_evaluator-inl.h @@ -58,19 +58,19 @@ using std::ostringstream; // before returning failure. class AutoStackClearer { public: - explicit AutoStackClearer(vector<string> *stack) : stack_(stack) {} + explicit AutoStackClearer(vector<string>* stack) : stack_(stack) {} ~AutoStackClearer() { stack_->clear(); } private: - vector<string> *stack_; + vector<string>* stack_; }; template<typename ValueType> bool PostfixEvaluator<ValueType>::EvaluateToken( - const string &token, - const string &expression, - DictionaryValidityType *assigned) { + const string& token, + const string& expression, + DictionaryValidityType* assigned) { // There are enough binary operations that do exactly the same thing // (other than the specific operation, of course) that it makes sense // to share as much code as possible. @@ -203,8 +203,8 @@ bool PostfixEvaluator<ValueType>::EvaluateToken( template<typename ValueType> bool PostfixEvaluator<ValueType>::EvaluateInternal( - const string &expression, - DictionaryValidityType *assigned) { + const string& expression, + DictionaryValidityType* assigned) { // Tokenize, splitting on whitespace. istringstream stream(expression); string token; @@ -231,8 +231,8 @@ bool PostfixEvaluator<ValueType>::EvaluateInternal( } template<typename ValueType> -bool PostfixEvaluator<ValueType>::Evaluate(const string &expression, - DictionaryValidityType *assigned) { +bool PostfixEvaluator<ValueType>::Evaluate(const string& expression, + DictionaryValidityType* assigned) { // Ensure that the stack is cleared before returning. AutoStackClearer clearer(&stack_); @@ -250,8 +250,8 @@ bool PostfixEvaluator<ValueType>::Evaluate(const string &expression, } template<typename ValueType> -bool PostfixEvaluator<ValueType>::EvaluateForValue(const string &expression, - ValueType *result) { +bool PostfixEvaluator<ValueType>::EvaluateForValue(const string& expression, + ValueType* result) { // Ensure that the stack is cleared before returning. AutoStackClearer clearer(&stack_); @@ -271,7 +271,7 @@ bool PostfixEvaluator<ValueType>::EvaluateForValue(const string &expression, template<typename ValueType> typename PostfixEvaluator<ValueType>::PopResult PostfixEvaluator<ValueType>::PopValueOrIdentifier( - ValueType *value, string *identifier) { + ValueType* value, string* identifier) { // There needs to be at least one element on the stack to pop. if (!stack_.size()) return POP_RESULT_FAIL; @@ -314,7 +314,7 @@ PostfixEvaluator<ValueType>::PopValueOrIdentifier( template<typename ValueType> -bool PostfixEvaluator<ValueType>::PopValue(ValueType *value) { +bool PostfixEvaluator<ValueType>::PopValue(ValueType* value) { ValueType literal = ValueType(); string token; PopResult result; @@ -343,14 +343,14 @@ bool PostfixEvaluator<ValueType>::PopValue(ValueType *value) { template<typename ValueType> -bool PostfixEvaluator<ValueType>::PopValues(ValueType *value1, - ValueType *value2) { +bool PostfixEvaluator<ValueType>::PopValues(ValueType* value1, + ValueType* value2) { return PopValue(value2) && PopValue(value1); } template<typename ValueType> -void PostfixEvaluator<ValueType>::PushValue(const ValueType &value) { +void PostfixEvaluator<ValueType>::PushValue(const ValueType& value) { ostringstream token_stream; token_stream << value; stack_.push_back(token_stream.str()); diff --git a/src/processor/postfix_evaluator.h b/src/processor/postfix_evaluator.h index 94b66190..d847a9b1 100644 --- a/src/processor/postfix_evaluator.h +++ b/src/processor/postfix_evaluator.h @@ -95,7 +95,7 @@ class PostfixEvaluator { // (^) will not be supported. |dictionary| may be NULL, but evaluation // will fail in that case unless set_dictionary is used before calling // Evaluate. - PostfixEvaluator(DictionaryType *dictionary, const MemoryRegion *memory) + PostfixEvaluator(DictionaryType* dictionary, const MemoryRegion* memory) : dictionary_(dictionary), memory_(memory), stack_() {} // Evaluate the expression, starting with an empty stack. The results of @@ -105,18 +105,18 @@ class PostfixEvaluator { // non-NULL, any keys set in the dictionary as a result of evaluation // will also be set to true in assigned, providing a way to determine if // an expression modifies any of its input variables. - bool Evaluate(const string &expression, DictionaryValidityType *assigned); + bool Evaluate(const string& expression, DictionaryValidityType* assigned); // Like Evaluate, but provides the value left on the stack to the // caller. If evaluation succeeds and leaves exactly one value on // the stack, pop that value, store it in *result, and return true. // Otherwise, return false. - bool EvaluateForValue(const string &expression, ValueType *result); + bool EvaluateForValue(const string& expression, ValueType* result); DictionaryType* dictionary() const { return dictionary_; } // Reset the dictionary. PostfixEvaluator does not take ownership. - void set_dictionary(DictionaryType *dictionary) {dictionary_ = dictionary; } + void set_dictionary(DictionaryType* dictionary) {dictionary_ = dictionary; } private: // Return values for PopValueOrIdentifier @@ -132,40 +132,40 @@ class PostfixEvaluator { // if the topmost entry is a constant or variable identifier, and sets // |identifier| accordingly. Returns POP_RESULT_FAIL on failure, such // as when the stack is empty. - PopResult PopValueOrIdentifier(ValueType *value, string *identifier); + PopResult PopValueOrIdentifier(ValueType* value, string* identifier); // Retrieves the topmost value on the stack. If the topmost entry is // an identifier, the dictionary is queried for the identifier's value. // Returns false on failure, such as when the stack is empty or when // a nonexistent identifier is named. - bool PopValue(ValueType *value); + bool PopValue(ValueType* value); // Retrieves the top two values on the stack, in the style of PopValue. // value2 is popped before value1, so that value1 corresponds to the // entry that was pushed prior to value2. Returns false on failure. - bool PopValues(ValueType *value1, ValueType *value2); + bool PopValues(ValueType* value1, ValueType* value2); // Pushes a new value onto the stack. - void PushValue(const ValueType &value); + void PushValue(const ValueType& value); // Evaluate expression, updating *assigned if it is non-zero. Return // true if evaluation completes successfully. Do not clear the stack // upon successful evaluation. - bool EvaluateInternal(const string &expression, - DictionaryValidityType *assigned); + bool EvaluateInternal(const string& expression, + DictionaryValidityType* assigned); - bool EvaluateToken(const string &token, - const string &expression, - DictionaryValidityType *assigned); + bool EvaluateToken(const string& token, + const string& expression, + DictionaryValidityType* assigned); // The dictionary mapping constant and variable identifiers (strings) to // values. Keys beginning with '$' are treated as variable names, and // PostfixEvaluator is free to create and modify these keys. Weak pointer. - DictionaryType *dictionary_; + DictionaryType* dictionary_; // If non-NULL, the MemoryRegion used for dereference (^) operations. // If NULL, dereferencing is unsupported and will fail. Weak pointer. - const MemoryRegion *memory_; + const MemoryRegion* memory_; // The stack contains state information as execution progresses. Values // are pushed on to it as the expression string is read and as operations diff --git a/src/processor/postfix_evaluator_unittest.cc b/src/processor/postfix_evaluator_unittest.cc index f1189828..5a01584a 100644 --- a/src/processor/postfix_evaluator_unittest.cc +++ b/src/processor/postfix_evaluator_unittest.cc @@ -60,19 +60,19 @@ class FakeMemoryRegion : public MemoryRegion { public: virtual uint64_t GetBase() const { return 0; } virtual uint32_t GetSize() const { return 0; } - virtual bool GetMemoryAtAddress(uint64_t address, uint8_t *value) const { + virtual bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const { *value = address + 1; return true; } - virtual bool GetMemoryAtAddress(uint64_t address, uint16_t *value) const { + virtual bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const { *value = address + 1; return true; } - virtual bool GetMemoryAtAddress(uint64_t address, uint32_t *value) const { + virtual bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const { *value = address + 1; return true; } - virtual bool GetMemoryAtAddress(uint64_t address, uint64_t *value) const { + virtual bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const { *value = address + 1; return true; } @@ -94,17 +94,17 @@ struct EvaluateTest { struct EvaluateTestSet { // The dictionary used for all tests in the set. - PostfixEvaluator<unsigned int>::DictionaryType *dictionary; + PostfixEvaluator<unsigned int>::DictionaryType* dictionary; // The list of tests. - const EvaluateTest *evaluate_tests; + const EvaluateTest* evaluate_tests; // The number of tests. unsigned int evaluate_test_count; // Identifiers and their expected values upon completion of the Evaluate // tests in the set. - map<string, unsigned int> *validate_data; + map<string, unsigned int>* validate_data; }; @@ -227,9 +227,9 @@ static bool RunTests() { for (unsigned int evaluate_test_set_index = 0; evaluate_test_set_index < evaluate_test_set_count; ++evaluate_test_set_index) { - EvaluateTestSet *evaluate_test_set = + EvaluateTestSet* evaluate_test_set = &evaluate_test_sets[evaluate_test_set_index]; - const EvaluateTest *evaluate_tests = evaluate_test_set->evaluate_tests; + const EvaluateTest* evaluate_tests = evaluate_test_set->evaluate_tests; unsigned int evaluate_test_count = evaluate_test_set->evaluate_test_count; // The same dictionary will be used for each test in the set. Earlier @@ -242,7 +242,7 @@ static bool RunTests() { for (unsigned int evaluate_test_index = 0; evaluate_test_index < evaluate_test_count; ++evaluate_test_index) { - const EvaluateTest *evaluate_test = &evaluate_tests[evaluate_test_index]; + const EvaluateTest* evaluate_test = &evaluate_tests[evaluate_test_index]; // Do the test. bool result = postfix_evaluator.Evaluate(evaluate_test->expression, @@ -344,7 +344,7 @@ static bool RunTests() { postfix_evaluator.set_dictionary(&dictionary_2); for (int i = 0; i < evaluate_for_value_tests_2_size; i++) { - const EvaluateForValueTest *test = &evaluate_for_value_tests_2[i]; + const EvaluateForValueTest* test = &evaluate_for_value_tests_2[i]; unsigned int result; if (postfix_evaluator.EvaluateForValue(test->expression, &result) != test->evaluable) { @@ -396,7 +396,7 @@ static bool RunTests() { } // namespace -int main(int argc, char **argv) { +int main(int argc, char** argv) { BPLOG_INIT(&argc, &argv); return RunTests() ? 0 : 1; diff --git a/src/processor/process_state.cc b/src/processor/process_state.cc index 43c4a4b8..c9269e41 100644 --- a/src/processor/process_state.cc +++ b/src/processor/process_state.cc @@ -51,7 +51,7 @@ void ProcessState::Clear() { crash_address_ = 0; assertion_.clear(); requesting_thread_ = -1; - for (vector<CallStack *>::const_iterator iterator = threads_.begin(); + for (vector<CallStack*>::const_iterator iterator = threads_.begin(); iterator != threads_.end(); ++iterator) { delete *iterator; diff --git a/src/processor/range_map-inl.h b/src/processor/range_map-inl.h index 4d3b0eb9..6bfc7255 100644 --- a/src/processor/range_map-inl.h +++ b/src/processor/range_map-inl.h @@ -47,16 +47,16 @@ namespace google_breakpad { template<typename AddressType, typename EntryType> -bool RangeMap<AddressType, EntryType>::StoreRange(const AddressType &base, - const AddressType &size, - const EntryType &entry) { +bool RangeMap<AddressType, EntryType>::StoreRange(const AddressType& base, + const AddressType& size, + const EntryType& entry) { return StoreRangeInternal(base, 0 /* delta */, size, entry); } template<typename AddressType, typename EntryType> bool RangeMap<AddressType, EntryType>::StoreRangeInternal( - const AddressType &base, const AddressType &delta, - const AddressType &size, const EntryType &entry) { + const AddressType& base, const AddressType& delta, + const AddressType& size, const EntryType& entry) { AddressType high = base + (size - 1); // Check for undersize or overflow. @@ -181,8 +181,8 @@ bool RangeMap<AddressType, EntryType>::StoreRangeInternal( template<typename AddressType, typename EntryType> bool RangeMap<AddressType, EntryType>::RetrieveRange( - const AddressType &address, EntryType *entry, AddressType *entry_base, - AddressType *entry_delta, AddressType *entry_size) const { + const AddressType& address, EntryType* entry, AddressType* entry_base, + AddressType* entry_delta, AddressType* entry_size) const { BPLOG_IF(ERROR, !entry) << "RangeMap::RetrieveRange requires |entry|"; assert(entry); @@ -212,8 +212,8 @@ bool RangeMap<AddressType, EntryType>::RetrieveRange( template<typename AddressType, typename EntryType> bool RangeMap<AddressType, EntryType>::RetrieveNearestRange( - const AddressType &address, EntryType *entry, AddressType *entry_base, - AddressType *entry_delta, AddressType *entry_size) const { + const AddressType& address, EntryType* entry, AddressType* entry_base, + AddressType* entry_delta, AddressType* entry_size) const { BPLOG_IF(ERROR, !entry) << "RangeMap::RetrieveNearestRange requires |entry|"; assert(entry); @@ -245,8 +245,8 @@ bool RangeMap<AddressType, EntryType>::RetrieveNearestRange( template<typename AddressType, typename EntryType> bool RangeMap<AddressType, EntryType>::RetrieveRangeAtIndex( - int index, EntryType *entry, AddressType *entry_base, - AddressType *entry_delta, AddressType *entry_size) const { + int index, EntryType* entry, AddressType* entry_base, + AddressType* entry_delta, AddressType* entry_size) const { BPLOG_IF(ERROR, !entry) << "RangeMap::RetrieveRangeAtIndex requires |entry|"; assert(entry); diff --git a/src/processor/range_map.h b/src/processor/range_map.h index 33f32973..baea91cf 100644 --- a/src/processor/range_map.h +++ b/src/processor/range_map.h @@ -78,17 +78,17 @@ class RangeMap { // stored in the map. If enable_shrink_down is true and there is an overlap // between the current range and some other range (already in the map), // shrink down the range which ends at a higher address. - bool StoreRange(const AddressType &base, const AddressType &size, - const EntryType &entry); + bool StoreRange(const AddressType& base, const AddressType& size, + const EntryType& entry); // Locates the range encompassing the supplied address. If there is no such // range, returns false. entry_base, entry_delta, and entry_size, if // non-NULL, are set to the base, delta, and size of the entry's range. // A positive entry delta (> 0) indicates that there was an overlap and the // entry was shrunk down (original start address was increased by delta). - bool RetrieveRange(const AddressType &address, EntryType *entry, - AddressType *entry_base, AddressType *entry_delta, - AddressType *entry_size) const; + bool RetrieveRange(const AddressType& address, EntryType* entry, + AddressType* entry_base, AddressType* entry_delta, + AddressType* entry_size) const; // Locates the range encompassing the supplied address, if one exists. // If no range encompasses the supplied address, locates the nearest range @@ -97,9 +97,9 @@ class RangeMap { // if non-NULL, are set to the base, delta, and size of the entry's range. // A positive entry delta (> 0) indicates that there was an overlap and the // entry was shrunk down (original start address was increased by delta). - bool RetrieveNearestRange(const AddressType &address, EntryType *entry, - AddressType *entry_base, AddressType *entry_delta, - AddressType *entry_size) const; + bool RetrieveNearestRange(const AddressType& address, EntryType* entry, + AddressType* entry_base, AddressType* entry_delta, + AddressType* entry_size) const; // Treating all ranges as a list ordered by the address spaces that they // occupy, locates the range at the index specified by index. Returns @@ -110,9 +110,9 @@ class RangeMap { // entry was shrunk down (original start address was increased by delta). // // RetrieveRangeAtIndex is not optimized for speedy operation. - bool RetrieveRangeAtIndex(int index, EntryType *entry, - AddressType *entry_base, AddressType *entry_delta, - AddressType *entry_size) const; + bool RetrieveRangeAtIndex(int index, EntryType* entry, + AddressType* entry_base, AddressType* entry_delta, + AddressType* entry_size) const; // Returns the number of ranges stored in the RangeMap. int GetCount() const; @@ -128,13 +128,13 @@ class RangeMap { // Same a StoreRange() with the only exception that the |delta| can be // passed in. - bool StoreRangeInternal(const AddressType &base, const AddressType &delta, - const AddressType &size, const EntryType &entry); + bool StoreRangeInternal(const AddressType& base, const AddressType& delta, + const AddressType& size, const EntryType& entry); class Range { public: - Range(const AddressType &base, const AddressType &delta, - const EntryType &entry) + Range(const AddressType& base, const AddressType& delta, + const EntryType& entry) : base_(base), delta_(delta), entry_(entry) {} AddressType base() const { return base_; } diff --git a/src/processor/range_map_unittest.cc b/src/processor/range_map_unittest.cc index 31b89e5d..0f1c7131 100644 --- a/src/processor/range_map_unittest.cc +++ b/src/processor/range_map_unittest.cc @@ -92,7 +92,7 @@ struct RangeTest { // sequence on the same RangeMap. struct RangeTestSet { // An array of RangeTests - const RangeTest *range_tests; + const RangeTest* range_tests; // The number of tests in the set unsigned int range_test_count; @@ -102,7 +102,7 @@ struct RangeTestSet { // StoreTest uses the data in a RangeTest and calls StoreRange on the // test RangeMap. It returns true if the expected result occurred, and // false if something else happened. -static bool StoreTest(TestMap *range_map, const RangeTest *range_test) { +static bool StoreTest(TestMap* range_map, const RangeTest* range_test) { linked_ptr<CountedObject> object(new CountedObject(range_test->id)); bool stored = range_map->StoreRange(range_test->address, range_test->size, @@ -126,7 +126,7 @@ static bool StoreTest(TestMap *range_map, const RangeTest *range_test) { // map entry at the specified range,) it returns true, otherwise, it returns // false. RetrieveTest will check the values around the base address and // the high address of a range to guard against off-by-one errors. -static bool RetrieveTest(TestMap *range_map, const RangeTest *range_test) { +static bool RetrieveTest(TestMap* range_map, const RangeTest* range_test) { for (unsigned int side = 0; side <= 1; ++side) { // When side == 0, check the low side (base address) of each range. // When side == 1, check the high side (base + size) of each range. @@ -270,9 +270,9 @@ static bool RetrieveTest(TestMap *range_map, const RangeTest *range_test) { // and verifying that each call returns a different object than the previous // call, and that ranges are returned with increasing base addresses. Returns // false if the test fails. -static bool RetrieveIndexTest(TestMap *range_map, int set) { +static bool RetrieveIndexTest(TestMap* range_map, int set) { linked_ptr<CountedObject> object; - CountedObject *last_object = NULL; + CountedObject* last_object = NULL; AddressType last_base = 0; int object_count = range_map->GetCount(); @@ -469,7 +469,7 @@ static bool RunTests() { for (unsigned int range_test_set_index = 0; range_test_set_index < range_test_set_count; ++range_test_set_index) { - const RangeTest *range_tests = + const RangeTest* range_tests = range_test_sets[range_test_set_index].range_tests; unsigned int range_test_count = range_test_sets[range_test_set_index].range_test_count; @@ -480,7 +480,7 @@ static bool RunTests() { for (unsigned int range_test_index = 0; range_test_index < range_test_count; ++range_test_index) { - const RangeTest *range_test = &range_tests[range_test_index]; + const RangeTest* range_test = &range_tests[range_test_index]; if (!StoreTest(range_map.get(), range_test)) return false; @@ -512,7 +512,7 @@ static bool RunTests() { for (unsigned int range_test_index = 0; range_test_index < range_test_count; ++range_test_index) { - const RangeTest *range_test = &range_tests[range_test_index]; + const RangeTest* range_test = &range_tests[range_test_index]; if (!RetrieveTest(range_map.get(), range_test)) return false; } @@ -552,7 +552,7 @@ static bool RunTests() { } // namespace -int main(int argc, char **argv) { +int main(int argc, char** argv) { BPLOG_INIT(&argc, &argv); return RunTests() ? 0 : 1; diff --git a/src/processor/simple_serializer-inl.h b/src/processor/simple_serializer-inl.h index 606bb3ce..cb1a0408 100644 --- a/src/processor/simple_serializer-inl.h +++ b/src/processor/simple_serializer-inl.h @@ -56,12 +56,12 @@ class SimpleSerializer<bool> { public: static size_t SizeOf(bool boolean) { return 1; } - static char *Write(bool boolean, char *dest) { + static char* Write(bool boolean, char* dest) { *dest = static_cast<char>(boolean? 255 : 0); return ++dest; } - static const char *Read(const char *source, bool *value) { + static const char* Read(const char* source, bool* value) { *value = ((*source) == 0 ? false : true); return ++source; } @@ -71,9 +71,9 @@ class SimpleSerializer<bool> { template<> class SimpleSerializer<string> { public: - static size_t SizeOf(const string &str) { return str.size() + 1; } + static size_t SizeOf(const string& str) { return str.size() + 1; } - static char *Write(const string &str, char *dest) { + static char* Write(const string& str, char* dest) { strcpy(dest, str.c_str()); return dest + SizeOf(str); } @@ -83,11 +83,11 @@ class SimpleSerializer<string> { template<> class SimpleSerializer<const char*> { public: - static size_t SizeOf(const char *cstring) { + static size_t SizeOf(const char* cstring) { return strlen(cstring) + 1; } - static char *Write(const char *cstring, char *dest) { + static char* Write(const char* cstring, char* dest) { strcpy(dest, cstring); return dest + SizeOf(cstring); } @@ -98,13 +98,13 @@ template<> class SimpleSerializer<BasicSourceLineResolver::Line> { typedef BasicSourceLineResolver::Line Line; public: - static size_t SizeOf(const Line &line) { + static size_t SizeOf(const Line& line) { return SimpleSerializer<MemAddr>::SizeOf(line.address) + SimpleSerializer<MemAddr>::SizeOf(line.size) + SimpleSerializer<int32_t>::SizeOf(line.source_file_id) + SimpleSerializer<int32_t>::SizeOf(line.line); } - static char *Write(const Line &line, char *dest) { + static char* Write(const Line& line, char* dest) { dest = SimpleSerializer<MemAddr>::Write(line.address, dest); dest = SimpleSerializer<MemAddr>::Write(line.size, dest); dest = SimpleSerializer<int32_t>::Write(line.source_file_id, dest); @@ -118,12 +118,12 @@ template<> class SimpleSerializer<BasicSourceLineResolver::PublicSymbol> { typedef BasicSourceLineResolver::PublicSymbol PublicSymbol; public: - static size_t SizeOf(const PublicSymbol &pubsymbol) { + static size_t SizeOf(const PublicSymbol& pubsymbol) { return SimpleSerializer<string>::SizeOf(pubsymbol.name) + SimpleSerializer<MemAddr>::SizeOf(pubsymbol.address) + SimpleSerializer<int32_t>::SizeOf(pubsymbol.parameter_size); } - static char *Write(const PublicSymbol &pubsymbol, char *dest) { + static char* Write(const PublicSymbol& pubsymbol, char* dest) { dest = SimpleSerializer<string>::Write(pubsymbol.name, dest); dest = SimpleSerializer<MemAddr>::Write(pubsymbol.address, dest); dest = SimpleSerializer<int32_t>::Write(pubsymbol.parameter_size, dest); @@ -135,7 +135,7 @@ class SimpleSerializer<BasicSourceLineResolver::PublicSymbol> { template<> class SimpleSerializer<WindowsFrameInfo> { public: - static size_t SizeOf(const WindowsFrameInfo &wfi) { + static size_t SizeOf(const WindowsFrameInfo& wfi) { unsigned int size = 0; size += sizeof(int32_t); // wfi.type_ size += SimpleSerializer<int32_t>::SizeOf(wfi.valid); @@ -149,7 +149,7 @@ class SimpleSerializer<WindowsFrameInfo> { size += SimpleSerializer<string>::SizeOf(wfi.program_string); return size; } - static char *Write(const WindowsFrameInfo &wfi, char *dest) { + static char* Write(const WindowsFrameInfo& wfi, char* dest) { dest = SimpleSerializer<int32_t>::Write( static_cast<const int32_t>(wfi.type_), dest); dest = SimpleSerializer<int32_t>::Write(wfi.valid, dest); @@ -170,11 +170,11 @@ template<> class SimpleSerializer< linked_ptr<BasicSourceLineResolver::Line> > { typedef BasicSourceLineResolver::Line Line; public: - static size_t SizeOf(const linked_ptr<Line> &lineptr) { + static size_t SizeOf(const linked_ptr<Line>& lineptr) { if (lineptr.get() == NULL) return 0; return SimpleSerializer<Line>::SizeOf(*(lineptr.get())); } - static char *Write(const linked_ptr<Line> &lineptr, char *dest) { + static char* Write(const linked_ptr<Line>& lineptr, char* dest) { if (lineptr.get()) dest = SimpleSerializer<Line>::Write(*(lineptr.get()), dest); return dest; @@ -187,7 +187,7 @@ class SimpleSerializer<BasicSourceLineResolver::Function> { typedef BasicSourceLineResolver::Function Function; typedef BasicSourceLineResolver::Line Line; public: - static size_t SizeOf(const Function &func) { + static size_t SizeOf(const Function& func) { unsigned int size = 0; size += SimpleSerializer<string>::SizeOf(func.name); size += SimpleSerializer<MemAddr>::SizeOf(func.address); @@ -197,7 +197,7 @@ class SimpleSerializer<BasicSourceLineResolver::Function> { return size; } - static char *Write(const Function &func, char *dest) { + static char* Write(const Function& func, char* dest) { dest = SimpleSerializer<string>::Write(func.name, dest); dest = SimpleSerializer<MemAddr>::Write(func.address, dest); dest = SimpleSerializer<MemAddr>::Write(func.size, dest); @@ -214,12 +214,12 @@ template<> class SimpleSerializer< linked_ptr<BasicSourceLineResolver::Function> > { typedef BasicSourceLineResolver::Function Function; public: - static size_t SizeOf(const linked_ptr<Function> &func) { + static size_t SizeOf(const linked_ptr<Function>& func) { if (!func.get()) return 0; return SimpleSerializer<Function>::SizeOf(*(func.get())); } - static char *Write(const linked_ptr<Function> &func, char *dest) { + static char* Write(const linked_ptr<Function>& func, char* dest) { if (func.get()) dest = SimpleSerializer<Function>::Write(*(func.get()), dest); return dest; @@ -230,11 +230,11 @@ template<> class SimpleSerializer< linked_ptr<BasicSourceLineResolver::PublicSymbol> > { typedef BasicSourceLineResolver::PublicSymbol PublicSymbol; public: - static size_t SizeOf(const linked_ptr<PublicSymbol> &pubsymbol) { + static size_t SizeOf(const linked_ptr<PublicSymbol>& pubsymbol) { if (pubsymbol.get() == NULL) return 0; return SimpleSerializer<PublicSymbol>::SizeOf(*(pubsymbol.get())); } - static char *Write(const linked_ptr<PublicSymbol> &pubsymbol, char *dest) { + static char* Write(const linked_ptr<PublicSymbol>& pubsymbol, char* dest) { if (pubsymbol.get()) dest = SimpleSerializer<PublicSymbol>::Write(*(pubsymbol.get()), dest); return dest; @@ -244,11 +244,11 @@ class SimpleSerializer< linked_ptr<BasicSourceLineResolver::PublicSymbol> > { template<> class SimpleSerializer< linked_ptr<WindowsFrameInfo> > { public: - static size_t SizeOf(const linked_ptr<WindowsFrameInfo> &wfi) { + static size_t SizeOf(const linked_ptr<WindowsFrameInfo>& wfi) { if (wfi.get() == NULL) return 0; return SimpleSerializer<WindowsFrameInfo>::SizeOf(*(wfi.get())); } - static char *Write(const linked_ptr<WindowsFrameInfo> &wfi, char *dest) { + static char* Write(const linked_ptr<WindowsFrameInfo>& wfi, char* dest) { if (wfi.get()) dest = SimpleSerializer<WindowsFrameInfo>::Write(*(wfi.get()), dest); return dest; diff --git a/src/processor/simple_serializer.h b/src/processor/simple_serializer.h index 275f51ce..9e51d806 100644 --- a/src/processor/simple_serializer.h +++ b/src/processor/simple_serializer.h @@ -49,10 +49,10 @@ typedef uint64_t MemAddr; template<class Type> class SimpleSerializer { public: // Calculate and return the size of the 'item'. - static size_t SizeOf(const Type &item) { return sizeof(item); } + static size_t SizeOf(const Type& item) { return sizeof(item); } // Write 'item' to memory location 'dest', and return to the "end" address of // data written, i.e., the address after the final byte written. - static char *Write(const Type &item, char *dest) { + static char* Write(const Type& item, char* dest) { new (dest) Type(item); return dest + SizeOf(item); } diff --git a/src/processor/simple_symbol_supplier.cc b/src/processor/simple_symbol_supplier.cc index bc5ebb68..cdc3efbf 100644 --- a/src/processor/simple_symbol_supplier.cc +++ b/src/processor/simple_symbol_supplier.cc @@ -52,14 +52,14 @@ namespace google_breakpad { -static bool file_exists(const string &file_name) { +static bool file_exists(const string& file_name) { struct stat sb; return stat(file_name.c_str(), &sb) == 0; } SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetSymbolFile( - const CodeModule *module, const SystemInfo *system_info, - string *symbol_file) { + const CodeModule* module, const SystemInfo* system_info, + string* symbol_file) { BPLOG_IF(ERROR, !symbol_file) << "SimpleSymbolSupplier::GetSymbolFile " "requires |symbol_file|"; assert(symbol_file); @@ -77,10 +77,10 @@ SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetSymbolFile( } SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetSymbolFile( - const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - string *symbol_data) { + const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + string* symbol_data) { assert(symbol_data); symbol_data->clear(); @@ -96,11 +96,11 @@ SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetSymbolFile( } SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetCStringSymbolData( - const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - char **symbol_data, - size_t *symbol_data_size) { + const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + char** symbol_data, + size_t* symbol_data_size) { assert(symbol_data); assert(symbol_data_size); @@ -123,13 +123,13 @@ SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetCStringSymbolData( return s; } -void SimpleSymbolSupplier::FreeSymbolData(const CodeModule *module) { +void SimpleSymbolSupplier::FreeSymbolData(const CodeModule* module) { if (!module) { BPLOG(INFO) << "Cannot free symbol data buffer for NULL module"; return; } - map<string, char *>::iterator it = memory_buffers_.find(module->code_file()); + map<string, char*>::iterator it = memory_buffers_.find(module->code_file()); if (it == memory_buffers_.end()) { BPLOG(INFO) << "Cannot find symbol data buffer for module " << module->code_file(); @@ -140,8 +140,8 @@ void SimpleSymbolSupplier::FreeSymbolData(const CodeModule *module) { } SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetSymbolFileAtPathFromRoot( - const CodeModule *module, const SystemInfo *system_info, - const string &root_path, string *symbol_file) { + const CodeModule* module, const SystemInfo* system_info, + const string& root_path, string* symbol_file) { BPLOG_IF(ERROR, !symbol_file) << "SimpleSymbolSupplier::GetSymbolFileAtPath " "requires |symbol_file|"; assert(symbol_file); diff --git a/src/processor/simple_symbol_supplier.h b/src/processor/simple_symbol_supplier.h index 0cde85cd..3a65c7e6 100644 --- a/src/processor/simple_symbol_supplier.h +++ b/src/processor/simple_symbol_supplier.h @@ -94,44 +94,44 @@ class SimpleSymbolSupplier : public SymbolSupplier { public: // Creates a new SimpleSymbolSupplier, using path as the root path where // symbols are stored. - explicit SimpleSymbolSupplier(const string &path) : paths_(1, path) {} + explicit SimpleSymbolSupplier(const string& path) : paths_(1, path) {} // Creates a new SimpleSymbolSupplier, using paths as a list of root // paths where symbols may be stored. - explicit SimpleSymbolSupplier(const vector<string> &paths) : paths_(paths) {} + explicit SimpleSymbolSupplier(const vector<string>& paths) : paths_(paths) {} virtual ~SimpleSymbolSupplier() {} // Returns the path to the symbol file for the given module. See the // description above. - virtual SymbolResult GetSymbolFile(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file); + virtual SymbolResult GetSymbolFile(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file); - virtual SymbolResult GetSymbolFile(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - string *symbol_data); + virtual SymbolResult GetSymbolFile(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + string* symbol_data); // Allocates data buffer on heap and writes symbol data into buffer. // Symbol supplier ALWAYS takes ownership of the data buffer. - virtual SymbolResult GetCStringSymbolData(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - char **symbol_data, - size_t *symbol_data_size); + virtual SymbolResult GetCStringSymbolData(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + char** symbol_data, + size_t* symbol_data_size); // Free the data buffer allocated in the above GetCStringSymbolData(); - virtual void FreeSymbolData(const CodeModule *module); + virtual void FreeSymbolData(const CodeModule* module); protected: - SymbolResult GetSymbolFileAtPathFromRoot(const CodeModule *module, - const SystemInfo *system_info, - const string &root_path, - string *symbol_file); + SymbolResult GetSymbolFileAtPathFromRoot(const CodeModule* module, + const SystemInfo* system_info, + const string& root_path, + string* symbol_file); private: - map<string, char *> memory_buffers_; + map<string, char*> memory_buffers_; vector<string> paths_; }; diff --git a/src/processor/source_line_resolver_base.cc b/src/processor/source_line_resolver_base.cc index 6eff1f99..45a06cf3 100644 --- a/src/processor/source_line_resolver_base.cc +++ b/src/processor/source_line_resolver_base.cc @@ -51,7 +51,7 @@ using std::make_pair; namespace google_breakpad { SourceLineResolverBase::SourceLineResolverBase( - ModuleFactory *module_factory) + ModuleFactory* module_factory) : modules_(new ModuleMap), corrupt_modules_(new ModuleSet), memory_buffers_(new MemoryMap), @@ -85,9 +85,9 @@ SourceLineResolverBase::~SourceLineResolverBase() { module_factory_ = NULL; } -bool SourceLineResolverBase::ReadSymbolFile(const string &map_file, - char **symbol_data, - size_t *symbol_data_size) { +bool SourceLineResolverBase::ReadSymbolFile(const string& map_file, + char** symbol_data, + size_t* symbol_data_size) { if (symbol_data == NULL || symbol_data_size == NULL) { BPLOG(ERROR) << "Could not Read file into Null memory pointer"; return false; @@ -117,7 +117,7 @@ bool SourceLineResolverBase::ReadSymbolFile(const string &map_file, BPLOG(INFO) << "Opening " << map_file; - FILE *f = fopen(map_file.c_str(), "rt"); + FILE* f = fopen(map_file.c_str(), "rt"); if (!f) { string error_string; error_code = ErrnoString(&error_string); @@ -148,8 +148,8 @@ bool SourceLineResolverBase::ReadSymbolFile(const string &map_file, return true; } -bool SourceLineResolverBase::LoadModule(const CodeModule *module, - const string &map_file) { +bool SourceLineResolverBase::LoadModule(const CodeModule* module, + const string& map_file) { if (module == NULL) return false; @@ -163,7 +163,7 @@ bool SourceLineResolverBase::LoadModule(const CodeModule *module, BPLOG(INFO) << "Loading symbols for module " << module->code_file() << " from " << map_file; - char *memory_buffer; + char* memory_buffer; size_t memory_buffer_size; if (!ReadSymbolFile(map_file, &memory_buffer, &memory_buffer_size)) return false; @@ -184,7 +184,7 @@ bool SourceLineResolverBase::LoadModule(const CodeModule *module, } bool SourceLineResolverBase::LoadModuleUsingMapBuffer( - const CodeModule *module, const string &map_buffer) { + const CodeModule* module, const string& map_buffer) { if (module == NULL) return false; @@ -196,7 +196,7 @@ bool SourceLineResolverBase::LoadModuleUsingMapBuffer( } size_t memory_buffer_size = map_buffer.size() + 1; - char *memory_buffer = new char[memory_buffer_size]; + char* memory_buffer = new char[memory_buffer_size]; if (memory_buffer == NULL) { BPLOG(ERROR) << "Could not allocate memory for " << module->code_file(); return false; @@ -220,8 +220,8 @@ bool SourceLineResolverBase::LoadModuleUsingMapBuffer( } bool SourceLineResolverBase::LoadModuleUsingMemoryBuffer( - const CodeModule *module, - char *memory_buffer, + const CodeModule* module, + char* memory_buffer, size_t memory_buffer_size) { if (!module) return false; @@ -236,7 +236,7 @@ bool SourceLineResolverBase::LoadModuleUsingMemoryBuffer( BPLOG(INFO) << "Loading symbols for module " << module->code_file() << " from memory buffer"; - Module *basic_module = module_factory_->CreateModule(module->code_file()); + Module* basic_module = module_factory_->CreateModule(module->code_file()); // Ownership of memory is NOT transfered to Module::LoadMapFromMemory(). if (!basic_module->LoadMapFromMemory(memory_buffer, memory_buffer_size)) { @@ -259,13 +259,13 @@ bool SourceLineResolverBase::ShouldDeleteMemoryBufferAfterLoadModule() { return true; } -void SourceLineResolverBase::UnloadModule(const CodeModule *code_module) { +void SourceLineResolverBase::UnloadModule(const CodeModule* code_module) { if (!code_module) return; ModuleMap::iterator mod_iter = modules_->find(code_module->code_file()); if (mod_iter != modules_->end()) { - Module *symbol_module = mod_iter->second; + Module* symbol_module = mod_iter->second; delete symbol_module; corrupt_modules_->erase(mod_iter->first); modules_->erase(mod_iter); @@ -283,19 +283,19 @@ void SourceLineResolverBase::UnloadModule(const CodeModule *code_module) { } } -bool SourceLineResolverBase::HasModule(const CodeModule *module) { +bool SourceLineResolverBase::HasModule(const CodeModule* module) { if (!module) return false; return modules_->find(module->code_file()) != modules_->end(); } -bool SourceLineResolverBase::IsModuleCorrupt(const CodeModule *module) { +bool SourceLineResolverBase::IsModuleCorrupt(const CodeModule* module) { if (!module) return false; return corrupt_modules_->find(module->code_file()) != corrupt_modules_->end(); } -void SourceLineResolverBase::FillSourceLineInfo(StackFrame *frame) { +void SourceLineResolverBase::FillSourceLineInfo(StackFrame* frame) { if (frame->module) { ModuleMap::const_iterator it = modules_->find(frame->module->code_file()); if (it != modules_->end()) { @@ -304,8 +304,8 @@ void SourceLineResolverBase::FillSourceLineInfo(StackFrame *frame) { } } -WindowsFrameInfo *SourceLineResolverBase::FindWindowsFrameInfo( - const StackFrame *frame) { +WindowsFrameInfo* SourceLineResolverBase::FindWindowsFrameInfo( + const StackFrame* frame) { if (frame->module) { ModuleMap::const_iterator it = modules_->find(frame->module->code_file()); if (it != modules_->end()) { @@ -315,8 +315,8 @@ WindowsFrameInfo *SourceLineResolverBase::FindWindowsFrameInfo( return NULL; } -CFIFrameInfo *SourceLineResolverBase::FindCFIFrameInfo( - const StackFrame *frame) { +CFIFrameInfo* SourceLineResolverBase::FindCFIFrameInfo( + const StackFrame* frame) { if (frame->module) { ModuleMap::const_iterator it = modules_->find(frame->module->code_file()); if (it != modules_->end()) { @@ -327,12 +327,12 @@ CFIFrameInfo *SourceLineResolverBase::FindCFIFrameInfo( } bool SourceLineResolverBase::CompareString::operator()( - const string &s1, const string &s2) const { + const string& s1, const string& s2) const { return strcmp(s1.c_str(), s2.c_str()) < 0; } bool SourceLineResolverBase::Module::ParseCFIRuleSet( - const string &rule_set, CFIFrameInfo *frame_info) const { + const string& rule_set, CFIFrameInfo* frame_info) const { CFIFrameInfoParseHandler handler(frame_info); CFIRuleParser parser(&handler); return parser.Parse(rule_set); diff --git a/src/processor/source_line_resolver_base_types.h b/src/processor/source_line_resolver_base_types.h index ca744e00..db9f7b8e 100644 --- a/src/processor/source_line_resolver_base_types.h +++ b/src/processor/source_line_resolver_base_types.h @@ -56,14 +56,14 @@ namespace google_breakpad { class SourceLineResolverBase::AutoFileCloser { public: - explicit AutoFileCloser(FILE *file) : file_(file) {} + explicit AutoFileCloser(FILE* file) : file_(file) {} ~AutoFileCloser() { if (file_) fclose(file_); } private: - FILE *file_; + FILE* file_; }; struct SourceLineResolverBase::Line { @@ -82,7 +82,7 @@ struct SourceLineResolverBase::Line { struct SourceLineResolverBase::Function { Function() { } - Function(const string &function_name, + Function(const string& function_name, MemAddr function_address, MemAddr code_size, int set_parameter_size, @@ -133,7 +133,7 @@ class SourceLineResolverBase::Module { // The passed in |memory buffer| is of size |memory_buffer_size|. If it is // not null terminated, LoadMapFromMemory will null terminate it by modifying // the passed in buffer. - virtual bool LoadMapFromMemory(char *memory_buffer, + virtual bool LoadMapFromMemory(char* memory_buffer, size_t memory_buffer_size) = 0; // Tells whether the loaded symbol data is corrupt. Return value is @@ -142,24 +142,24 @@ class SourceLineResolverBase::Module { // Looks up the given relative address, and fills the StackFrame struct // with the result. - virtual void LookupAddress(StackFrame *frame) const = 0; + virtual void LookupAddress(StackFrame* frame) const = 0; // If Windows stack walking information is available covering ADDRESS, // return a WindowsFrameInfo structure describing it. If the information // is not available, returns NULL. A NULL return value does not indicate // an error. The caller takes ownership of any returned WindowsFrameInfo // object. - virtual WindowsFrameInfo * - FindWindowsFrameInfo(const StackFrame *frame) const = 0; + virtual WindowsFrameInfo* + FindWindowsFrameInfo(const StackFrame* frame) const = 0; // If CFI stack walking information is available covering ADDRESS, // return a CFIFrameInfo structure describing it. If the information // is not available, return NULL. The caller takes ownership of any // returned CFIFrameInfo object. - virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame) const = 0; + virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame) const = 0; protected: - virtual bool ParseCFIRuleSet(const string &rule_set, - CFIFrameInfo *frame_info) const; + virtual bool ParseCFIRuleSet(const string& rule_set, + CFIFrameInfo* frame_info) const; }; } // namespace google_breakpad diff --git a/src/processor/stackwalk_common.cc b/src/processor/stackwalk_common.cc index 704039f3..90475720 100644 --- a/src/processor/stackwalk_common.cc +++ b/src/processor/stackwalk_common.cc @@ -69,7 +69,7 @@ static const char kOutputSeparator = '|'; // of registers is completely printed, regardless of the number of calls // to PrintRegister. static const int kMaxWidth = 80; // optimize for an 80-column terminal -static int PrintRegister(const char *name, uint32_t value, int start_col) { +static int PrintRegister(const char* name, uint32_t value, int start_col) { char buffer[64]; snprintf(buffer, sizeof(buffer), " %5s = 0x%08x", name, value); @@ -83,7 +83,7 @@ static int PrintRegister(const char *name, uint32_t value, int start_col) { } // PrintRegister64 does the same thing, but for 64-bit registers. -static int PrintRegister64(const char *name, uint64_t value, int start_col) { +static int PrintRegister64(const char* name, uint64_t value, int start_col) { char buffer[64]; snprintf(buffer, sizeof(buffer), " %5s = 0x%016" PRIx64 , name, value); @@ -98,7 +98,7 @@ static int PrintRegister64(const char *name, uint64_t value, int start_col) { // StripSeparator takes a string |original| and returns a copy // of the string with all occurences of |kOutputSeparator| removed. -static string StripSeparator(const string &original) { +static string StripSeparator(const string& original) { string result = original; string::size_type position = 0; while ((position = result.find(kOutputSeparator, position)) != string::npos) { @@ -112,20 +112,20 @@ static string StripSeparator(const string &original) { } // PrintStackContents prints the stack contents of the current frame to stdout. -static void PrintStackContents(const string &indent, - const StackFrame *frame, - const StackFrame *prev_frame, - const string &cpu, - const MemoryRegion *memory, +static void PrintStackContents(const string& indent, + const StackFrame* frame, + const StackFrame* prev_frame, + const string& cpu, + const MemoryRegion* memory, const CodeModules* modules, - SourceLineResolverInterface *resolver) { + SourceLineResolverInterface* resolver) { // Find stack range. int word_length = 0; uint64_t stack_begin = 0, stack_end = 0; if (cpu == "x86") { word_length = 4; - const StackFrameX86 *frame_x86 = static_cast<const StackFrameX86*>(frame); - const StackFrameX86 *prev_frame_x86 = + const StackFrameX86* frame_x86 = static_cast<const StackFrameX86*>(frame); + const StackFrameX86* prev_frame_x86 = static_cast<const StackFrameX86*>(prev_frame); if ((frame_x86->context_validity & StackFrameX86::CONTEXT_VALID_ESP) && (prev_frame_x86->context_validity & StackFrameX86::CONTEXT_VALID_ESP)) { @@ -134,9 +134,9 @@ static void PrintStackContents(const string &indent, } } else if (cpu == "amd64") { word_length = 8; - const StackFrameAMD64 *frame_amd64 = + const StackFrameAMD64* frame_amd64 = static_cast<const StackFrameAMD64*>(frame); - const StackFrameAMD64 *prev_frame_amd64 = + const StackFrameAMD64* prev_frame_amd64 = static_cast<const StackFrameAMD64*>(prev_frame); if ((frame_amd64->context_validity & StackFrameAMD64::CONTEXT_VALID_RSP) && (prev_frame_amd64->context_validity & @@ -146,8 +146,8 @@ static void PrintStackContents(const string &indent, } } else if (cpu == "arm") { word_length = 4; - const StackFrameARM *frame_arm = static_cast<const StackFrameARM*>(frame); - const StackFrameARM *prev_frame_arm = + const StackFrameARM* frame_arm = static_cast<const StackFrameARM*>(frame); + const StackFrameARM* prev_frame_arm = static_cast<const StackFrameARM*>(prev_frame); if ((frame_arm->context_validity & StackFrameARM::CONTEXT_VALID_SP) && (prev_frame_arm->context_validity & StackFrameARM::CONTEXT_VALID_SP)) { @@ -156,9 +156,9 @@ static void PrintStackContents(const string &indent, } } else if (cpu == "arm64") { word_length = 8; - const StackFrameARM64 *frame_arm64 = + const StackFrameARM64* frame_arm64 = static_cast<const StackFrameARM64*>(frame); - const StackFrameARM64 *prev_frame_arm64 = + const StackFrameARM64* prev_frame_arm64 = static_cast<const StackFrameARM64*>(prev_frame); if ((frame_arm64->context_validity & StackFrameARM64::CONTEXT_VALID_SP) && (prev_frame_arm64->context_validity & @@ -249,8 +249,8 @@ static void PrintStackContents(const string &indent, // // If |cpu| is a recognized CPU name, relevant register state for each stack // frame printed is also output, if available. -static void PrintStack(const CallStack *stack, - const string &cpu, +static void PrintStack(const CallStack* stack, + const string& cpu, bool output_stack_contents, const MemoryRegion* memory, const CodeModules* modules, @@ -260,7 +260,7 @@ static void PrintStack(const CallStack *stack, printf(" <no frames>\n"); } for (int frame_index = 0; frame_index < frame_count; ++frame_index) { - const StackFrame *frame = stack->frames()->at(frame_index); + const StackFrame* frame = stack->frames()->at(frame_index); printf("%2d ", frame_index); uint64_t instruction_address = frame->ReturnAddress(); @@ -289,7 +289,7 @@ static void PrintStack(const CallStack *stack, int sequence = 0; if (cpu == "x86") { - const StackFrameX86 *frame_x86 = + const StackFrameX86* frame_x86 = reinterpret_cast<const StackFrameX86*>(frame); if (frame_x86->context_validity & StackFrameX86::CONTEXT_VALID_EIP) @@ -311,7 +311,7 @@ static void PrintStack(const CallStack *stack, sequence = PrintRegister("efl", frame_x86->context.eflags, sequence); } } else if (cpu == "ppc") { - const StackFramePPC *frame_ppc = + const StackFramePPC* frame_ppc = reinterpret_cast<const StackFramePPC*>(frame); if (frame_ppc->context_validity & StackFramePPC::CONTEXT_VALID_SRR0) @@ -319,7 +319,7 @@ static void PrintStack(const CallStack *stack, if (frame_ppc->context_validity & StackFramePPC::CONTEXT_VALID_GPR1) sequence = PrintRegister("r1", frame_ppc->context.gpr[1], sequence); } else if (cpu == "amd64") { - const StackFrameAMD64 *frame_amd64 = + const StackFrameAMD64* frame_amd64 = reinterpret_cast<const StackFrameAMD64*>(frame); if (frame_amd64->context_validity & StackFrameAMD64::CONTEXT_VALID_RAX) @@ -357,7 +357,7 @@ static void PrintStack(const CallStack *stack, if (frame_amd64->context_validity & StackFrameAMD64::CONTEXT_VALID_RIP) sequence = PrintRegister64("rip", frame_amd64->context.rip, sequence); } else if (cpu == "sparc") { - const StackFrameSPARC *frame_sparc = + const StackFrameSPARC* frame_sparc = reinterpret_cast<const StackFrameSPARC*>(frame); if (frame_sparc->context_validity & StackFrameSPARC::CONTEXT_VALID_SP) @@ -367,7 +367,7 @@ static void PrintStack(const CallStack *stack, if (frame_sparc->context_validity & StackFrameSPARC::CONTEXT_VALID_PC) sequence = PrintRegister("pc", frame_sparc->context.pc, sequence); } else if (cpu == "arm") { - const StackFrameARM *frame_arm = + const StackFrameARM* frame_arm = reinterpret_cast<const StackFrameARM*>(frame); // Argument registers (caller-saves), which will likely only be valid @@ -409,7 +409,7 @@ static void PrintStack(const CallStack *stack, if (frame_arm->context_validity & StackFrameARM::CONTEXT_VALID_PC) sequence = PrintRegister("pc", frame_arm->context.iregs[15], sequence); } else if (cpu == "arm64") { - const StackFrameARM64 *frame_arm64 = + const StackFrameARM64* frame_arm64 = reinterpret_cast<const StackFrameARM64*>(frame); if (frame_arm64->context_validity & StackFrameARM64::CONTEXT_VALID_X0) { @@ -621,10 +621,10 @@ static void PrintStack(const CallStack *stack, // Module, function, source file, and source line may all be empty // depending on availability. The code offset follows the same rules as // PrintStack above. -static void PrintStackMachineReadable(int thread_num, const CallStack *stack) { +static void PrintStackMachineReadable(int thread_num, const CallStack* stack) { int frame_count = stack->frames()->size(); for (int frame_index = 0; frame_index < frame_count; ++frame_index) { - const StackFrame *frame = stack->frames()->at(frame_index); + const StackFrame* frame = stack->frames()->at(frame_index); printf("%d%c%d%c", thread_num, kOutputSeparator, frame_index, kOutputSeparator); @@ -676,8 +676,8 @@ static void PrintStackMachineReadable(int thread_num, const CallStack *stack) { // ContainsModule checks whether a given |module| is in the vector // |modules_without_symbols|. static bool ContainsModule( - const vector<const CodeModule*> *modules, - const CodeModule *module) { + const vector<const CodeModule*>* modules, + const CodeModule* module) { assert(modules); assert(module); vector<const CodeModule*>::const_iterator iter; @@ -694,9 +694,9 @@ static bool ContainsModule( // |modules_without_symbols| should contain the list of modules that were // confirmed to be missing their symbols during the stack walk. static void PrintModule( - const CodeModule *module, - const vector<const CodeModule*> *modules_without_symbols, - const vector<const CodeModule*> *modules_with_corrupt_symbols, + const CodeModule* module, + const vector<const CodeModule*>* modules_without_symbols, + const vector<const CodeModule*>* modules_with_corrupt_symbols, uint64_t main_address) { string symbol_issues; if (ContainsModule(modules_without_symbols, module)) { @@ -721,9 +721,9 @@ static void PrintModule( // |modules_without_symbols| should contain the list of modules that were // confirmed to be missing their symbols during the stack walk. static void PrintModules( - const CodeModules *modules, - const vector<const CodeModule*> *modules_without_symbols, - const vector<const CodeModule*> *modules_with_corrupt_symbols) { + const CodeModules* modules, + const vector<const CodeModule*>* modules_without_symbols, + const vector<const CodeModule*>* modules_with_corrupt_symbols) { if (!modules) return; @@ -731,7 +731,7 @@ static void PrintModules( printf("Loaded modules:\n"); uint64_t main_address = 0; - const CodeModule *main_module = modules->GetMainModule(); + const CodeModule* main_module = modules->GetMainModule(); if (main_module) { main_address = main_module->base_address(); } @@ -740,7 +740,7 @@ static void PrintModules( for (unsigned int module_sequence = 0; module_sequence < module_count; ++module_sequence) { - const CodeModule *module = modules->GetModuleAtSequence(module_sequence); + const CodeModule* module = modules->GetModuleAtSequence(module_sequence); PrintModule(module, modules_without_symbols, modules_with_corrupt_symbols, main_address); } @@ -751,12 +751,12 @@ static void PrintModules( // text format: // Module|{Module Filename}|{Version}|{Debug Filename}|{Debug Identifier}| // {Base Address}|{Max Address}|{Main} -static void PrintModulesMachineReadable(const CodeModules *modules) { +static void PrintModulesMachineReadable(const CodeModules* modules) { if (!modules) return; uint64_t main_address = 0; - const CodeModule *main_module = modules->GetMainModule(); + const CodeModule* main_module = modules->GetMainModule(); if (main_module) { main_address = main_module->base_address(); } @@ -765,7 +765,7 @@ static void PrintModulesMachineReadable(const CodeModules *modules) { for (unsigned int module_sequence = 0; module_sequence < module_count; ++module_sequence) { - const CodeModule *module = modules->GetModuleAtSequence(module_sequence); + const CodeModule* module = modules->GetModuleAtSequence(module_sequence); uint64_t base_address = module->base_address(); printf("Module%c%s%c%s%c%s%c%s%c0x%08" PRIx64 "%c0x%08" PRIx64 "%c%d\n", kOutputSeparator, diff --git a/src/processor/stackwalker_address_list_unittest.cc b/src/processor/stackwalker_address_list_unittest.cc index ab4e9c08..b09137de 100644 --- a/src/processor/stackwalker_address_list_unittest.cc +++ b/src/processor/stackwalker_address_list_unittest.cc @@ -94,9 +94,9 @@ class StackwalkerAddressListTest : public testing::Test { // Set the Breakpad symbol information that supplier should return for // MODULE to INFO. - void SetModuleSymbols(MockCodeModule *module, const string &info) { + void SetModuleSymbols(MockCodeModule* module, const string& info) { size_t buffer_size; - char *buffer = supplier.CopySymbolDataAndOwnTheCopy(info, &buffer_size); + char* buffer = supplier.CopySymbolDataAndOwnTheCopy(info, &buffer_size); EXPECT_CALL(supplier, GetCStringSymbolData(module, NULL, _, _, _)) .WillRepeatedly(DoAll(SetArgumentPointee<3>(buffer), SetArgumentPointee<4>(buffer_size), diff --git a/src/processor/stackwalker_amd64.cc b/src/processor/stackwalker_amd64.cc index d5ac6c65..f906f20b 100644 --- a/src/processor/stackwalker_amd64.cc +++ b/src/processor/stackwalker_amd64.cc @@ -126,7 +126,7 @@ StackFrame* StackwalkerAMD64::GetContextFrame() { } StackFrameAMD64* StackwalkerAMD64::GetCallerByCFIFrameInfo( - const vector<StackFrame*> &frames, + const vector<StackFrame*>& frames, CFIFrameInfo* cfi_frame_info) { StackFrameAMD64* last_frame = static_cast<StackFrameAMD64*>(frames.back()); @@ -217,7 +217,7 @@ StackFrameAMD64* StackwalkerAMD64::GetCallerByFramePointerRecovery( } StackFrameAMD64* StackwalkerAMD64::GetCallerByStackScan( - const vector<StackFrame*> &frames) { + const vector<StackFrame*>& frames) { StackFrameAMD64* last_frame = static_cast<StackFrameAMD64*>(frames.back()); uint64_t last_rsp = last_frame->context.rsp; uint64_t caller_rip_address, caller_rip; @@ -273,7 +273,7 @@ StackFrame* StackwalkerAMD64::GetCallerFrame(const CallStack* stack, return NULL; } - const vector<StackFrame*> &frames = *stack->frames(); + const vector<StackFrame*>& frames = *stack->frames(); StackFrameAMD64* last_frame = static_cast<StackFrameAMD64*>(frames.back()); scoped_ptr<StackFrameAMD64> new_frame; diff --git a/src/processor/stackwalker_amd64.h b/src/processor/stackwalker_amd64.h index 8f3dbd52..5e1af6f1 100644 --- a/src/processor/stackwalker_amd64.h +++ b/src/processor/stackwalker_amd64.h @@ -75,7 +75,7 @@ class StackwalkerAMD64 : public Stackwalker { // Use cfi_frame_info (derived from STACK CFI records) to construct // the frame that called frames.back(). The caller takes ownership // of the returned frame. Return NULL on failure. - StackFrameAMD64* GetCallerByCFIFrameInfo(const vector<StackFrame*> &frames, + StackFrameAMD64* GetCallerByCFIFrameInfo(const vector<StackFrame*>& frames, CFIFrameInfo* cfi_frame_info); // Assumes a traditional frame layout where the frame pointer has not been @@ -88,7 +88,7 @@ class StackwalkerAMD64 : public Stackwalker { // Scan the stack for plausible return addresses. The caller takes ownership // of the returned frame. Return NULL on failure. - StackFrameAMD64* GetCallerByStackScan(const vector<StackFrame*> &frames); + StackFrameAMD64* GetCallerByStackScan(const vector<StackFrame*>& frames); // Stores the CPU context corresponding to the innermost stack frame to // be returned by GetContextFrame. diff --git a/src/processor/stackwalker_amd64_unittest.cc b/src/processor/stackwalker_amd64_unittest.cc index efcd812a..a77015a6 100644 --- a/src/processor/stackwalker_amd64_unittest.cc +++ b/src/processor/stackwalker_amd64_unittest.cc @@ -104,7 +104,7 @@ class StackwalkerAMD64Fixture { // Set the Breakpad symbol information that supplier should return for // MODULE to INFO. - void SetModuleSymbols(MockCodeModule *module, const string &info) { + void SetModuleSymbols(MockCodeModule* module, const string& info) { size_t buffer_size; char *buffer = supplier.CopySymbolDataAndOwnTheCopy(info, &buffer_size); EXPECT_CALL(supplier, GetCStringSymbolData(module, &system_info, _, _, _)) @@ -125,7 +125,7 @@ class StackwalkerAMD64Fixture { void BrandContext(MDRawContextAMD64 *raw_context) { uint8_t x = 173; for (size_t i = 0; i < sizeof(*raw_context); i++) - reinterpret_cast<uint8_t *>(raw_context)[i] = (x += 17); + reinterpret_cast<uint8_t*>(raw_context)[i] = (x += 17); } SystemInfo system_info; @@ -138,7 +138,7 @@ class StackwalkerAMD64Fixture { MockSymbolSupplier supplier; BasicSourceLineResolver resolver; CallStack call_stack; - const vector<StackFrame *> *frames; + const vector<StackFrame*>* frames; }; class GetContextFrame: public StackwalkerAMD64Fixture, public Test { }; @@ -166,7 +166,7 @@ TEST_F(SanityCheck, NoResolver) { ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); frames = call_stack.frames(); ASSERT_GE(1U, frames->size()); - StackFrameAMD64 *frame = static_cast<StackFrameAMD64 *>(frames->at(0)); + StackFrameAMD64 *frame = static_cast<StackFrameAMD64*>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); @@ -192,7 +192,7 @@ TEST_F(GetContextFrame, Simple) { ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); frames = call_stack.frames(); ASSERT_GE(1U, frames->size()); - StackFrameAMD64 *frame = static_cast<StackFrameAMD64 *>(frames->at(0)); + StackFrameAMD64 *frame = static_cast<StackFrameAMD64*>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); @@ -216,7 +216,7 @@ TEST_F(GetContextFrame, NoStackMemory) { ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); frames = call_stack.frames(); ASSERT_GE(1U, frames->size()); - StackFrameAMD64 *frame = static_cast<StackFrameAMD64 *>(frames->at(0)); + StackFrameAMD64 *frame = static_cast<StackFrameAMD64*>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); @@ -279,12 +279,12 @@ TEST_F(GetCallerFrame, ScanWithoutSymbols) { frames = call_stack.frames(); ASSERT_EQ(3U, frames->size()); - StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64 *>(frames->at(0)); + StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameAMD64::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); - StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64 *>(frames->at(1)); + StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP | StackFrameAMD64::CONTEXT_VALID_RSP | @@ -294,7 +294,7 @@ TEST_F(GetCallerFrame, ScanWithoutSymbols) { EXPECT_EQ(frame1_sp.Value(), frame1->context.rsp); EXPECT_EQ(frame1_rbp.Value(), frame1->context.rbp); - StackFrameAMD64 *frame2 = static_cast<StackFrameAMD64 *>(frames->at(2)); + StackFrameAMD64 *frame2 = static_cast<StackFrameAMD64*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame2->trust); ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP | StackFrameAMD64::CONTEXT_VALID_RSP), @@ -352,13 +352,13 @@ TEST_F(GetCallerFrame, ScanWithFunctionSymbols) { frames = call_stack.frames(); ASSERT_EQ(2U, frames->size()); - StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64 *>(frames->at(0)); + StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameAMD64::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ("platypus", frame0->function_name); EXPECT_EQ(0x00007400c0000100ULL, frame0->function_base); - StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64 *>(frames->at(1)); + StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP | StackFrameAMD64::CONTEXT_VALID_RSP | @@ -464,7 +464,7 @@ TEST_F(GetCallerFrame, GetCallerByFramePointerRecovery) { ASSERT_EQ(3U, frames->size()); { // To avoid reusing locals by mistake - StackFrameAMD64 *frame = static_cast<StackFrameAMD64 *>(frames->at(0)); + StackFrameAMD64 *frame = static_cast<StackFrameAMD64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame->trust); ASSERT_EQ(StackFrameAMD64::CONTEXT_VALID_ALL, frame->context_validity); EXPECT_EQ("", frame->function_name); @@ -475,7 +475,7 @@ TEST_F(GetCallerFrame, GetCallerByFramePointerRecovery) { } { // To avoid reusing locals by mistake - StackFrameAMD64 *frame = static_cast<StackFrameAMD64 *>(frames->at(1)); + StackFrameAMD64 *frame = static_cast<StackFrameAMD64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame->trust); ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP | StackFrameAMD64::CONTEXT_VALID_RSP | @@ -489,7 +489,7 @@ TEST_F(GetCallerFrame, GetCallerByFramePointerRecovery) { } { // To avoid reusing locals by mistake - StackFrameAMD64 *frame = static_cast<StackFrameAMD64 *>(frames->at(2)); + StackFrameAMD64 *frame = static_cast<StackFrameAMD64*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame->trust); ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP | StackFrameAMD64::CONTEXT_VALID_RSP | @@ -540,12 +540,12 @@ TEST_F(GetCallerFrame, FramePointerNotAligned) { frames = call_stack.frames(); ASSERT_EQ(2U, frames->size()); - StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64 *>(frames->at(0)); + StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameAMD64::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); - StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64 *>(frames->at(1)); + StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP | StackFrameAMD64::CONTEXT_VALID_RSP), @@ -590,12 +590,12 @@ TEST_F(GetCallerFrame, NonCanonicalInstructionPointerFromFramePointer) { frames = call_stack.frames(); ASSERT_EQ(2U, frames->size()); - StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64 *>(frames->at(0)); + StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameAMD64::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); - StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64 *>(frames->at(1)); + StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP | StackFrameAMD64::CONTEXT_VALID_RSP), @@ -660,7 +660,7 @@ TEST_F(GetCallerFrame, ScanningNotAllowed) { frames = call_stack.frames(); ASSERT_EQ(1U, frames->size()); - StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64 *>(frames->at(0)); + StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameAMD64::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); @@ -718,14 +718,14 @@ TEST_F(GetCallerFrame, CallerPushedRBP) { frames = call_stack.frames(); ASSERT_EQ(2U, frames->size()); - StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64 *>(frames->at(0)); + StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameAMD64::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(frame0_rbp.Value(), frame0->context.rbp); EXPECT_EQ("sasquatch", frame0->function_name); EXPECT_EQ(0x00007400c0000100ULL, frame0->function_base); - StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64 *>(frames->at(1)); + StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_FP, frame1->trust); ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP | StackFrameAMD64::CONTEXT_VALID_RSP | @@ -799,13 +799,13 @@ struct CFIFixture: public StackwalkerAMD64Fixture { frames = call_stack.frames(); ASSERT_EQ(2U, frames->size()); - StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64 *>(frames->at(0)); + StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameAMD64::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ("enchiridion", frame0->function_name); EXPECT_EQ(0x00007400c0004000ULL, frame0->function_base); - StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64 *>(frames->at(1)); + StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame1->trust); ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP | StackFrameAMD64::CONTEXT_VALID_RSP | diff --git a/src/processor/stackwalker_arm.cc b/src/processor/stackwalker_arm.cc index 1313416f..f6f2c9bf 100644 --- a/src/processor/stackwalker_arm.cc +++ b/src/processor/stackwalker_arm.cc @@ -78,7 +78,7 @@ StackFrame* StackwalkerARM::GetContextFrame() { } StackFrameARM* StackwalkerARM::GetCallerByCFIFrameInfo( - const vector<StackFrame*> &frames, + const vector<StackFrame*>& frames, CFIFrameInfo* cfi_frame_info) { StackFrameARM* last_frame = static_cast<StackFrameARM*>(frames.back()); @@ -162,7 +162,7 @@ StackFrameARM* StackwalkerARM::GetCallerByCFIFrameInfo( } StackFrameARM* StackwalkerARM::GetCallerByStackScan( - const vector<StackFrame*> &frames) { + const vector<StackFrame*>& frames) { StackFrameARM* last_frame = static_cast<StackFrameARM*>(frames.back()); uint32_t last_sp = last_frame->context.iregs[MD_CONTEXT_ARM_REG_SP]; uint32_t caller_sp, caller_pc; @@ -193,7 +193,7 @@ StackFrameARM* StackwalkerARM::GetCallerByStackScan( } StackFrameARM* StackwalkerARM::GetCallerByFramePointer( - const vector<StackFrame*> &frames) { + const vector<StackFrame*>& frames) { StackFrameARM* last_frame = static_cast<StackFrameARM*>(frames.back()); if (!(last_frame->context_validity & @@ -245,7 +245,7 @@ StackFrame* StackwalkerARM::GetCallerFrame(const CallStack* stack, return NULL; } - const vector<StackFrame*> &frames = *stack->frames(); + const vector<StackFrame*>& frames = *stack->frames(); StackFrameARM* last_frame = static_cast<StackFrameARM*>(frames.back()); scoped_ptr<StackFrameARM> frame; diff --git a/src/processor/stackwalker_arm.h b/src/processor/stackwalker_arm.h index 9081a40c..72ddddcc 100644 --- a/src/processor/stackwalker_arm.h +++ b/src/processor/stackwalker_arm.h @@ -75,16 +75,16 @@ class StackwalkerARM : public Stackwalker { // Use cfi_frame_info (derived from STACK CFI records) to construct // the frame that called frames.back(). The caller takes ownership // of the returned frame. Return NULL on failure. - StackFrameARM* GetCallerByCFIFrameInfo(const vector<StackFrame*> &frames, + StackFrameARM* GetCallerByCFIFrameInfo(const vector<StackFrame*>& frames, CFIFrameInfo* cfi_frame_info); // Use the frame pointer. The caller takes ownership of the returned frame. // Return NULL on failure. - StackFrameARM* GetCallerByFramePointer(const vector<StackFrame*> &frames); + StackFrameARM* GetCallerByFramePointer(const vector<StackFrame*>& frames); // Scan the stack for plausible return addresses. The caller takes ownership // of the returned frame. Return NULL on failure. - StackFrameARM* GetCallerByStackScan(const vector<StackFrame*> &frames); + StackFrameARM* GetCallerByStackScan(const vector<StackFrame*>& frames); // Stores the CPU context corresponding to the youngest stack frame, to // be returned by GetContextFrame. diff --git a/src/processor/stackwalker_arm64.cc b/src/processor/stackwalker_arm64.cc index 5bfd2636..9acf8188 100644 --- a/src/processor/stackwalker_arm64.cc +++ b/src/processor/stackwalker_arm64.cc @@ -99,7 +99,7 @@ StackFrame* StackwalkerARM64::GetContextFrame() { } StackFrameARM64* StackwalkerARM64::GetCallerByCFIFrameInfo( - const vector<StackFrame*> &frames, + const vector<StackFrame*>& frames, CFIFrameInfo* cfi_frame_info) { StackFrameARM64* last_frame = static_cast<StackFrameARM64*>(frames.back()); @@ -175,7 +175,7 @@ StackFrameARM64* StackwalkerARM64::GetCallerByCFIFrameInfo( } StackFrameARM64* StackwalkerARM64::GetCallerByStackScan( - const vector<StackFrame*> &frames) { + const vector<StackFrame*>& frames) { StackFrameARM64* last_frame = static_cast<StackFrameARM64*>(frames.back()); uint64_t last_sp = last_frame->context.iregs[MD_CONTEXT_ARM64_REG_SP]; uint64_t caller_sp, caller_pc; @@ -206,7 +206,7 @@ StackFrameARM64* StackwalkerARM64::GetCallerByStackScan( } StackFrameARM64* StackwalkerARM64::GetCallerByFramePointer( - const vector<StackFrame*> &frames) { + const vector<StackFrame*>& frames) { StackFrameARM64* last_frame = static_cast<StackFrameARM64*>(frames.back()); if (!(last_frame->context_validity & StackFrameARM64::CONTEXT_VALID_LR)) { CorrectRegLRByFramePointer(frames, last_frame); @@ -294,7 +294,7 @@ StackFrame* StackwalkerARM64::GetCallerFrame(const CallStack* stack, return NULL; } - const vector<StackFrame*> &frames = *stack->frames(); + const vector<StackFrame*>& frames = *stack->frames(); StackFrameARM64* last_frame = static_cast<StackFrameARM64*>(frames.back()); scoped_ptr<StackFrameARM64> frame; diff --git a/src/processor/stackwalker_arm64.h b/src/processor/stackwalker_arm64.h index 39735c67..4c7da3fb 100644 --- a/src/processor/stackwalker_arm64.h +++ b/src/processor/stackwalker_arm64.h @@ -79,16 +79,16 @@ class StackwalkerARM64 : public Stackwalker { // Use cfi_frame_info (derived from STACK CFI records) to construct // the frame that called frames.back(). The caller takes ownership // of the returned frame. Return NULL on failure. - StackFrameARM64* GetCallerByCFIFrameInfo(const vector<StackFrame*> &frames, + StackFrameARM64* GetCallerByCFIFrameInfo(const vector<StackFrame*>& frames, CFIFrameInfo* cfi_frame_info); // Use the frame pointer. The caller takes ownership of the returned frame. // Return NULL on failure. - StackFrameARM64* GetCallerByFramePointer(const vector<StackFrame*> &frames); + StackFrameARM64* GetCallerByFramePointer(const vector<StackFrame*>& frames); // Scan the stack for plausible return addresses. The caller takes ownership // of the returned frame. Return NULL on failure. - StackFrameARM64* GetCallerByStackScan(const vector<StackFrame*> &frames); + StackFrameARM64* GetCallerByStackScan(const vector<StackFrame*>& frames); // GetCallerByFramePointer() depends on the previous frame having recovered // x30($LR) which may not have been done when using CFI. diff --git a/src/processor/stackwalker_arm64_unittest.cc b/src/processor/stackwalker_arm64_unittest.cc index d86fa127..6553e0cd 100644 --- a/src/processor/stackwalker_arm64_unittest.cc +++ b/src/processor/stackwalker_arm64_unittest.cc @@ -105,7 +105,7 @@ class StackwalkerARM64Fixture { // Set the Breakpad symbol information that supplier should return for // MODULE to INFO. - void SetModuleSymbols(MockCodeModule *module, const string &info) { + void SetModuleSymbols(MockCodeModule* module, const string& info) { size_t buffer_size; char *buffer = supplier.CopySymbolDataAndOwnTheCopy(info, &buffer_size); EXPECT_CALL(supplier, GetCStringSymbolData(module, &system_info, _, _, _)) @@ -126,7 +126,7 @@ class StackwalkerARM64Fixture { void BrandContext(MDRawContextARM64 *raw_context) { uint8_t x = 173; for (size_t i = 0; i < sizeof(*raw_context); i++) - reinterpret_cast<uint8_t *>(raw_context)[i] = (x += 17); + reinterpret_cast<uint8_t*>(raw_context)[i] = (x += 17); } SystemInfo system_info; @@ -139,7 +139,7 @@ class StackwalkerARM64Fixture { MockSymbolSupplier supplier; BasicSourceLineResolver resolver; CallStack call_stack; - const vector<StackFrame *> *frames; + const vector<StackFrame*>* frames; }; class SanityCheck: public StackwalkerARM64Fixture, public Test { }; @@ -159,7 +159,7 @@ TEST_F(SanityCheck, NoResolver) { ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); frames = call_stack.frames(); ASSERT_EQ(1U, frames->size()); - StackFrameARM64 *frame = static_cast<StackFrameARM64 *>(frames->at(0)); + StackFrameARM64 *frame = static_cast<StackFrameARM64*>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); @@ -181,7 +181,7 @@ TEST_F(GetContextFrame, NoStackMemory) { ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); frames = call_stack.frames(); ASSERT_EQ(1U, frames->size()); - StackFrameARM64 *frame = static_cast<StackFrameARM64 *>(frames->at(0)); + StackFrameARM64 *frame = static_cast<StackFrameARM64*>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); @@ -237,13 +237,13 @@ TEST_F(GetCallerFrame, ScanWithoutSymbols) { frames = call_stack.frames(); ASSERT_EQ(3U, frames->size()); - StackFrameARM64 *frame0 = static_cast<StackFrameARM64 *>(frames->at(0)); + StackFrameARM64 *frame0 = static_cast<StackFrameARM64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameARM64::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); - StackFrameARM64 *frame1 = static_cast<StackFrameARM64 *>(frames->at(1)); + StackFrameARM64 *frame1 = static_cast<StackFrameARM64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameARM64::CONTEXT_VALID_PC | StackFrameARM64::CONTEXT_VALID_SP), @@ -251,7 +251,7 @@ TEST_F(GetCallerFrame, ScanWithoutSymbols) { EXPECT_EQ(return_address1, frame1->context.iregs[MD_CONTEXT_ARM64_REG_PC]); EXPECT_EQ(frame1_sp.Value(), frame1->context.iregs[MD_CONTEXT_ARM64_REG_SP]); - StackFrameARM64 *frame2 = static_cast<StackFrameARM64 *>(frames->at(2)); + StackFrameARM64 *frame2 = static_cast<StackFrameARM64*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame2->trust); ASSERT_EQ((StackFrameARM64::CONTEXT_VALID_PC | StackFrameARM64::CONTEXT_VALID_SP), @@ -307,7 +307,7 @@ TEST_F(GetCallerFrame, ScanWithFunctionSymbols) { frames = call_stack.frames(); ASSERT_EQ(2U, frames->size()); - StackFrameARM64 *frame0 = static_cast<StackFrameARM64 *>(frames->at(0)); + StackFrameARM64 *frame0 = static_cast<StackFrameARM64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameARM64::CONTEXT_VALID_ALL, frame0->context_validity); @@ -315,7 +315,7 @@ TEST_F(GetCallerFrame, ScanWithFunctionSymbols) { EXPECT_EQ("monotreme", frame0->function_name); EXPECT_EQ(0x40000100ULL, frame0->function_base); - StackFrameARM64 *frame1 = static_cast<StackFrameARM64 *>(frames->at(1)); + StackFrameARM64 *frame1 = static_cast<StackFrameARM64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameARM64::CONTEXT_VALID_PC | StackFrameARM64::CONTEXT_VALID_SP), @@ -376,13 +376,13 @@ TEST_F(GetCallerFrame, ScanFirstFrame) { frames = call_stack.frames(); ASSERT_EQ(2U, frames->size()); - StackFrameARM64 *frame0 = static_cast<StackFrameARM64 *>(frames->at(0)); + StackFrameARM64 *frame0 = static_cast<StackFrameARM64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameARM64::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); - StackFrameARM64 *frame1 = static_cast<StackFrameARM64 *>(frames->at(1)); + StackFrameARM64 *frame1 = static_cast<StackFrameARM64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameARM64::CONTEXT_VALID_PC | StackFrameARM64::CONTEXT_VALID_SP), @@ -440,7 +440,7 @@ TEST_F(GetCallerFrame, ScanningNotAllowed) { frames = call_stack.frames(); ASSERT_EQ(1U, frames->size()); - StackFrameARM64 *frame0 = static_cast<StackFrameARM64 *>(frames->at(0)); + StackFrameARM64 *frame0 = static_cast<StackFrameARM64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameARM64::CONTEXT_VALID_ALL, frame0->context_validity); @@ -503,13 +503,13 @@ TEST_F(GetFramesByFramePointer, OnlyFramePointer) { frames = call_stack.frames(); ASSERT_EQ(3U, frames->size()); - StackFrameARM64 *frame0 = static_cast<StackFrameARM64 *>(frames->at(0)); + StackFrameARM64 *frame0 = static_cast<StackFrameARM64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameARM64::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); - StackFrameARM64 *frame1 = static_cast<StackFrameARM64 *>(frames->at(1)); + StackFrameARM64 *frame1 = static_cast<StackFrameARM64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_FP, frame1->trust); ASSERT_EQ((StackFrameARM64::CONTEXT_VALID_PC | StackFrameARM64::CONTEXT_VALID_LR | @@ -522,7 +522,7 @@ TEST_F(GetFramesByFramePointer, OnlyFramePointer) { EXPECT_EQ(frame2_fp.Value(), frame1->context.iregs[MD_CONTEXT_ARM64_REG_FP]); - StackFrameARM64 *frame2 = static_cast<StackFrameARM64 *>(frames->at(2)); + StackFrameARM64 *frame2 = static_cast<StackFrameARM64*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_FP, frame2->trust); ASSERT_EQ((StackFrameARM64::CONTEXT_VALID_PC | StackFrameARM64::CONTEXT_VALID_LR | @@ -642,13 +642,13 @@ struct CFIFixture: public StackwalkerARM64Fixture { frames = call_stack.frames(); ASSERT_EQ(2U, frames->size()); - StackFrameARM64 *frame0 = static_cast<StackFrameARM64 *>(frames->at(0)); + StackFrameARM64 *frame0 = static_cast<StackFrameARM64*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(context_frame_validity, frame0->context_validity); EXPECT_EQ("enchiridion", frame0->function_name); EXPECT_EQ(0x0000000040004000UL, frame0->function_base); - StackFrameARM64 *frame1 = static_cast<StackFrameARM64 *>(frames->at(1)); + StackFrameARM64 *frame1 = static_cast<StackFrameARM64*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame1->trust); ASSERT_EQ(expected_validity, frame1->context_validity); if (expected_validity & StackFrameARM64::CONTEXT_VALID_X1) diff --git a/src/processor/stackwalker_arm_unittest.cc b/src/processor/stackwalker_arm_unittest.cc index 256f7648..046081fa 100644 --- a/src/processor/stackwalker_arm_unittest.cc +++ b/src/processor/stackwalker_arm_unittest.cc @@ -106,7 +106,7 @@ class StackwalkerARMFixture { // Set the Breakpad symbol information that supplier should return for // MODULE to INFO. - void SetModuleSymbols(MockCodeModule *module, const string &info) { + void SetModuleSymbols(MockCodeModule* module, const string& info) { size_t buffer_size; char *buffer = supplier.CopySymbolDataAndOwnTheCopy(info, &buffer_size); EXPECT_CALL(supplier, GetCStringSymbolData(module, &system_info, _, _, _)) @@ -127,7 +127,7 @@ class StackwalkerARMFixture { void BrandContext(MDRawContextARM *raw_context) { uint8_t x = 173; for (size_t i = 0; i < sizeof(*raw_context); i++) - reinterpret_cast<uint8_t *>(raw_context)[i] = (x += 17); + reinterpret_cast<uint8_t*>(raw_context)[i] = (x += 17); } SystemInfo system_info; @@ -140,7 +140,7 @@ class StackwalkerARMFixture { MockSymbolSupplier supplier; BasicSourceLineResolver resolver; CallStack call_stack; - const vector<StackFrame *> *frames; + const vector<StackFrame*>* frames; }; class SanityCheck: public StackwalkerARMFixture, public Test { }; @@ -161,7 +161,7 @@ TEST_F(SanityCheck, NoResolver) { ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); frames = call_stack.frames(); ASSERT_EQ(1U, frames->size()); - StackFrameARM *frame = static_cast<StackFrameARM *>(frames->at(0)); + StackFrameARM *frame = static_cast<StackFrameARM*>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); @@ -184,7 +184,7 @@ TEST_F(GetContextFrame, Simple) { ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); frames = call_stack.frames(); ASSERT_EQ(1U, frames->size()); - StackFrameARM *frame = static_cast<StackFrameARM *>(frames->at(0)); + StackFrameARM *frame = static_cast<StackFrameARM*>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); @@ -204,7 +204,7 @@ TEST_F(GetContextFrame, NoStackMemory) { ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); frames = call_stack.frames(); ASSERT_EQ(1U, frames->size()); - StackFrameARM *frame = static_cast<StackFrameARM *>(frames->at(0)); + StackFrameARM *frame = static_cast<StackFrameARM*>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); @@ -260,12 +260,12 @@ TEST_F(GetCallerFrame, ScanWithoutSymbols) { frames = call_stack.frames(); ASSERT_EQ(3U, frames->size()); - StackFrameARM *frame0 = static_cast<StackFrameARM *>(frames->at(0)); + StackFrameARM *frame0 = static_cast<StackFrameARM*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameARM::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); - StackFrameARM *frame1 = static_cast<StackFrameARM *>(frames->at(1)); + StackFrameARM *frame1 = static_cast<StackFrameARM*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameARM::CONTEXT_VALID_PC | StackFrameARM::CONTEXT_VALID_SP), @@ -273,7 +273,7 @@ TEST_F(GetCallerFrame, ScanWithoutSymbols) { EXPECT_EQ(return_address1, frame1->context.iregs[MD_CONTEXT_ARM_REG_PC]); EXPECT_EQ(frame1_sp.Value(), frame1->context.iregs[MD_CONTEXT_ARM_REG_SP]); - StackFrameARM *frame2 = static_cast<StackFrameARM *>(frames->at(2)); + StackFrameARM *frame2 = static_cast<StackFrameARM*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame2->trust); ASSERT_EQ((StackFrameARM::CONTEXT_VALID_PC | StackFrameARM::CONTEXT_VALID_SP), @@ -329,14 +329,14 @@ TEST_F(GetCallerFrame, ScanWithFunctionSymbols) { frames = call_stack.frames(); ASSERT_EQ(2U, frames->size()); - StackFrameARM *frame0 = static_cast<StackFrameARM *>(frames->at(0)); + StackFrameARM *frame0 = static_cast<StackFrameARM*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameARM::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); EXPECT_EQ("monotreme", frame0->function_name); EXPECT_EQ(0x40000100U, frame0->function_base); - StackFrameARM *frame1 = static_cast<StackFrameARM *>(frames->at(1)); + StackFrameARM *frame1 = static_cast<StackFrameARM*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameARM::CONTEXT_VALID_PC | StackFrameARM::CONTEXT_VALID_SP), @@ -397,12 +397,12 @@ TEST_F(GetCallerFrame, ScanFirstFrame) { frames = call_stack.frames(); ASSERT_EQ(2U, frames->size()); - StackFrameARM *frame0 = static_cast<StackFrameARM *>(frames->at(0)); + StackFrameARM *frame0 = static_cast<StackFrameARM*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameARM::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); - StackFrameARM *frame1 = static_cast<StackFrameARM *>(frames->at(1)); + StackFrameARM *frame1 = static_cast<StackFrameARM*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameARM::CONTEXT_VALID_PC | StackFrameARM::CONTEXT_VALID_SP), @@ -460,7 +460,7 @@ TEST_F(GetCallerFrame, ScanningNotAllowed) { frames = call_stack.frames(); ASSERT_EQ(1U, frames->size()); - StackFrameARM *frame0 = static_cast<StackFrameARM *>(frames->at(0)); + StackFrameARM *frame0 = static_cast<StackFrameARM*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameARM::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); @@ -565,13 +565,13 @@ struct CFIFixture: public StackwalkerARMFixture { frames = call_stack.frames(); ASSERT_EQ(2U, frames->size()); - StackFrameARM *frame0 = static_cast<StackFrameARM *>(frames->at(0)); + StackFrameARM *frame0 = static_cast<StackFrameARM*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(context_frame_validity, frame0->context_validity); EXPECT_EQ("enchiridion", frame0->function_name); EXPECT_EQ(0x40004000U, frame0->function_base); - StackFrameARM *frame1 = static_cast<StackFrameARM *>(frames->at(1)); + StackFrameARM *frame1 = static_cast<StackFrameARM*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame1->trust); ASSERT_EQ(expected_validity, frame1->context_validity); if (expected_validity & StackFrameARM::CONTEXT_VALID_R1) @@ -848,12 +848,12 @@ TEST_F(GetFramesByFramePointer, OnlyFramePointer) { frames = call_stack.frames(); ASSERT_EQ(3U, frames->size()); - StackFrameARM *frame0 = static_cast<StackFrameARM *>(frames->at(0)); + StackFrameARM *frame0 = static_cast<StackFrameARM*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameARM::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); - StackFrameARM *frame1 = static_cast<StackFrameARM *>(frames->at(1)); + StackFrameARM *frame1 = static_cast<StackFrameARM*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_FP, frame1->trust); ASSERT_EQ((StackFrameARM::CONTEXT_VALID_PC | StackFrameARM::CONTEXT_VALID_LR | @@ -866,7 +866,7 @@ TEST_F(GetFramesByFramePointer, OnlyFramePointer) { EXPECT_EQ(frame2_fp.Value(), frame1->context.iregs[MD_CONTEXT_ARM_REG_IOS_FP]); - StackFrameARM *frame2 = static_cast<StackFrameARM *>(frames->at(2)); + StackFrameARM *frame2 = static_cast<StackFrameARM*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_FP, frame2->trust); ASSERT_EQ((StackFrameARM::CONTEXT_VALID_PC | StackFrameARM::CONTEXT_VALID_LR | @@ -944,12 +944,12 @@ TEST_F(GetFramesByFramePointer, FramePointerAndCFI) { frames = call_stack.frames(); ASSERT_EQ(3U, frames->size()); - StackFrameARM *frame0 = static_cast<StackFrameARM *>(frames->at(0)); + StackFrameARM *frame0 = static_cast<StackFrameARM*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameARM::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0, memcmp(&raw_context, &frame0->context, sizeof(raw_context))); - StackFrameARM *frame1 = static_cast<StackFrameARM *>(frames->at(1)); + StackFrameARM *frame1 = static_cast<StackFrameARM*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_FP, frame1->trust); ASSERT_EQ((StackFrameARM::CONTEXT_VALID_PC | StackFrameARM::CONTEXT_VALID_LR | @@ -965,7 +965,7 @@ TEST_F(GetFramesByFramePointer, FramePointerAndCFI) { EXPECT_EQ(0x40004000U, frame1->function_base); - StackFrameARM *frame2 = static_cast<StackFrameARM *>(frames->at(2)); + StackFrameARM *frame2 = static_cast<StackFrameARM*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame2->trust); ASSERT_EQ((StackFrameARM::CONTEXT_VALID_PC | StackFrameARM::CONTEXT_VALID_LR | diff --git a/src/processor/stackwalker_selftest.cc b/src/processor/stackwalker_selftest.cc index f692d4c4..dcb2df00 100644 --- a/src/processor/stackwalker_selftest.cc +++ b/src/processor/stackwalker_selftest.cc @@ -420,7 +420,7 @@ int main(int argc, char** argv) { // Not i386 or ppc or sparc? We can only test stacks we know how to walk. -int main(int argc, char **argv) { +int main(int argc, char** argv) { BPLOG_INIT(&argc, &argv); // "make check" interprets an exit status of 77 to mean that the test is diff --git a/src/processor/stackwalker_unittest_utils.h b/src/processor/stackwalker_unittest_utils.h index 3a92a5ea..2905ea06 100644 --- a/src/processor/stackwalker_unittest_utils.h +++ b/src/processor/stackwalker_unittest_utils.h @@ -57,7 +57,7 @@ class MockMemoryRegion: public google_breakpad::MemoryRegion { // Set this region's address and contents. If we have placed an // instance of this class in a test fixture class, individual tests // can use this to provide the region's contents. - void Init(uint64_t base_address, const string &contents) { + void Init(uint64_t base_address, const string& contents) { base_address_ = base_address; contents_ = contents; } @@ -65,16 +65,16 @@ class MockMemoryRegion: public google_breakpad::MemoryRegion { uint64_t GetBase() const { return base_address_; } uint32_t GetSize() const { return contents_.size(); } - bool GetMemoryAtAddress(uint64_t address, uint8_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const { return GetMemoryLittleEndian(address, value); } - bool GetMemoryAtAddress(uint64_t address, uint16_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const { return GetMemoryLittleEndian(address, value); } - bool GetMemoryAtAddress(uint64_t address, uint32_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const { return GetMemoryLittleEndian(address, value); } - bool GetMemoryAtAddress(uint64_t address, uint64_t *value) const { + bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const { return GetMemoryLittleEndian(address, value); } void Print() const { @@ -85,7 +85,7 @@ class MockMemoryRegion: public google_breakpad::MemoryRegion { // Fetch a little-endian value from ADDRESS in contents_ whose size // is BYTES, and store it in *VALUE. Return true on success. template<typename ValueType> - bool GetMemoryLittleEndian(uint64_t address, ValueType *value) const { + bool GetMemoryLittleEndian(uint64_t address, ValueType* value) const { if (address < base_address_ || address - base_address_ + sizeof(ValueType) > contents_.size()) return false; @@ -105,7 +105,7 @@ class MockMemoryRegion: public google_breakpad::MemoryRegion { class MockCodeModule: public google_breakpad::CodeModule { public: MockCodeModule(uint64_t base_address, uint64_t size, - const string &code_file, const string &version) + const string& code_file, const string& version) : base_address_(base_address), size_(size), code_file_(code_file) { } uint64_t base_address() const { return base_address_; } @@ -115,7 +115,7 @@ class MockCodeModule: public google_breakpad::CodeModule { string debug_file() const { return code_file_; } string debug_identifier() const { return code_file_; } string version() const { return version_; } - google_breakpad::CodeModule *Copy() const { + google_breakpad::CodeModule* Copy() const { abort(); // Tests won't use this. } virtual bool is_unloaded() const { return false; } @@ -134,16 +134,16 @@ class MockCodeModules: public google_breakpad::CodeModules { typedef google_breakpad::CodeModule CodeModule; typedef google_breakpad::CodeModules CodeModules; - void Add(const MockCodeModule *module) { + void Add(const MockCodeModule* module) { modules_.push_back(module); } unsigned int module_count() const { return modules_.size(); } - const CodeModule *GetModuleForAddress(uint64_t address) const { + const CodeModule* GetModuleForAddress(uint64_t address) const { for (ModuleVector::const_iterator i = modules_.begin(); i != modules_.end(); i++) { - const MockCodeModule *module = *i; + const MockCodeModule* module = *i; if (module->base_address() <= address && address - module->base_address() < module->size()) return module; @@ -151,17 +151,17 @@ class MockCodeModules: public google_breakpad::CodeModules { return NULL; }; - const CodeModule *GetMainModule() const { return modules_[0]; } + const CodeModule* GetMainModule() const { return modules_[0]; } - const CodeModule *GetModuleAtSequence(unsigned int sequence) const { + const CodeModule* GetModuleAtSequence(unsigned int sequence) const { return modules_.at(sequence); } - const CodeModule *GetModuleAtIndex(unsigned int index) const { + const CodeModule* GetModuleAtIndex(unsigned int index) const { return modules_.at(index); } - CodeModules *Copy() const { abort(); } // Tests won't use this + CodeModules* Copy() const { abort(); } // Tests won't use this virtual std::vector<google_breakpad::linked_ptr<const CodeModule> > GetShrunkRangeModules() const { @@ -169,7 +169,7 @@ class MockCodeModules: public google_breakpad::CodeModules { } private: - typedef std::vector<const MockCodeModule *> ModuleVector; + typedef std::vector<const MockCodeModule*> ModuleVector; ModuleVector modules_; }; @@ -177,26 +177,26 @@ class MockSymbolSupplier: public google_breakpad::SymbolSupplier { public: typedef google_breakpad::CodeModule CodeModule; typedef google_breakpad::SystemInfo SystemInfo; - MOCK_METHOD3(GetSymbolFile, SymbolResult(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file)); - MOCK_METHOD4(GetSymbolFile, SymbolResult(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - string *symbol_data)); - MOCK_METHOD5(GetCStringSymbolData, SymbolResult(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - char **symbol_data, - size_t *symbol_data_size)); - MOCK_METHOD1(FreeSymbolData, void(const CodeModule *module)); + MOCK_METHOD3(GetSymbolFile, SymbolResult(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file)); + MOCK_METHOD4(GetSymbolFile, SymbolResult(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + string* symbol_data)); + MOCK_METHOD5(GetCStringSymbolData, SymbolResult(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + char** symbol_data, + size_t* symbol_data_size)); + MOCK_METHOD1(FreeSymbolData, void(const CodeModule* module)); // Copies the passed string contents into a newly allocated buffer. // The newly allocated buffer will be freed during destruction. - char* CopySymbolDataAndOwnTheCopy(const string &info, - size_t *symbol_data_size) { + char* CopySymbolDataAndOwnTheCopy(const string& info, + size_t* symbol_data_size) { *symbol_data_size = info.size() + 1; - char *symbol_data = new char[*symbol_data_size]; + char* symbol_data = new char[*symbol_data_size]; memcpy(symbol_data, info.c_str(), info.size()); symbol_data[info.size()] = '\0'; symbol_data_to_free_.push_back(symbol_data); diff --git a/src/processor/stackwalker_x86.cc b/src/processor/stackwalker_x86.cc index ed2b383d..b11e061d 100644 --- a/src/processor/stackwalker_x86.cc +++ b/src/processor/stackwalker_x86.cc @@ -136,7 +136,7 @@ StackFrame* StackwalkerX86::GetContextFrame() { } StackFrameX86* StackwalkerX86::GetCallerByWindowsFrameInfo( - const vector<StackFrame*> &frames, + const vector<StackFrame*>& frames, WindowsFrameInfo* last_frame_info, bool stack_scan_allowed) { StackFrame::FrameTrust trust = StackFrame::FRAME_TRUST_NONE; @@ -514,7 +514,7 @@ StackFrameX86* StackwalkerX86::GetCallerByWindowsFrameInfo( } StackFrameX86* StackwalkerX86::GetCallerByCFIFrameInfo( - const vector<StackFrame*> &frames, + const vector<StackFrame*>& frames, CFIFrameInfo* cfi_frame_info) { StackFrameX86* last_frame = static_cast<StackFrameX86*>(frames.back()); last_frame->cfi_frame_info = cfi_frame_info; @@ -539,7 +539,7 @@ StackFrameX86* StackwalkerX86::GetCallerByCFIFrameInfo( } StackFrameX86* StackwalkerX86::GetCallerByEBPAtBase( - const vector<StackFrame*> &frames, + const vector<StackFrame*>& frames, bool stack_scan_allowed) { StackFrame::FrameTrust trust; StackFrameX86* last_frame = static_cast<StackFrameX86*>(frames.back()); @@ -632,7 +632,7 @@ StackFrame* StackwalkerX86::GetCallerFrame(const CallStack* stack, return NULL; } - const vector<StackFrame*> &frames = *stack->frames(); + const vector<StackFrame*>& frames = *stack->frames(); StackFrameX86* last_frame = static_cast<StackFrameX86*>(frames.back()); scoped_ptr<StackFrameX86> new_frame; diff --git a/src/processor/stackwalker_x86.h b/src/processor/stackwalker_x86.h index 0659a13b..1783fda3 100644 --- a/src/processor/stackwalker_x86.h +++ b/src/processor/stackwalker_x86.h @@ -81,14 +81,14 @@ class StackwalkerX86 : public Stackwalker { // to construct the frame that called frames.back(). The caller // takes ownership of the returned frame. Return NULL on failure. StackFrameX86* GetCallerByWindowsFrameInfo( - const vector<StackFrame*> &frames, + const vector<StackFrame*>& frames, WindowsFrameInfo* windows_frame_info, bool stack_scan_allowed); // Use cfi_frame_info (derived from STACK CFI records) to construct // the frame that called frames.back(). The caller takes ownership // of the returned frame. Return NULL on failure. - StackFrameX86* GetCallerByCFIFrameInfo(const vector<StackFrame*> &frames, + StackFrameX86* GetCallerByCFIFrameInfo(const vector<StackFrame*>& frames, CFIFrameInfo* cfi_frame_info); // Assuming a traditional frame layout --- where the caller's %ebp @@ -96,7 +96,7 @@ class StackwalkerX86 : public Stackwalker { // %ebp points to the saved %ebp --- construct the frame that called // frames.back(). The caller takes ownership of the returned frame. // Return NULL on failure. - StackFrameX86* GetCallerByEBPAtBase(const vector<StackFrame*> &frames, + StackFrameX86* GetCallerByEBPAtBase(const vector<StackFrame*>& frames, bool stack_scan_allowed); // Stores the CPU context corresponding to the innermost stack frame to diff --git a/src/processor/stackwalker_x86_unittest.cc b/src/processor/stackwalker_x86_unittest.cc index 359f1c86..b6f14a14 100644 --- a/src/processor/stackwalker_x86_unittest.cc +++ b/src/processor/stackwalker_x86_unittest.cc @@ -113,7 +113,7 @@ class StackwalkerX86Fixture { // Set the Breakpad symbol information that supplier should return for // MODULE to INFO. - void SetModuleSymbols(MockCodeModule *module, const string &info) { + void SetModuleSymbols(MockCodeModule* module, const string& info) { size_t buffer_size; char *buffer = supplier.CopySymbolDataAndOwnTheCopy(info, &buffer_size); EXPECT_CALL(supplier, GetCStringSymbolData(module, &system_info, _, _, _)) @@ -134,7 +134,7 @@ class StackwalkerX86Fixture { void BrandContext(MDRawContextX86 *raw_context) { uint8_t x = 173; for (size_t i = 0; i < sizeof(*raw_context); i++) - reinterpret_cast<uint8_t *>(raw_context)[i] = (x += 17); + reinterpret_cast<uint8_t*>(raw_context)[i] = (x += 17); } SystemInfo system_info; @@ -151,7 +151,7 @@ class StackwalkerX86Fixture { MockSymbolSupplier supplier; BasicSourceLineResolver resolver; CallStack call_stack; - const vector<StackFrame *> *frames; + const vector<StackFrame*>* frames; }; class SanityCheck: public StackwalkerX86Fixture, public Test { }; @@ -175,7 +175,7 @@ TEST_F(SanityCheck, NoResolver) { ASSERT_EQ("module1", modules_without_symbols[0]->debug_file()); ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); frames = call_stack.frames(); - StackFrameX86 *frame = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame = static_cast<StackFrameX86*>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); @@ -201,7 +201,7 @@ TEST_F(GetContextFrame, Simple) { ASSERT_EQ("module1", modules_without_symbols[0]->debug_file()); ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); frames = call_stack.frames(); - StackFrameX86 *frame = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame = static_cast<StackFrameX86*>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); @@ -224,7 +224,7 @@ TEST_F(GetContextFrame, NoStackMemory) { ASSERT_EQ("module1", modules_without_symbols[0]->debug_file()); ASSERT_EQ(0U, modules_with_corrupt_symbols.size()); frames = call_stack.frames(); - StackFrameX86 *frame = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame = static_cast<StackFrameX86*>(frames->at(0)); // Check that the values from the original raw context made it // through to the context in the stack frame. EXPECT_EQ(0, memcmp(&raw_context, &frame->context, sizeof(raw_context))); @@ -269,7 +269,7 @@ TEST_F(GetCallerFrame, Traditional) { ASSERT_EQ(2U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); EXPECT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x4000c7a5U, frame0->instruction); @@ -279,7 +279,7 @@ TEST_F(GetCallerFrame, Traditional) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_FP, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP @@ -333,7 +333,7 @@ TEST_F(GetCallerFrame, TraditionalScan) { ASSERT_EQ(2U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x4000f49dU, frame0->instruction); @@ -344,7 +344,7 @@ TEST_F(GetCallerFrame, TraditionalScan) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP @@ -399,7 +399,7 @@ TEST_F(GetCallerFrame, TraditionalScanLongWay) { ASSERT_EQ(2U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x4000f49dU, frame0->instruction); @@ -410,7 +410,7 @@ TEST_F(GetCallerFrame, TraditionalScanLongWay) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP @@ -465,7 +465,7 @@ TEST_F(GetCallerFrame, ScanningNotAllowed) { ASSERT_EQ(1U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x4000f49dU, frame0->instruction); @@ -524,7 +524,7 @@ TEST_F(GetCallerFrame, WindowsFrameData) { ASSERT_EQ(2U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x4000aa85U, frame0->instruction); @@ -535,7 +535,7 @@ TEST_F(GetCallerFrame, WindowsFrameData) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP @@ -605,7 +605,7 @@ TEST_F(GetCallerFrame, WindowsFrameDataAligned) { ASSERT_EQ(2U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x4000aa85U, frame0->instruction); @@ -616,7 +616,7 @@ TEST_F(GetCallerFrame, WindowsFrameDataAligned) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP @@ -693,7 +693,7 @@ TEST_F(GetCallerFrame, WindowsFrameDataParameterSize) { ASSERT_EQ(3U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x40001004U, frame0->instruction); @@ -714,7 +714,7 @@ TEST_F(GetCallerFrame, WindowsFrameDataParameterSize) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_FP, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP @@ -737,7 +737,7 @@ TEST_F(GetCallerFrame, WindowsFrameDataParameterSize) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame2 = static_cast<StackFrameX86 *>(frames->at(2)); + StackFrameX86 *frame2 = static_cast<StackFrameX86*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame2->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP @@ -793,7 +793,7 @@ TEST_F(GetCallerFrame, WindowsFrameDataScan) { ASSERT_EQ(2U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x40000c9cU, frame0->instruction); @@ -804,7 +804,7 @@ TEST_F(GetCallerFrame, WindowsFrameDataScan) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); // I'd argue that CONTEXT_VALID_EBP shouldn't be here, since the walker // does not actually fetch the EBP after a scan (forcing the next frame @@ -882,7 +882,7 @@ TEST_F(GetCallerFrame, WindowsFrameDataBadEIPScan) { ASSERT_EQ(2U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x40000700U, frame0->instruction); @@ -893,7 +893,7 @@ TEST_F(GetCallerFrame, WindowsFrameDataBadEIPScan) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI_SCAN, frame1->trust); // I'd argue that CONTEXT_VALID_EBP shouldn't be here, since the // walker does not actually fetch the EBP after a scan (forcing the @@ -955,7 +955,7 @@ TEST_F(GetCallerFrame, WindowsFPOUnchangedEBP) { ASSERT_EQ(2U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x4000e8b8U, frame0->instruction); @@ -976,7 +976,7 @@ TEST_F(GetCallerFrame, WindowsFPOUnchangedEBP) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP @@ -1039,7 +1039,7 @@ TEST_F(GetCallerFrame, WindowsFPOUsedEBP) { ASSERT_EQ(2U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x40009ab8U, frame0->instruction); @@ -1060,7 +1060,7 @@ TEST_F(GetCallerFrame, WindowsFPOUsedEBP) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP @@ -1170,8 +1170,8 @@ TEST_F(GetCallerFrame, WindowsFPOReferencesEBX) { StackFrameSymbolizer frame_symbolizer(&supplier, &resolver); StackwalkerX86 walker(&system_info, &raw_context, &stack_region, &modules, &frame_symbolizer); - vector<const CodeModule *> modules_without_symbols; - vector<const CodeModule *> modules_with_corrupt_symbols; + vector<const CodeModule*> modules_without_symbols; + vector<const CodeModule*> modules_with_corrupt_symbols; ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols, &modules_with_corrupt_symbols)); ASSERT_EQ(0U, modules_without_symbols.size()); @@ -1180,31 +1180,31 @@ TEST_F(GetCallerFrame, WindowsFPOReferencesEBX) { ASSERT_EQ(5U, frames->size()); { - const StackFrameX86 &frame = *static_cast<StackFrameX86 *>(frames->at(0)); + const StackFrameX86& frame = *static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame.trust); EXPECT_EQ(0x77726bf4U, frame.context.eip); EXPECT_EQ("KiFastSystemCallRet", frame.function_name); } { - const StackFrameX86 &frame = *static_cast<StackFrameX86 *>(frames->at(1)); + const StackFrameX86& frame = *static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame.trust); EXPECT_EQ(0x7772655cU, frame.context.eip); EXPECT_EQ("NtWaitForKeyedEvent", frame.function_name); } { - const StackFrameX86 &frame = *static_cast<StackFrameX86 *>(frames->at(2)); + const StackFrameX86& frame = *static_cast<StackFrameX86*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame.trust); EXPECT_EQ(0x776e4a3fU, frame.context.eip); EXPECT_EQ("RtlSleepConditionVariableSRW", frame.function_name); } { - const StackFrameX86 &frame = *static_cast<StackFrameX86 *>(frames->at(3)); + const StackFrameX86& frame = *static_cast<StackFrameX86*>(frames->at(3)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame.trust); EXPECT_EQ(0x7728219eU, frame.context.eip); EXPECT_EQ("SleepConditionVariableSRW", frame.function_name); } { - const StackFrameX86 &frame = *static_cast<StackFrameX86 *>(frames->at(4)); + const StackFrameX86& frame = *static_cast<StackFrameX86*>(frames->at(4)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame.trust); EXPECT_EQ(0x5ac0486cU, frame.context.eip); EXPECT_EQ("base::ConditionVariable::TimedWait", frame.function_name); @@ -1318,7 +1318,7 @@ TEST_F(GetCallerFrame, WindowsFPOSystemCall) { ASSERT_EQ(4U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x771ef8c1U, frame0->instruction); @@ -1338,7 +1338,7 @@ TEST_F(GetCallerFrame, WindowsFPOSystemCall) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP @@ -1532,7 +1532,7 @@ TEST_F(GetCallerFrame, ReturnAddressIsNotInKnownModule) { ASSERT_EQ(3U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(0x77c181cdU, frame0->instruction); @@ -1554,7 +1554,7 @@ TEST_F(GetCallerFrame, ReturnAddressIsNotInKnownModule) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI_SCAN, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP | @@ -1578,7 +1578,7 @@ TEST_F(GetCallerFrame, ReturnAddressIsNotInKnownModule) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame2 = static_cast<StackFrameX86 *>(frames->at(2)); + StackFrameX86 *frame2 = static_cast<StackFrameX86*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame2->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP | @@ -1610,7 +1610,7 @@ TEST_F(GetCallerFrame, HandleAlignmentInProgramString) { MockCodeModule chrome_dll(0x59630000, 0x19e3000, "chrome.dll", "version1"); SetModuleSymbols(&chrome_dll, // chrome.dll "FUNC 56422 50c 8 base::MessageLoop::RunTask" - "(base::PendingTask const &)\n" + "(base::PendingTask const&)\n" "56422 e 458 4589\n" "STACK WIN 4 56422 50c 11 0 8 c ac 0 1 $T1 .raSearch = $T0 " "$T1 4 - 8 @ = $ebp $T1 4 - ^ = $eip $T1 ^ = $esp $T1 4 + = " @@ -1627,7 +1627,7 @@ TEST_F(GetCallerFrame, HandleAlignmentInProgramString) { "$T1 4 - 64 @ = $ebp $T1 4 - ^ = $eip $T1 ^ = $esp $T1 4 + " "= $20 $T0 56 - ^ = $23 $T0 60 - ^ = $24 $T0 64 - ^ =\n" "FUNC 55bf0 49 4 base::MessagePumpWin::Run(base::" - "MessagePump::Delegate *)\n" + "MessagePump::Delegate*)\n" "55bf0 49 48 4724\n" "STACK WIN 4 55bf0 49 c 0 4 0 10 0 1 $T0 $ebp = $eip $T0 4 " "+ ^ = $ebp $T0 ^ = $esp $T0 8 + =\n" @@ -1735,7 +1735,7 @@ TEST_F(GetCallerFrame, HandleAlignmentInProgramString) { ASSERT_EQ(3U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame->context_validity); EXPECT_EQ("base::MessagePumpForIO::DoRunLoop()", frame->function_name); @@ -1756,13 +1756,13 @@ TEST_F(GetCallerFrame, HandleAlignmentInProgramString) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP | StackFrameX86::CONTEXT_VALID_EBP), frame->context_validity); - EXPECT_EQ("base::MessagePumpWin::Run(base::MessagePump::Delegate *)", + EXPECT_EQ("base::MessagePumpWin::Run(base::MessagePump::Delegate*)", frame->function_name); EXPECT_EQ(1500011566U, frame->instruction + 1); EXPECT_EQ(1500011566U, frame->context.eip); @@ -1779,7 +1779,7 @@ TEST_F(GetCallerFrame, HandleAlignmentInProgramString) { } { // To avoid reusing locals by mistake - StackFrameX86 *frame = static_cast<StackFrameX86 *>(frames->at(2)); + StackFrameX86 *frame = static_cast<StackFrameX86*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP | @@ -1984,7 +1984,7 @@ void GetCallerFrame::IPAddressIsNotInKnownModuleTestImpl( ASSERT_EQ(4U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ(raw_context.eip, frame0->context.eip); @@ -1996,7 +1996,7 @@ void GetCallerFrame::IPAddressIsNotInKnownModuleTestImpl( } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_SCAN, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP | @@ -2016,7 +2016,7 @@ void GetCallerFrame::IPAddressIsNotInKnownModuleTestImpl( } { // To avoid reusing locals by mistake - StackFrameX86 *frame2 = static_cast<StackFrameX86 *>(frames->at(2)); + StackFrameX86 *frame2 = static_cast<StackFrameX86*>(frames->at(2)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame2->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP | @@ -2036,7 +2036,7 @@ void GetCallerFrame::IPAddressIsNotInKnownModuleTestImpl( } { // To avoid reusing locals by mistake - StackFrameX86 *frame3 = static_cast<StackFrameX86 *>(frames->at(3)); + StackFrameX86 *frame3 = static_cast<StackFrameX86*>(frames->at(3)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame3->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP | @@ -2126,7 +2126,7 @@ struct CFIFixture: public StackwalkerX86Fixture { ASSERT_EQ(2U, frames->size()); { // To avoid reusing locals by mistake - StackFrameX86 *frame0 = static_cast<StackFrameX86 *>(frames->at(0)); + StackFrameX86 *frame0 = static_cast<StackFrameX86*>(frames->at(0)); EXPECT_EQ(StackFrame::FRAME_TRUST_CONTEXT, frame0->trust); ASSERT_EQ(StackFrameX86::CONTEXT_VALID_ALL, frame0->context_validity); EXPECT_EQ("enchiridion", frame0->function_name); @@ -2138,7 +2138,7 @@ struct CFIFixture: public StackwalkerX86Fixture { } { // To avoid reusing locals by mistake - StackFrameX86 *frame1 = static_cast<StackFrameX86 *>(frames->at(1)); + StackFrameX86 *frame1 = static_cast<StackFrameX86*>(frames->at(1)); EXPECT_EQ(StackFrame::FRAME_TRUST_CFI, frame1->trust); ASSERT_EQ((StackFrameX86::CONTEXT_VALID_EIP | StackFrameX86::CONTEXT_VALID_ESP | diff --git a/src/processor/static_address_map-inl.h b/src/processor/static_address_map-inl.h index 67e07976..9d2c1def 100644 --- a/src/processor/static_address_map-inl.h +++ b/src/processor/static_address_map-inl.h @@ -44,8 +44,8 @@ namespace google_breakpad { template<typename AddressType, typename EntryType> bool StaticAddressMap<AddressType, EntryType>::Retrieve( - const AddressType &address, - const EntryType *&entry, AddressType *entry_address) const { + const AddressType& address, + const EntryType*& entry, AddressType* entry_address) const { // upper_bound gives the first element whose key is greater than address, // but we want the first element whose key is less than or equal to address. diff --git a/src/processor/static_address_map.h b/src/processor/static_address_map.h index 6bafc667..9d1a467b 100644 --- a/src/processor/static_address_map.h +++ b/src/processor/static_address_map.h @@ -52,15 +52,15 @@ template<typename AddressType, typename EntryType> class StaticAddressMap { public: StaticAddressMap(): map_() { } - explicit StaticAddressMap(const char *map_data): map_(map_data) { } + explicit StaticAddressMap(const char* map_data): map_(map_data) { } // Locates the entry stored at the highest address less than or equal to // the address argument. If there is no such range, returns false. The // entry is returned in entry, which is a required argument. If // entry_address is not NULL, it will be set to the address that the entry // was stored at. - bool Retrieve(const AddressType &address, - const EntryType *&entry, AddressType *entry_address) const; + bool Retrieve(const AddressType& address, + const EntryType*& entry, AddressType* entry_address) const; private: friend class ModuleComparer; diff --git a/src/processor/static_address_map_unittest.cc b/src/processor/static_address_map_unittest.cc index 12c735cf..9f1215d6 100644 --- a/src/processor/static_address_map_unittest.cc +++ b/src/processor/static_address_map_unittest.cc @@ -95,7 +95,7 @@ class TestStaticAddressMap : public ::testing::Test { int address_test; string entry; string entry_test; - const char *entry_cstring = NULL; + const char* entry_cstring = NULL; bool found; bool found_test; @@ -143,11 +143,11 @@ class TestStaticAddressMap : public ::testing::Test { // Test data sets: static const int kNumberTestCases = 4; static const int testsize[]; - int *testdata[kNumberTestCases]; + int* testdata[kNumberTestCases]; AddrMap addr_map[kNumberTestCases]; TestMap test_map[kNumberTestCases]; - char *map_data[kNumberTestCases]; + char* map_data[kNumberTestCases]; google_breakpad::AddressMapSerializer<int, string> serializer; }; @@ -229,7 +229,7 @@ TEST_F(TestStaticAddressMap, Test1000RandomElementsMap) { } } -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/src/processor/static_contained_range_map-inl.h b/src/processor/static_contained_range_map-inl.h index 777c7621..87ea6c7f 100644 --- a/src/processor/static_contained_range_map-inl.h +++ b/src/processor/static_contained_range_map-inl.h @@ -47,7 +47,7 @@ StaticContainedRangeMap<AddressType, EntryType>::StaticContainedRangeMap( const char *base) : base_(*(reinterpret_cast<const AddressType*>(base))), entry_size_(*(reinterpret_cast<const uint32_t*>(base + sizeof(base_)))), - entry_ptr_(reinterpret_cast<const EntryType *>( + entry_ptr_(reinterpret_cast<const EntryType*>( base + sizeof(base_) + sizeof(entry_size_))), map_(base + sizeof(base_) + sizeof(entry_size_) + entry_size_) { if (entry_size_ == 0) @@ -57,7 +57,7 @@ StaticContainedRangeMap<AddressType, EntryType>::StaticContainedRangeMap( template<typename AddressType, typename EntryType> bool StaticContainedRangeMap<AddressType, EntryType>::RetrieveRange( - const AddressType &address, const EntryType *&entry) const { + const AddressType& address, const EntryType*& entry) const { // Get an iterator to the child range whose high address is equal to or // greater than the supplied address. If the supplied address is higher diff --git a/src/processor/static_contained_range_map.h b/src/processor/static_contained_range_map.h index 6a9b8b7b..14fa5e95 100644 --- a/src/processor/static_contained_range_map.h +++ b/src/processor/static_contained_range_map.h @@ -57,7 +57,7 @@ class StaticContainedRangeMap { // child ranges, and not the entry contained by |this|. This is necessary // to support a sparsely-populated root range. If no descendant range // encompasses the address, returns false. - bool RetrieveRange(const AddressType &address, const EntryType *&entry) const; + bool RetrieveRange(const AddressType& address, const EntryType*& entry) const; private: friend class ModuleComparer; diff --git a/src/processor/static_map-inl.h b/src/processor/static_map-inl.h index e6aac6ab..75a8a335 100644 --- a/src/processor/static_map-inl.h +++ b/src/processor/static_map-inl.h @@ -59,7 +59,7 @@ StaticMap<Key, Value, Compare>::StaticMap(const char* raw_data) // find(), lower_bound() and upper_bound() implement binary search algorithm. template<typename Key, typename Value, typename Compare> StaticMapIterator<Key, Value, Compare> -StaticMap<Key, Value, Compare>::find(const Key &key) const { +StaticMap<Key, Value, Compare>::find(const Key& key) const { int begin = 0; int end = num_nodes_; int middle; @@ -80,7 +80,7 @@ StaticMap<Key, Value, Compare>::find(const Key &key) const { template<typename Key, typename Value, typename Compare> StaticMapIterator<Key, Value, Compare> -StaticMap<Key, Value, Compare>::lower_bound(const Key &key) const { +StaticMap<Key, Value, Compare>::lower_bound(const Key& key) const { int begin = 0; int end = num_nodes_; int middle; @@ -101,7 +101,7 @@ StaticMap<Key, Value, Compare>::lower_bound(const Key &key) const { template<typename Key, typename Value, typename Compare> StaticMapIterator<Key, Value, Compare> -StaticMap<Key, Value, Compare>::upper_bound(const Key &key) const { +StaticMap<Key, Value, Compare>::upper_bound(const Key& key) const { int begin = 0; int end = num_nodes_; int middle; diff --git a/src/processor/static_map.h b/src/processor/static_map.h index 9723ab2a..e7d8c960 100644 --- a/src/processor/static_map.h +++ b/src/processor/static_map.h @@ -72,7 +72,7 @@ namespace google_breakpad { template<typename Key> class DefaultCompare { public: - int operator()(const Key &k1, const Key &k2) const { + int operator()(const Key& k1, const Key& k2) const { if (k1 < k2) return -1; if (k1 == k2) return 0; return 1; @@ -104,15 +104,15 @@ class StaticMap { } // Lookup operations. - iterator find(const Key &k) const; + iterator find(const Key& k) const; // lower_bound(k) searches in a sorted range for the first element that has a // key not less than the argument k. - iterator lower_bound(const Key &k) const; + iterator lower_bound(const Key& k) const; // upper_bound(k) searches in a sorted range for the first element that has a // key greater than the argument k. - iterator upper_bound(const Key &k) const; + iterator upper_bound(const Key& k) const; // Checks if the underlying memory data conforms to the predefined pattern: // first check the number of nodes is non-negative, diff --git a/src/processor/static_map_iterator-inl.h b/src/processor/static_map_iterator-inl.h index 7a7db5ad..84745842 100644 --- a/src/processor/static_map_iterator-inl.h +++ b/src/processor/static_map_iterator-inl.h @@ -43,7 +43,7 @@ namespace google_breakpad { template<typename Key, typename Value, typename Compare> StaticMapIterator<Key, Value, Compare>::StaticMapIterator(const char* base, - const int &index): + const int& index): index_(index), base_(base) { // See static_map.h for documentation on // bytes format of serialized StaticMap data. diff --git a/src/processor/static_map_iterator.h b/src/processor/static_map_iterator.h index 1af8fff4..c49a8b71 100644 --- a/src/processor/static_map_iterator.h +++ b/src/processor/static_map_iterator.h @@ -87,7 +87,7 @@ class StaticMapIterator { friend class StaticMap<Key, Value, Compare>; // Only StaticMap can call this constructor. - explicit StaticMapIterator(const char* base, const int32_t &index); + explicit StaticMapIterator(const char* base, const int32_t& index); // Index of node that the iterator is pointing to. int32_t index_; diff --git a/src/processor/static_map_unittest.cc b/src/processor/static_map_unittest.cc index 393d43d5..d17153d9 100644 --- a/src/processor/static_map_unittest.cc +++ b/src/processor/static_map_unittest.cc @@ -46,7 +46,7 @@ typedef std::map< KeyType, ValueType > StdMap; template<typename Key, typename Value> class SimpleMapSerializer { public: - static char* Serialize(const std::map<Key, Value> &stdmap, + static char* Serialize(const std::map<Key, Value>& stdmap, unsigned int* size = NULL) { unsigned int size_per_node = sizeof(uint32_t) + sizeof(Key) + sizeof(Value); @@ -237,19 +237,19 @@ class TestValidMap : public ::testing::Test { } } - void FindTester(int test_case, const KeyType &key) { + void FindTester(int test_case, const KeyType& key) { iter_test = test_map[test_case].find(key); iter_std = std_map[test_case].find(key); CompareLookupResult(test_case); } - void LowerBoundTester(int test_case, const KeyType &key) { + void LowerBoundTester(int test_case, const KeyType& key) { iter_test = test_map[test_case].lower_bound(key); iter_std = std_map[test_case].lower_bound(key); CompareLookupResult(test_case); } - void UpperBoundTester(int test_case, const KeyType &key) { + void UpperBoundTester(int test_case, const KeyType& key) { iter_test = test_map[test_case].upper_bound(key); iter_std = std_map[test_case].upper_bound(key); CompareLookupResult(test_case); diff --git a/src/processor/static_range_map-inl.h b/src/processor/static_range_map-inl.h index f6cef1a9..37fb6fae 100644 --- a/src/processor/static_range_map-inl.h +++ b/src/processor/static_range_map-inl.h @@ -43,8 +43,8 @@ namespace google_breakpad { template<typename AddressType, typename EntryType> bool StaticRangeMap<AddressType, EntryType>::RetrieveRange( - const AddressType &address, const EntryType *&entry, - AddressType *entry_base, AddressType *entry_size) const { + const AddressType& address, const EntryType*& entry, + AddressType* entry_base, AddressType* entry_size) const { MapConstIterator iterator = map_.lower_bound(address); if (iterator == map_.end()) return false; @@ -55,7 +55,7 @@ bool StaticRangeMap<AddressType, EntryType>::RetrieveRange( // be below the range's low address, though. When that happens, address // references something not within any range, so return false. - const Range *range = iterator.GetValuePtr(); + const Range* range = iterator.GetValuePtr(); // Make sure AddressType and EntryType are copyable basic types // e.g.: integer types, pointers etc @@ -74,8 +74,8 @@ bool StaticRangeMap<AddressType, EntryType>::RetrieveRange( template<typename AddressType, typename EntryType> bool StaticRangeMap<AddressType, EntryType>::RetrieveNearestRange( - const AddressType &address, const EntryType *&entry, - AddressType *entry_base, AddressType *entry_size) const { + const AddressType& address, const EntryType*& entry, + AddressType* entry_base, AddressType* entry_size) const { // If address is within a range, RetrieveRange can handle it. if (RetrieveRange(address, entry, entry_base, entry_size)) return true; @@ -91,7 +91,7 @@ bool StaticRangeMap<AddressType, EntryType>::RetrieveNearestRange( return false; --iterator; - const Range *range = iterator.GetValuePtr(); + const Range* range = iterator.GetValuePtr(); entry = range->entryptr(); if (entry_base) *entry_base = range->base(); @@ -103,8 +103,8 @@ bool StaticRangeMap<AddressType, EntryType>::RetrieveNearestRange( template<typename AddressType, typename EntryType> bool StaticRangeMap<AddressType, EntryType>::RetrieveRangeAtIndex( - int index, const EntryType *&entry, - AddressType *entry_base, AddressType *entry_size) const { + int index, const EntryType*& entry, + AddressType* entry_base, AddressType* entry_size) const { if (index >= GetCount()) { BPLOG(ERROR) << "Index out of range: " << index << "/" << GetCount(); @@ -113,7 +113,7 @@ bool StaticRangeMap<AddressType, EntryType>::RetrieveRangeAtIndex( MapConstIterator iterator = map_.IteratorAtIndex(index); - const Range *range = iterator.GetValuePtr(); + const Range* range = iterator.GetValuePtr(); entry = range->entryptr(); if (entry_base) diff --git a/src/processor/static_range_map.h b/src/processor/static_range_map.h index 91aabb03..ea89fae4 100644 --- a/src/processor/static_range_map.h +++ b/src/processor/static_range_map.h @@ -50,21 +50,21 @@ template<typename AddressType, typename EntryType> class StaticRangeMap { public: StaticRangeMap(): map_() { } - explicit StaticRangeMap(const char *memory): map_(memory) { } + explicit StaticRangeMap(const char* memory): map_(memory) { } // Locates the range encompassing the supplied address. If there is // no such range, returns false. entry_base and entry_size, if non-NULL, // are set to the base and size of the entry's range. - bool RetrieveRange(const AddressType &address, const EntryType *&entry, - AddressType *entry_base, AddressType *entry_size) const; + bool RetrieveRange(const AddressType& address, const EntryType*& entry, + AddressType* entry_base, AddressType* entry_size) const; // Locates the range encompassing the supplied address, if one exists. // If no range encompasses the supplied address, locates the nearest range // to the supplied address that is lower than the address. Returns false // if no range meets these criteria. entry_base and entry_size, if // non-NULL, are set to the base and size of the entry's range. - bool RetrieveNearestRange(const AddressType &address, const EntryType *&entry, - AddressType *entry_base, AddressType *entry_size) + bool RetrieveNearestRange(const AddressType& address, const EntryType*& entry, + AddressType* entry_base, AddressType* entry_size) const; // Treating all ranges as a list ordered by the address spaces that they @@ -74,8 +74,8 @@ class StaticRangeMap { // range. // // RetrieveRangeAtIndex is not optimized for speedy operation. - bool RetrieveRangeAtIndex(int index, const EntryType *&entry, - AddressType *entry_base, AddressType *entry_size) + bool RetrieveRangeAtIndex(int index, const EntryType*& entry, + AddressType* entry_base, AddressType* entry_size) const; // Returns the number of ranges stored in the RangeMap. diff --git a/src/processor/static_range_map_unittest.cc b/src/processor/static_range_map_unittest.cc index 28217362..1593ed00 100644 --- a/src/processor/static_range_map_unittest.cc +++ b/src/processor/static_range_map_unittest.cc @@ -414,7 +414,7 @@ TEST_F(TestStaticRangeMap, RunTestCase0Again) { } // namespace google_breakpad -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/src/processor/synth_minidump.cc b/src/processor/synth_minidump.cc index 5e72c161..da61afc4 100644 --- a/src/processor/synth_minidump.cc +++ b/src/processor/synth_minidump.cc @@ -37,7 +37,7 @@ namespace google_breakpad { namespace SynthMinidump { -Section::Section(const Dump &dump) +Section::Section(const Dump& dump) : test_assembler::Section(dump.endianness()) { } void Section::CiteLocationIn(test_assembler::Section *section) const { @@ -49,9 +49,9 @@ void Stream::CiteStreamIn(test_assembler::Section *section) const { CiteLocationIn(section); } -SystemInfo::SystemInfo(const Dump &dump, - const MDRawSystemInfo &system_info, - const String &csd_version) +SystemInfo::SystemInfo(const Dump& dump, + const MDRawSystemInfo& system_info, + const String& csd_version) : Stream(dump, MD_SYSTEM_INFO_STREAM) { D16(system_info.processor_architecture); D16(system_info.processor_level); @@ -108,7 +108,7 @@ const MDRawSystemInfo SystemInfo::windows_x86 = { const string SystemInfo::windows_x86_csd_version = "Service Pack 2"; -String::String(const Dump &dump, const string &contents) : Section(dump) { +String::String(const Dump& dump, const string& contents) : Section(dump) { D32(contents.size() * 2); for (string::const_iterator i = contents.begin(); i != contents.end(); i++) D16(*i); @@ -123,7 +123,7 @@ void Memory::CiteMemoryIn(test_assembler::Section *section) const { CiteLocationIn(section); } -Context::Context(const Dump &dump, const MDRawContextX86 &context) +Context::Context(const Dump& dump, const MDRawContextX86& context) : Section(dump) { // The caller should have properly set the CPU type flag. // The high 24 bits identify the CPU. Note that context records with no CPU @@ -173,7 +173,7 @@ Context::Context(const Dump &dump, const MDRawContextX86 &context) assert(Size() == sizeof(MDRawContextX86)); } -Context::Context(const Dump &dump, const MDRawContextARM &context) +Context::Context(const Dump& dump, const MDRawContextARM& context) : Section(dump) { // The caller should have properly set the CPU type flag. assert((context.context_flags & MD_CONTEXT_ARM) || @@ -192,7 +192,7 @@ Context::Context(const Dump &dump, const MDRawContextARM &context) assert(Size() == sizeof(MDRawContextARM)); } -Context::Context(const Dump &dump, const MDRawContextMIPS &context) +Context::Context(const Dump& dump, const MDRawContextMIPS& context) : Section(dump) { // The caller should have properly set the CPU type flag. assert(context.context_flags & MD_CONTEXT_MIPS); @@ -228,8 +228,8 @@ Context::Context(const Dump &dump, const MDRawContextMIPS &context) assert(Size() == sizeof(MDRawContextMIPS)); } -Thread::Thread(const Dump &dump, - uint32_t thread_id, const Memory &stack, const Context &context, +Thread::Thread(const Dump& dump, + uint32_t thread_id, const Memory& stack, const Context& context, uint32_t suspend_count, uint32_t priority_class, uint32_t priority, uint64_t teb) : Section(dump) { D32(thread_id); @@ -242,13 +242,13 @@ Thread::Thread(const Dump &dump, assert(Size() == sizeof(MDRawThread)); } -Module::Module(const Dump &dump, +Module::Module(const Dump& dump, uint64_t base_of_image, uint32_t size_of_image, - const String &name, + const String& name, uint32_t time_date_stamp, uint32_t checksum, - const MDVSFixedFileInfo &version_info, + const MDVSFixedFileInfo& version_info, const Section *cv_record, const Section *misc_record) : Section(dump) { D64(base_of_image); @@ -297,10 +297,10 @@ const MDVSFixedFileInfo Module::stock_version_info = { 0 // file_date_lo }; -UnloadedModule::UnloadedModule(const Dump &dump, +UnloadedModule::UnloadedModule(const Dump& dump, uint64_t base_of_image, uint32_t size_of_image, - const String &name, + const String& name, uint32_t checksum, uint32_t time_date_stamp) : Section(dump) { D64(base_of_image); @@ -310,15 +310,15 @@ UnloadedModule::UnloadedModule(const Dump &dump, name.CiteStringIn(this); } -UnloadedModuleList::UnloadedModuleList(const Dump &dump, uint32_t type) +UnloadedModuleList::UnloadedModuleList(const Dump& dump, uint32_t type) : List<UnloadedModule>(dump, type, false) { D32(sizeof(MDRawUnloadedModuleList)); D32(sizeof(MDRawUnloadedModule)); D32(count_label_); } -Exception::Exception(const Dump &dump, - const Context &context, +Exception::Exception(const Dump& dump, + const Context& context, uint32_t thread_id, uint32_t exception_code, uint32_t exception_flags, @@ -361,22 +361,22 @@ Dump::Dump(uint64_t flags, assert(Size() == sizeof(MDRawHeader)); } -Dump &Dump::Add(SynthMinidump::Section *section) { +Dump& Dump::Add(SynthMinidump::Section *section) { section->Finish(file_start_ + Size()); Append(*section); return *this; } -Dump &Dump::Add(Stream *stream) { - Add(static_cast<SynthMinidump::Section *>(stream)); +Dump& Dump::Add(Stream *stream) { + Add(static_cast<SynthMinidump::Section*>(stream)); stream->CiteStreamIn(&stream_directory_); stream_count_++; return *this; } -Dump &Dump::Add(Memory *memory) { +Dump& Dump::Add(Memory *memory) { // Add the memory contents themselves to the file. - Add(static_cast<SynthMinidump::Section *>(memory)); + Add(static_cast<SynthMinidump::Section*>(memory)); // The memory list is a list of MDMemoryDescriptors, not of actual // memory elements. Produce a descriptor, and add that to the list. @@ -386,17 +386,17 @@ Dump &Dump::Add(Memory *memory) { return *this; } -Dump &Dump::Add(Thread *thread) { +Dump& Dump::Add(Thread *thread) { thread_list_.Add(thread); return *this; } -Dump &Dump::Add(Module *module) { +Dump& Dump::Add(Module *module) { module_list_.Add(module); return *this; } -Dump &Dump::Add(UnloadedModule *unloaded_module) { +Dump& Dump::Add(UnloadedModule *unloaded_module) { unloaded_module_list_.Add(unloaded_module); return *this; } @@ -413,7 +413,7 @@ void Dump::Finish() { // has the stream count and MDRVA. stream_count_label_ = stream_count_; stream_directory_rva_ = file_start_ + Size(); - Append(static_cast<test_assembler::Section &>(stream_directory_)); + Append(static_cast<test_assembler::Section& >(stream_directory_)); } } // namespace SynthMinidump diff --git a/src/processor/synth_minidump.h b/src/processor/synth_minidump.h index 8f49cfff..2da4d5fe 100644 --- a/src/processor/synth_minidump.h +++ b/src/processor/synth_minidump.h @@ -135,7 +135,7 @@ class String; // A test_assembler::Section which will be appended to a minidump. class Section: public test_assembler::Section { public: - explicit Section(const Dump &dump); + explicit Section(const Dump& dump); // Append an MDLocationDescriptor referring to this section to SECTION. // If 'this' is NULL, append a descriptor with a zero length and MDRVA. @@ -145,13 +145,13 @@ class Section: public test_assembler::Section { // bad, if such language exists. Having this function handle NULL // 'this' is convenient, but if it causes trouble, it's not hard to // do differently.) - void CiteLocationIn(test_assembler::Section *section) const; + void CiteLocationIn(test_assembler::Section* section) const; // Note that this section's contents are complete, and that it has // been placed in the minidump file at OFFSET. The 'Add' member // functions call the Finish member function of the object being // added for you; if you are 'Add'ing this section, you needn't Finish it. - virtual void Finish(const Label &offset) { + virtual void Finish(const Label& offset) { file_offset_ = offset; size_ = Size(); } @@ -166,10 +166,10 @@ class Stream: public Section { public: // Create a stream of type TYPE. You can append whatever contents // you like to this stream using the test_assembler::Section methods. - Stream(const Dump &dump, uint32_t type) : Section(dump), type_(type) { } + Stream(const Dump& dump, uint32_t type) : Section(dump), type_(type) { } // Append an MDRawDirectory referring to this stream to SECTION. - void CiteStreamIn(test_assembler::Section *section) const; + void CiteStreamIn(test_assembler::Section* section) const; private: // The type of this stream. @@ -186,9 +186,9 @@ class SystemInfo: public Stream { // // Remember that you are still responsible for 'Add'ing CSD_VERSION // to the dump yourself. - SystemInfo(const Dump &dump, - const MDRawSystemInfo &system_info, - const String &csd_version); + SystemInfo(const Dump& dump, + const MDRawSystemInfo& system_info, + const String& csd_version); // Stock MDRawSystemInfo information and associated strings, for // writing tests. @@ -199,10 +199,10 @@ class SystemInfo: public Stream { // An MDString: a string preceded by a 32-bit length. class String: public Section { public: - String(const Dump &dump, const string &value); + String(const Dump& dump, const string& value); // Append an MDRVA referring to this string to SECTION. - void CiteStringIn(test_assembler::Section *section) const; + void CiteStringIn(test_assembler::Section* section) const; }; // A range of memory contents. 'Add'ing a memory range to a minidump @@ -211,11 +211,11 @@ class String: public Section { // to memory addresses. class Memory: public Section { public: - Memory(const Dump &dump, uint64_t address) + Memory(const Dump& dump, uint64_t address) : Section(dump), address_(address) { start() = address; } // Append an MDMemoryDescriptor referring to this memory range to SECTION. - void CiteMemoryIn(test_assembler::Section *section) const; + void CiteMemoryIn(test_assembler::Section* section) const; private: // The process address from which these memory contents were taken. @@ -226,11 +226,11 @@ class Memory: public Section { class Context: public Section { public: // Create a context belonging to DUMP whose contents are a copy of CONTEXT. - Context(const Dump &dump, const MDRawContextX86 &context); - Context(const Dump &dump, const MDRawContextARM &context); - Context(const Dump &dump, const MDRawContextMIPS &context); + Context(const Dump& dump, const MDRawContextX86& context); + Context(const Dump& dump, const MDRawContextARM& context); + Context(const Dump& dump, const MDRawContextMIPS& context); // Add an empty context to the dump. - Context(const Dump &dump) : Section(dump) {} + Context(const Dump& dump) : Section(dump) {} // Add constructors for other architectures here. Remember to byteswap. }; @@ -238,10 +238,10 @@ class Thread: public Section { public: // Create a thread belonging to DUMP with the given values, citing // STACK and CONTEXT (which you must Add to the dump separately). - Thread(const Dump &dump, + Thread(const Dump& dump, uint32_t thread_id, - const Memory &stack, - const Context &context, + const Memory& stack, + const Context& context, uint32_t suspend_count = 0, uint32_t priority_class = 0, uint32_t priority = 0, @@ -253,15 +253,15 @@ class Module: public Section { // Create a module with the given values. Note that CV_RECORD and // MISC_RECORD can be NULL, in which case the corresponding location // descriptior in the minidump will have a length of zero. - Module(const Dump &dump, + Module(const Dump& dump, uint64_t base_of_image, uint32_t size_of_image, - const String &name, + const String& name, uint32_t time_date_stamp = 1262805309, uint32_t checksum = 0, - const MDVSFixedFileInfo &version_info = Module::stock_version_info, - const Section *cv_record = NULL, - const Section *misc_record = NULL); + const MDVSFixedFileInfo& version_info = Module::stock_version_info, + const Section* cv_record = NULL, + const Section* misc_record = NULL); private: // A standard MDVSFixedFileInfo structure to use as a default for @@ -272,18 +272,18 @@ class Module: public Section { class UnloadedModule: public Section { public: - UnloadedModule(const Dump &dump, + UnloadedModule(const Dump& dump, uint64_t base_of_image, uint32_t size_of_image, - const String &name, + const String& name, uint32_t checksum = 0, uint32_t time_date_stamp = 1262805309); }; class Exception : public Stream { public: - Exception(const Dump &dump, - const Context &context, + Exception(const Dump& dump, + const Context& context, uint32_t thread_id = 0, uint32_t exception_code = 0, uint32_t exception_flags = 0, @@ -295,12 +295,12 @@ public: template<typename Element> class List: public Stream { public: - List(const Dump &dump, uint32_t type) : Stream(dump, type), count_(0) { + List(const Dump& dump, uint32_t type) : Stream(dump, type), count_(0) { D32(count_label_); } // Add ELEMENT to this list. - void Add(Element *element) { + void Add(Element* element) { element->Finish(file_offset_ + Size()); Append(*element); count_++; @@ -311,7 +311,7 @@ class List: public Stream { // Finish up the contents of this section, mark it as having been // placed at OFFSET. - virtual void Finish(const Label &offset) { + virtual void Finish(const Label& offset) { Stream::Finish(offset); count_label_ = count_; } @@ -322,14 +322,14 @@ class List: public Stream { protected: // This constructor allows derived lists to specify their own layout // rather than starting with count as specified in the public constructor. - List(const Dump &dump, uint32_t type, bool) : Stream(dump, type), count_(0) {} + List(const Dump& dump, uint32_t type, bool) : Stream(dump, type), count_(0) {} Label count_label_; }; class UnloadedModuleList : public List<UnloadedModule> { public: - UnloadedModuleList(const Dump &dump, uint32_t type); + UnloadedModuleList(const Dump& dump, uint32_t type); }; class Dump: public test_assembler::Section { @@ -349,12 +349,12 @@ class Dump: public test_assembler::Section { // whatever directory or list is appropriate for its type. The // stream directory, memory list, thread list, and module list are // accumulated this way. - Dump &Add(SynthMinidump::Section *object); // simply append data - Dump &Add(Stream *object); // append, record in stream directory - Dump &Add(Memory *object); // append, record in memory list - Dump &Add(Thread *object); // append, record in thread list - Dump &Add(Module *object); // append, record in module list - Dump &Add(UnloadedModule *object); // append, record in unloaded module list + Dump& Add(SynthMinidump::Section* object); // simply append data + Dump& Add(Stream* object); // append, record in stream directory + Dump& Add(Memory* object); // append, record in memory list + Dump& Add(Thread* object); // append, record in thread list + Dump& Add(Module* object); // append, record in module list + Dump& Add(UnloadedModule* object); // append, record in unloaded module list // Complete the construction of the minidump, given the Add calls // we've seen up to this point. After this call, this Dump's @@ -367,26 +367,26 @@ class Dump: public test_assembler::Section { Label file_start_; // The stream directory. We construct this incrementally from - // Add(Stream *) calls. + // Add(Stream*) calls. SynthMinidump::Section stream_directory_; // The directory's contents. size_t stream_count_; // The number of streams so far. Label stream_count_label_; // Cited in file header. Label stream_directory_rva_; // The directory's file offset. // This minidump's thread list. We construct this incrementally from - // Add(Thread *) calls. + // Add(Thread*) calls. List<Thread> thread_list_; // This minidump's module list. We construct this incrementally from - // Add(Module *) calls. + // Add(Module*) calls. List<Module> module_list_; // This minidump's unloaded module list. We construct this incrementally from - // Add(UnloadedModule *) calls. + // Add(UnloadedModule*) calls. UnloadedModuleList unloaded_module_list_; // This minidump's memory list. We construct this incrementally from - // Add(Memory *) calls. This is actually a list of MDMemoryDescriptors, + // Add(Memory*) calls. This is actually a list of MDMemoryDescriptors, // not memory ranges --- thus the odd type. List<SynthMinidump::Section> memory_list_; }; diff --git a/src/processor/testdata/linux_test_app.cc b/src/processor/testdata/linux_test_app.cc index 18f0f62f..9df6dccc 100644 --- a/src/processor/testdata/linux_test_app.cc +++ b/src/processor/testdata/linux_test_app.cc @@ -51,8 +51,8 @@ namespace { // google_breakpad::MinidumpCallback to invoke after minidump generation. -static bool callback(const char *dump_path, const char *id, - void *context, +static bool callback(const char* dump_path, const char* id, + void* context, bool succeeded) { if (succeeded) { printf("dump guid is %s\n", id); @@ -65,13 +65,13 @@ static bool callback(const char *dump_path, const char *id, } static void CrashFunction() { - int *i = reinterpret_cast<int*>(0x45); + int* i = reinterpret_cast<int*>(0x45); *i = 5; // crash! } } // namespace -int main(int argc, char **argv) { +int main(int argc, char** argv) { google_breakpad::ExceptionHandler eh(".", NULL, callback, NULL, true); if (!eh.WriteMinidump()) { printf("Failed to generate on-demand minidump\n"); diff --git a/src/processor/testdata/test_app.cc b/src/processor/testdata/test_app.cc index 7882a8bd..c744a37a 100644 --- a/src/processor/testdata/test_app.cc +++ b/src/processor/testdata/test_app.cc @@ -38,9 +38,9 @@ namespace { -static bool callback(const wchar_t *dump_path, const wchar_t *id, - void *context, EXCEPTION_POINTERS *exinfo, - MDRawAssertionInfo *assertion, +static bool callback(const wchar_t* dump_path, const wchar_t* id, + void* context, EXCEPTION_POINTERS* exinfo, + MDRawAssertionInfo* assertion, bool succeeded) { if (succeeded) { printf("dump guid is %ws\n", id); @@ -53,13 +53,13 @@ static bool callback(const wchar_t *dump_path, const wchar_t *id, } static void CrashFunction() { - int *i = reinterpret_cast<int*>(0x45); + int* i = reinterpret_cast<int*>(0x45); *i = 5; // crash! } } // namespace -int main(int argc, char **argv) { +int main(int argc, char** argv) { google_breakpad::ExceptionHandler eh( L".", NULL, callback, NULL, google_breakpad::ExceptionHandler::HANDLER_ALL); diff --git a/src/processor/tokenize.cc b/src/processor/tokenize.cc index 8fce87a2..29e8125a 100644 --- a/src/processor/tokenize.cc +++ b/src/processor/tokenize.cc @@ -42,10 +42,10 @@ namespace google_breakpad { using std::vector; -bool Tokenize(char *line, - const char *separators, - int max_tokens, - vector<char*> *tokens) { +bool Tokenize(char* line, + const char* separators, + int max_tokens, + vector<char*>* tokens) { tokens->clear(); tokens->reserve(max_tokens); @@ -53,8 +53,8 @@ bool Tokenize(char *line, // Split tokens on the separator character. // strip them out before exhausting max_tokens. - char *save_ptr; - char *token = strtok_r(line, separators, &save_ptr); + char* save_ptr; + char* token = strtok_r(line, separators, &save_ptr); while (token && --remaining > 0) { tokens->push_back(token); if (remaining > 1) @@ -69,10 +69,9 @@ bool Tokenize(char *line, return tokens->size() == static_cast<unsigned int>(max_tokens); } -void StringToVector(const string &str, vector<char> &vec) { +void StringToVector(const string& str, vector<char>& vec) { vec.resize(str.length() + 1); - std::copy(str.begin(), str.end(), - vec.begin()); + std::copy(str.begin(), str.end(), vec.begin()); vec[str.length()] = '\0'; } diff --git a/src/processor/tokenize.h b/src/processor/tokenize.h index 9ff571d5..c4480aa8 100644 --- a/src/processor/tokenize.h +++ b/src/processor/tokenize.h @@ -50,13 +50,13 @@ namespace google_breakpad { // Tokenize, but may be treated as a failure if the caller expects an // exact, as opposed to maximum, number of tokens. -bool Tokenize(char *line, - const char *separators, +bool Tokenize(char* line, + const char* separators, int max_tokens, - std::vector<char*> *tokens); + std::vector<char*>* tokens); // For convenience, since you need a char* to pass to Tokenize. // You can call StringToVector on a string, and use &vec[0]. -void StringToVector(const string &str, std::vector<char> &vec); +void StringToVector(const string& str, std::vector<char>& vec); } // namespace google_breakpad diff --git a/src/processor/windows_frame_info.h b/src/processor/windows_frame_info.h index f96e0a43..993832ad 100644 --- a/src/processor/windows_frame_info.h +++ b/src/processor/windows_frame_info.h @@ -113,9 +113,9 @@ struct WindowsFrameInfo { // otherwise. type, rva and code_size are present in the STACK line, // but not the StackFrameInfo structure, so return them as outparams. static WindowsFrameInfo *ParseFromString(const string string, - int &type, - uint64_t &rva, - uint64_t &code_size) { + int& type, + uint64_t& rva, + uint64_t& code_size) { // The format of a STACK WIN record is documented at: // // https://chromium.googlesource.com/breakpad/breakpad/+/master/docs/symbol_files.md @@ -160,7 +160,7 @@ struct WindowsFrameInfo { } // CopyFrom makes "this" WindowsFrameInfo object identical to "that". - void CopyFrom(const WindowsFrameInfo &that) { + void CopyFrom(const WindowsFrameInfo& that) { type_ = that.type_; valid = that.valid; prolog_size = that.prolog_size; |