From 09b056975dacd1f0f815ad820b6dc9913b0118a3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 23 Jun 2020 18:55:43 -0400 Subject: fix pointer style to match the style guide We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine Reviewed-by: Mark Mentovai --- src/common/linux/dump_symbols.cc | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/common/linux/dump_symbols.cc') diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc index 997977b8..8ecf0bc4 100644 --- a/src/common/linux/dump_symbols.cc +++ b/src/common/linux/dump_symbols.cc @@ -144,7 +144,7 @@ class MmapWrapper { munmap(base_, size_); } } - void set(void *mapped_address, size_t mapped_size) { + void set(void* mapped_address, size_t mapped_size) { is_set_ = true; base_ = mapped_address; size_ = mapped_size; @@ -232,7 +232,7 @@ bool LoadStabs(const typename ElfClass::Ehdr* elf_header, // owned by a function) with the results. class DumperRangesHandler : public DwarfCUToModule::RangesHandler { public: - DumperRangesHandler(const uint8_t *buffer, uint64_t size, + DumperRangesHandler(const uint8_t* buffer, uint64_t size, dwarf2reader::ByteReader* reader) : buffer_(buffer), size_(size), reader_(reader) { } @@ -246,7 +246,7 @@ class DumperRangesHandler : public DwarfCUToModule::RangesHandler { } private: - const uint8_t *buffer_; + const uint8_t* buffer_; uint64_t size_; dwarf2reader::ByteReader* reader_; }; @@ -257,7 +257,7 @@ class DumperRangesHandler : public DwarfCUToModule::RangesHandler { class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler { public: // Create a line-to-module converter using BYTE_READER. - explicit DumperLineToModule(dwarf2reader::ByteReader *byte_reader) + explicit DumperLineToModule(dwarf2reader::ByteReader* byte_reader) : byte_reader_(byte_reader) { } void StartCompilationUnit(const string& compilation_dir) { compilation_dir_ = compilation_dir; @@ -278,7 +278,7 @@ class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler { } private: string compilation_dir_; - dwarf2reader::ByteReader *byte_reader_; + dwarf2reader::ByteReader* byte_reader_; }; template @@ -308,7 +308,7 @@ bool LoadDwarf(const string& dwarf_filename, string name = GetOffset(elf_header, section_names->sh_offset) + section->sh_name; - const uint8_t *contents = GetOffset(elf_header, + const uint8_t* contents = GetOffset(elf_header, section->sh_offset); file_context.AddSectionToSectionMap(name, contents, section->sh_size); } @@ -318,7 +318,7 @@ bool LoadDwarf(const string& dwarf_filename, dwarf2reader::SectionMap::const_iterator ranges_entry = file_context.section_map().find(".debug_ranges"); if (ranges_entry != file_context.section_map().end()) { - const std::pair& ranges_section = + const std::pair& ranges_section = ranges_entry->second; ranges_handler.reset( new DumperRangesHandler(ranges_section.first, ranges_section.second, @@ -330,7 +330,7 @@ bool LoadDwarf(const string& dwarf_filename, dwarf2reader::SectionMap::const_iterator debug_info_entry = file_context.section_map().find(".debug_info"); assert(debug_info_entry != file_context.section_map().end()); - const std::pair& debug_info_section = + const std::pair& debug_info_section = debug_info_entry->second; // This should never have been called if the file doesn't have a // .debug_info section. @@ -409,7 +409,7 @@ bool LoadDwarfCFI(const string& dwarf_filename, dwarf2reader::ENDIANNESS_BIG : dwarf2reader::ENDIANNESS_LITTLE; // Find the call frame information and its size. - const uint8_t *cfi = + const uint8_t* cfi = GetOffset(elf_header, section->sh_offset); size_t cfi_size = section->sh_size; @@ -497,13 +497,13 @@ bool IsSameFile(const char* left_abspath, const string& right_path) { // Read the .gnu_debuglink and get the debug file name. If anything goes // wrong, return an empty string. -string ReadDebugLink(const uint8_t *debuglink, +string ReadDebugLink(const uint8_t* debuglink, const size_t debuglink_size, const bool big_endian, const string& obj_file, const std::vector& debug_dirs) { // Include '\0' + CRC32 (4 bytes). - size_t debuglink_len = strlen(reinterpret_cast(debuglink)) + 5; + size_t debuglink_len = strlen(reinterpret_cast(debuglink)) + 5; debuglink_len = 4 * ((debuglink_len + 3) / 4); // Round up to 4 bytes. // Sanity check. @@ -525,7 +525,7 @@ string ReadDebugLink(const uint8_t *debuglink, for (it = debug_dirs.begin(); it < debug_dirs.end(); ++it) { const string& debug_dir = *it; debuglink_path = debug_dir + "/" + - reinterpret_cast(debuglink); + reinterpret_cast(debuglink); // There is the annoying case of /path/to/foo.so having foo.so as the // debug link file name. Thus this may end up opening /path/to/foo.so again, @@ -599,7 +599,7 @@ class LoadSymbolsInfo { // Keeps track of which sections have been loaded so sections don't // accidentally get loaded twice from two different files. - void LoadedSection(const string §ion) { + void LoadedSection(const string& section) { if (loaded_sections_.count(section) == 0) { loaded_sections_.insert(section); } else { @@ -610,7 +610,7 @@ class LoadSymbolsInfo { // The ELF file and linked debug file are expected to have the same preferred // loading address. - void set_loading_addr(Addr addr, const string &filename) { + void set_loading_addr(Addr addr, const string& filename) { if (!has_loading_addr_) { loading_addr_ = addr; loaded_file_ = filename; @@ -687,7 +687,7 @@ bool LoadSymbols(const string& obj_file, const Shdr* section_names = sections + elf_header->e_shstrndx; const char* names = GetOffset(elf_header, section_names->sh_offset); - const char *names_end = names + section_names->sh_size; + const char* names_end = names + section_names->sh_size; bool found_debug_info_section = false; bool found_usable_info = false; @@ -867,7 +867,7 @@ bool LoadSymbols(const string& obj_file, names_end, elf_header->e_shnum); if (gnu_debuglink_section) { if (!info->debug_dirs().empty()) { - const uint8_t *debuglink_contents = + const uint8_t* debuglink_contents = GetOffset(elf_header, gnu_debuglink_section->sh_offset); string debuglink_file = @@ -964,7 +964,7 @@ bool InitModuleForElfClass(const typename ElfClass::Ehdr* elf_header, return false; } - const char *architecture = ElfArchitecture(elf_header); + const char* architecture = ElfArchitecture(elf_header); if (!architecture) { fprintf(stderr, "%s: unrecognized ELF machine architecture: %d\n", obj_filename.c_str(), elf_header->e_machine); @@ -1074,12 +1074,12 @@ bool ReadSymbolDataInternal(const uint8_t* obj_file, return false; } -bool WriteSymbolFile(const string &load_path, - const string &obj_file, - const string &obj_os, +bool WriteSymbolFile(const string& load_path, + const string& obj_file, + const string& obj_os, const std::vector& debug_dirs, const DumpOptions& options, - std::ostream &sym_stream) { + std::ostream& sym_stream) { Module* module; if (!ReadSymbolData(load_path, obj_file, obj_os, debug_dirs, options, &module)) @@ -1096,7 +1096,7 @@ bool WriteSymbolFile(const string &load_path, bool WriteSymbolFileHeader(const string& load_path, const string& obj_file, const string& obj_os, - std::ostream &sym_stream) { + std::ostream& sym_stream) { MmapWrapper map_wrapper; void* elf_header = NULL; if (!LoadELF(load_path, &map_wrapper, &elf_header)) { -- cgit v1.2.1