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

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: Rework to handle arbitrary size build ids Created 4 years, 8 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 #if defined(__ANDROID__) 114 #if defined(__ANDROID__)
115 LatePostprocessMappings(); 115 LatePostprocessMappings();
116 #endif 116 #endif
117 return true; 117 return true;
118 } 118 }
119 119
120 bool 120 bool
121 LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping, 121 LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping,
122 bool member, 122 bool member,
123 unsigned int mapping_id, 123 unsigned int mapping_id,
124 uint8_t identifier[sizeof(MDGUID)]) { 124 wasteful_vector<uint8_t>& identifier) {
125 assert(!member || mapping_id < mappings_.size()); 125 assert(!member || mapping_id < mappings_.size());
126 my_memset(identifier, 0, sizeof(MDGUID));
127 if (IsMappedFileOpenUnsafe(mapping)) 126 if (IsMappedFileOpenUnsafe(mapping))
128 return false; 127 return false;
129 128
130 // Special-case linux-gate because it's not a real file. 129 // Special-case linux-gate because it's not a real file.
131 if (my_strcmp(mapping.name, kLinuxGateLibraryName) == 0) { 130 if (my_strcmp(mapping.name, kLinuxGateLibraryName) == 0) {
132 void* linux_gate = NULL; 131 void* linux_gate = NULL;
133 if (pid_ == sys_getpid()) { 132 if (pid_ == sys_getpid()) {
134 linux_gate = reinterpret_cast<void*>(mapping.start_addr); 133 linux_gate = reinterpret_cast<void*>(mapping.start_addr);
135 } else { 134 } else {
136 linux_gate = allocator_.Alloc(mapping.size); 135 linux_gate = allocator_.Alloc(mapping.size);
137 CopyFromProcess(linux_gate, pid_, 136 CopyFromProcess(linux_gate, pid_,
138 reinterpret_cast<const void*>(mapping.start_addr), 137 reinterpret_cast<const void*>(mapping.start_addr),
139 mapping.size); 138 mapping.size);
140 } 139 }
141 return FileID::ElfFileIdentifierFromMappedFile(linux_gate, identifier); 140 return FileID::ElfFileIdentifierFromMappedFile(linux_gate,
141 identifier);
142 } 142 }
143 143
144 char filename[PATH_MAX]; 144 char filename[PATH_MAX];
145 if (!GetMappingAbsolutePath(mapping, filename)) 145 if (!GetMappingAbsolutePath(mapping, filename))
146 return false; 146 return false;
147 bool filename_modified = HandleDeletedFileInMapping(filename); 147 bool filename_modified = HandleDeletedFileInMapping(filename);
148 148
149 MemoryMappedFile mapped_file(filename, mapping.offset); 149 MemoryMappedFile mapped_file(filename, mapping.offset);
150 if (!mapped_file.data() || mapped_file.size() < SELFMAG) 150 if (!mapped_file.data() || mapped_file.size() < SELFMAG)
151 return false; 151 return false;
152 152
153 bool success = 153 bool success =
154 FileID::ElfFileIdentifierFromMappedFile(mapped_file.data(), identifier); 154 FileID::ElfFileIdentifierFromMappedFile(mapped_file.data(),
155 identifier);
155 if (success && member && filename_modified) { 156 if (success && member && filename_modified) {
156 mappings_[mapping_id]->name[my_strlen(mapping.name) - 157 mappings_[mapping_id]->name[my_strlen(mapping.name) -
157 sizeof(kDeletedSuffix) + 1] = '\0'; 158 sizeof(kDeletedSuffix) + 1] = '\0';
158 } 159 }
159 160
160 return success; 161 return success;
161 } 162 }
162 163
163 bool LinuxDumper::GetMappingAbsolutePath(const MappingInfo& mapping, 164 bool LinuxDumper::GetMappingAbsolutePath(const MappingInfo& mapping,
164 char path[PATH_MAX]) const { 165 char path[PATH_MAX]) const {
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 exe_stat.st_dev == new_path_stat.st_dev && 598 exe_stat.st_dev == new_path_stat.st_dev &&
598 exe_stat.st_ino == new_path_stat.st_ino) { 599 exe_stat.st_ino == new_path_stat.st_ino) {
599 return false; 600 return false;
600 } 601 }
601 602
602 my_memcpy(path, exe_link, NAME_MAX); 603 my_memcpy(path, exe_link, NAME_MAX);
603 return true; 604 return true;
604 } 605 }
605 606
606 } // namespace google_breakpad 607 } // namespace google_breakpad
OLDNEW
« no previous file with comments | « src/client/linux/minidump_writer/linux_dumper.h ('k') | src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698