MCPcopy Create free account
hub / github.com/chromium/crashpad / WriteTestModule

Function WriteTestModule

snapshot/linux/test_modules.cc:32–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30namespace test {
31
32bool WriteTestModule(const base::FilePath& module_path,
33 const std::string& soname) {
34#if defined(ARCH_CPU_64_BITS)
35 using Ehdr = Elf64_Ehdr;
36 using Phdr = Elf64_Phdr;
37 using Shdr = Elf64_Shdr;
38 using Dyn = Elf64_Dyn;
39 using Sym = Elf64_Sym;
40 unsigned char elf_class = ELFCLASS64;
41#else
42 using Ehdr = Elf32_Ehdr;
43 using Phdr = Elf32_Phdr;
44 using Shdr = Elf32_Shdr;
45 using Dyn = Elf32_Dyn;
46 using Sym = Elf32_Sym;
47 unsigned char elf_class = ELFCLASS32;
48#endif
49
50 struct {
51 Ehdr ehdr;
52 struct {
53 Phdr load1;
54 Phdr load2;
55 Phdr dynamic;
56 Phdr gnu_stack;
57 } phdr_table;
58 struct {
59 Dyn hash;
60 Dyn strtab;
61 Dyn symtab;
62 Dyn strsz;
63 Dyn syment;
64 Dyn soname;
65 Dyn null;
66 } dynamic_array;
67 struct {
68 Elf32_Word nbucket;
69 Elf32_Word nchain;
70 Elf32_Word bucket;
71 Elf32_Word chain;
72 } hash_table;
73 char string_table[32];
74 struct {
75 } section_header_string_table;
76 struct {
77 Sym und_symbol;
78 } symbol_table;
79 struct {
80 Shdr null;
81 Shdr dynamic;
82 Shdr string_table;
83 Shdr section_header_string_table;
84 } shdr_table;
85 } module = {};
86
87 module.ehdr.e_ident[EI_MAG0] = ELFMAG0;
88 module.ehdr.e_ident[EI_MAG1] = ELFMAG1;
89 module.ehdr.e_ident[EI_MAG2] = ELFMAG2;

Callers 1

LoadTestModuleFunction · 0.85

Calls 4

LoggingRemoveFileFunction · 0.50
sizeMethod · 0.45
OpenMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected