Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: src/client/linux/minidump_writer/linux_dumper.cc

Issue 1688743002: Switch the Linux minidump writer to use MDCVInfoELF for CV data. (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010, Google Inc. 1 // Copyright (c) 2010, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 #if defined(__ANDROID__) 112 #if defined(__ANDROID__)
113 LatePostprocessMappings(); 113 LatePostprocessMappings();
114 #endif 114 #endif
115 return true; 115 return true;
116 } 116 }
117 117
118 bool 118 bool
119 LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping, 119 LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping,
120 bool member, 120 bool member,
121 unsigned int mapping_id, 121 unsigned int mapping_id,
122 uint8_t identifier[sizeof(MDGUID)]) { 122 uint8_t identifier[kMaxBuildID],
123 size_t* identifier_length) {
123 assert(!member || mapping_id < mappings_.size()); 124 assert(!member || mapping_id < mappings_.size());
124 my_memset(identifier, 0, sizeof(MDGUID)); 125 assert(identifier_length);
126 my_memset(identifier, 0, kMaxBuildID);
125 if (IsMappedFileOpenUnsafe(mapping)) 127 if (IsMappedFileOpenUnsafe(mapping))
126 return false; 128 return false;
127 129
128 // Special-case linux-gate because it's not a real file. 130 // Special-case linux-gate because it's not a real file.
129 if (my_strcmp(mapping.name, kLinuxGateLibraryName) == 0) { 131 if (my_strcmp(mapping.name, kLinuxGateLibraryName) == 0) {
130 void* linux_gate = NULL; 132 void* linux_gate = NULL;
131 if (pid_ == sys_getpid()) { 133 if (pid_ == sys_getpid()) {
132 linux_gate = reinterpret_cast<void*>(mapping.start_addr); 134 linux_gate = reinterpret_cast<void*>(mapping.start_addr);
133 } else { 135 } else {
134 linux_gate = allocator_.Alloc(mapping.size); 136 linux_gate = allocator_.Alloc(mapping.size);
135 CopyFromProcess(linux_gate, pid_, 137 CopyFromProcess(linux_gate, pid_,
136 reinterpret_cast<const void*>(mapping.start_addr), 138 reinterpret_cast<const void*>(mapping.start_addr),
137 mapping.size); 139 mapping.size);
138 } 140 }
139 return FileID::ElfFileIdentifierFromMappedFile(linux_gate, identifier); 141 return FileID::ElfFileIdentifierFromMappedFile(linux_gate,
142 identifier,
143 identifier_length);
140 } 144 }
141 145
142 char filename[NAME_MAX]; 146 char filename[NAME_MAX];
143 size_t filename_len = my_strlen(mapping.name); 147 size_t filename_len = my_strlen(mapping.name);
144 if (filename_len >= NAME_MAX) { 148 if (filename_len >= NAME_MAX) {
145 assert(false); 149 assert(false);
146 return false; 150 return false;
147 } 151 }
148 my_memcpy(filename, mapping.name, filename_len); 152 my_memcpy(filename, mapping.name, filename_len);
149 filename[filename_len] = '\0'; 153 filename[filename_len] = '\0';
150 bool filename_modified = HandleDeletedFileInMapping(filename); 154 bool filename_modified = HandleDeletedFileInMapping(filename);
151 155
152 MemoryMappedFile mapped_file(filename, mapping.offset); 156 MemoryMappedFile mapped_file(filename, mapping.offset);
153 if (!mapped_file.data() || mapped_file.size() < SELFMAG) 157 if (!mapped_file.data() || mapped_file.size() < SELFMAG)
154 return false; 158 return false;
155 159
156 bool success = 160 bool success =
157 FileID::ElfFileIdentifierFromMappedFile(mapped_file.data(), identifier); 161 FileID::ElfFileIdentifierFromMappedFile(mapped_file.data(),
162 identifier,
163 identifier_length);
158 if (success && member && filename_modified) { 164 if (success && member && filename_modified) {
159 mappings_[mapping_id]->name[filename_len - 165 mappings_[mapping_id]->name[filename_len -
160 sizeof(kDeletedSuffix) + 1] = '\0'; 166 sizeof(kDeletedSuffix) + 1] = '\0';
161 } 167 }
162 168
163 return success; 169 return success;
164 } 170 }
165 171
166 namespace { 172 namespace {
167 bool ElfFileSoNameFromMappedFile( 173 bool ElfFileSoNameFromMappedFile(
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 exe_stat.st_dev == new_path_stat.st_dev && 602 exe_stat.st_dev == new_path_stat.st_dev &&
597 exe_stat.st_ino == new_path_stat.st_ino) { 603 exe_stat.st_ino == new_path_stat.st_ino) {
598 return false; 604 return false;
599 } 605 }
600 606
601 my_memcpy(path, exe_link, NAME_MAX); 607 my_memcpy(path, exe_link, NAME_MAX);
602 return true; 608 return true;
603 } 609 }
604 610
605 } // namespace google_breakpad 611 } // namespace google_breakpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698