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

Side by Side Diff: src/processor/microdump.cc

Issue 1678463002: Parse additional microdump GPU line in the format: G GL_VERSION|GL_VENDOR|GL_RENDERER. (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Sync 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) 2014 Google Inc. 1 // Copyright (c) 2014 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "processor/linked_ptr.h" 47 #include "processor/linked_ptr.h"
48 #include "processor/logging.h" 48 #include "processor/logging.h"
49 #include "processor/range_map-inl.h" 49 #include "processor/range_map-inl.h"
50 50
51 namespace { 51 namespace {
52 static const char kGoogleBreakpadKey[] = "google-breakpad"; 52 static const char kGoogleBreakpadKey[] = "google-breakpad";
53 static const char kMicrodumpBegin[] = "-----BEGIN BREAKPAD MICRODUMP-----"; 53 static const char kMicrodumpBegin[] = "-----BEGIN BREAKPAD MICRODUMP-----";
54 static const char kMicrodumpEnd[] = "-----END BREAKPAD MICRODUMP-----"; 54 static const char kMicrodumpEnd[] = "-----END BREAKPAD MICRODUMP-----";
55 static const char kOsKey[] = ": O "; 55 static const char kOsKey[] = ": O ";
56 static const char kCpuKey[] = ": C "; 56 static const char kCpuKey[] = ": C ";
57 static const char kGpuKey[] = ": G ";
57 static const char kMmapKey[] = ": M "; 58 static const char kMmapKey[] = ": M ";
58 static const char kStackKey[] = ": S "; 59 static const char kStackKey[] = ": S ";
59 static const char kStackFirstLineKey[] = ": S 0 "; 60 static const char kStackFirstLineKey[] = ": S 0 ";
60 static const char kArmArchitecture[] = "arm"; 61 static const char kArmArchitecture[] = "arm";
61 static const char kArm64Architecture[] = "arm64"; 62 static const char kArm64Architecture[] = "arm64";
63 static const char kGpuUnknown[] = "UNKNOWN";
62 64
63 template<typename T> 65 template<typename T>
64 T HexStrToL(const string& str) { 66 T HexStrToL(const string& str) {
65 uint64_t res = 0; 67 uint64_t res = 0;
66 std::istringstream ss(str); 68 std::istringstream ss(str);
67 ss >> std::hex >> res; 69 ss >> std::hex >> res;
68 return static_cast<T>(res); 70 return static_cast<T>(res);
69 } 71 }
70 72
71 std::vector<uint8_t> ParseHexBuf(const string& str) { 73 std::vector<uint8_t> ParseHexBuf(const string& str) {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 std::cerr << "Malformed CPU context. Got " << cpu_state_raw.size() << 287 std::cerr << "Malformed CPU context. Got " << cpu_state_raw.size() <<
286 " bytes instead of " << sizeof(MDRawContextARM64) << std::endl; 288 " bytes instead of " << sizeof(MDRawContextARM64) << std::endl;
287 continue; 289 continue;
288 } 290 }
289 MDRawContextARM64* arm = new MDRawContextARM64(); 291 MDRawContextARM64* arm = new MDRawContextARM64();
290 memcpy(arm, &cpu_state_raw[0], cpu_state_raw.size()); 292 memcpy(arm, &cpu_state_raw[0], cpu_state_raw.size());
291 context_->SetContextARM64(arm); 293 context_->SetContextARM64(arm);
292 } else { 294 } else {
293 std::cerr << "Unsupported architecture: " << arch << std::endl; 295 std::cerr << "Unsupported architecture: " << arch << std::endl;
294 } 296 }
297 } else if ((pos = line.find(kGpuKey)) != string::npos) {
298 string gpu_str(line, pos + strlen(kGpuKey));
299 if (strcmp(gpu_str.c_str(), kGpuUnknown) != 0) {
300 std::istringstream gpu_tokens(gpu_str);
301 std::getline(gpu_tokens, system_info_->gl_version, '|');
302 std::getline(gpu_tokens, system_info_->gl_vendor, '|');
303 std::getline(gpu_tokens, system_info_->gl_renderer, '|');
304 }
295 } else if ((pos = line.find(kMmapKey)) != string::npos) { 305 } else if ((pos = line.find(kMmapKey)) != string::npos) {
296 string mmap_line(line, pos + strlen(kMmapKey)); 306 string mmap_line(line, pos + strlen(kMmapKey));
297 std::istringstream mmap_tokens(mmap_line); 307 std::istringstream mmap_tokens(mmap_line);
298 string addr, offset, size, identifier, filename; 308 string addr, offset, size, identifier, filename;
299 mmap_tokens >> addr; 309 mmap_tokens >> addr;
300 mmap_tokens >> offset; 310 mmap_tokens >> offset;
301 mmap_tokens >> size; 311 mmap_tokens >> size;
302 mmap_tokens >> identifier; 312 mmap_tokens >> identifier;
303 mmap_tokens >> filename; 313 mmap_tokens >> filename;
304 314
305 modules_->Add(new BasicCodeModule( 315 modules_->Add(new BasicCodeModule(
306 HexStrToL<uint64_t>(addr), // base_address 316 HexStrToL<uint64_t>(addr), // base_address
307 HexStrToL<uint64_t>(size), // size 317 HexStrToL<uint64_t>(size), // size
308 filename, // code_file 318 filename, // code_file
309 identifier, // code_identifier 319 identifier, // code_identifier
310 filename, // debug_file 320 filename, // debug_file
311 identifier, // debug_identifier 321 identifier, // debug_identifier
312 "")); // version 322 "")); // version
313 } 323 }
314 } 324 }
315 stack_region_->Init(stack_start, stack_content); 325 stack_region_->Init(stack_start, stack_content);
316 } 326 }
317 327
318 } // namespace google_breakpad 328 } // namespace google_breakpad
319 329
OLDNEW
« no previous file with comments | « src/google_breakpad/processor/system_info.h ('k') | src/processor/microdump_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698