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

Side by Side Diff: src/client/linux/handler/exception_handler_unittest.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
« no previous file with comments | « Makefile.in ('k') | src/client/linux/microdump_writer/microdump_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 27 matching lines...) Expand all
38 #if defined(__mips__) 38 #if defined(__mips__)
39 #include <sys/cachectl.h> 39 #include <sys/cachectl.h>
40 #endif 40 #endif
41 41
42 #include <string> 42 #include <string>
43 43
44 #include "breakpad_googletest_includes.h" 44 #include "breakpad_googletest_includes.h"
45 #include "client/linux/handler/exception_handler.h" 45 #include "client/linux/handler/exception_handler.h"
46 #include "client/linux/minidump_writer/minidump_writer.h" 46 #include "client/linux/minidump_writer/minidump_writer.h"
47 #include "common/linux/eintr_wrapper.h" 47 #include "common/linux/eintr_wrapper.h"
48 #include "common/linux/file_id.h"
49 #include "common/linux/ignore_ret.h" 48 #include "common/linux/ignore_ret.h"
50 #include "common/linux/linux_libc_support.h" 49 #include "common/linux/linux_libc_support.h"
51 #include "common/tests/auto_tempdir.h" 50 #include "common/tests/auto_tempdir.h"
52 #include "common/using_std_string.h" 51 #include "common/using_std_string.h"
53 #include "third_party/lss/linux_syscall_support.h" 52 #include "third_party/lss/linux_syscall_support.h"
54 #include "google_breakpad/processor/minidump.h" 53 #include "google_breakpad/processor/minidump.h"
55 54
56 using namespace google_breakpad; 55 using namespace google_breakpad;
57 56
58 namespace { 57 namespace {
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 // Test that anonymous memory maps can be annotated with names and IDs. 809 // Test that anonymous memory maps can be annotated with names and IDs.
811 TEST(ExceptionHandlerTest, ModuleInfo) { 810 TEST(ExceptionHandlerTest, ModuleInfo) {
812 // These are defined here so the parent can use them to check the 811 // These are defined here so the parent can use them to check the
813 // data from the minidump afterwards. 812 // data from the minidump afterwards.
814 const uint32_t kMemorySize = sysconf(_SC_PAGESIZE); 813 const uint32_t kMemorySize = sysconf(_SC_PAGESIZE);
815 const char* kMemoryName = "a fake module"; 814 const char* kMemoryName = "a fake module";
816 const uint8_t kModuleGUID[sizeof(MDGUID)] = { 815 const uint8_t kModuleGUID[sizeof(MDGUID)] = {
817 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 816 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
818 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF 817 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
819 }; 818 };
820 char module_identifier_buffer[kGUIDStringSize]; 819 const string module_identifier = "33221100554477668899AABBCCDDEEFF0";
821 FileID::ConvertIdentifierToString(kModuleGUID,
822 module_identifier_buffer,
823 sizeof(module_identifier_buffer));
824 string module_identifier(module_identifier_buffer);
825 // Strip out dashes
826 size_t pos;
827 while ((pos = module_identifier.find('-')) != string::npos) {
828 module_identifier.erase(pos, 1);
829 }
830 // And append a zero, because module IDs include an "age" field
831 // which is always zero on Linux.
832 module_identifier += "0";
833 820
834 // Get some memory. 821 // Get some memory.
835 char* memory = 822 char* memory =
836 reinterpret_cast<char*>(mmap(NULL, 823 reinterpret_cast<char*>(mmap(NULL,
837 kMemorySize, 824 kMemorySize,
838 PROT_READ | PROT_WRITE, 825 PROT_READ | PROT_WRITE,
839 MAP_PRIVATE | MAP_ANON, 826 MAP_PRIVATE | MAP_ANON,
840 -1, 827 -1,
841 0)); 828 0));
842 const uintptr_t kMemoryAddress = reinterpret_cast<uintptr_t>(memory); 829 const uintptr_t kMemoryAddress = reinterpret_cast<uintptr_t>(memory);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 EXPECT_EQ(child, static_cast<int32_t>(thread_id)); 1174 EXPECT_EQ(child, static_cast<int32_t>(thread_id));
1188 1175
1189 const MDRawExceptionStream* raw = exception->exception(); 1176 const MDRawExceptionStream* raw = exception->exception();
1190 ASSERT_TRUE(raw); 1177 ASSERT_TRUE(raw);
1191 EXPECT_EQ(MD_EXCEPTION_CODE_LIN_DUMP_REQUESTED, 1178 EXPECT_EQ(MD_EXCEPTION_CODE_LIN_DUMP_REQUESTED,
1192 raw->exception_record.exception_code); 1179 raw->exception_record.exception_code);
1193 1180
1194 close(fds[1]); 1181 close(fds[1]);
1195 unlink(minidump_filename.c_str()); 1182 unlink(minidump_filename.c_str());
1196 } 1183 }
OLDNEW
« no previous file with comments | « Makefile.in ('k') | src/client/linux/microdump_writer/microdump_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698