OLD | NEW |
---|---|
1 // Copyright (c) 2009, Google Inc. | 1 // Copyright (c) 2009, 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 24 matching lines...) Expand all Loading... | |
35 #include <sys/user.h> | 35 #include <sys/user.h> |
36 #include <linux/limits.h> | 36 #include <linux/limits.h> |
37 | 37 |
38 #include "common/linux/memory.h" | 38 #include "common/linux/memory.h" |
39 | 39 |
40 namespace google_breakpad { | 40 namespace google_breakpad { |
41 | 41 |
42 typedef typeof(((struct user*) 0)->u_debugreg[0]) debugreg_t; | 42 typedef typeof(((struct user*) 0)->u_debugreg[0]) debugreg_t; |
43 | 43 |
44 // Typedef for our parsing of the auxv variables in /proc/pid/auxv. | 44 // Typedef for our parsing of the auxv variables in /proc/pid/auxv. |
45 #if defined(__i386) | 45 #if defined(__i386) || defined(__ARM_EABI__) |
46 typedef Elf32_auxv_t elf_aux_entry; | 46 typedef Elf32_auxv_t elf_aux_entry; |
47 #elif defined(__x86_64__) | 47 #elif defined(__x86_64__) |
48 typedef Elf64_auxv_t elf_aux_entry; | 48 typedef Elf64_auxv_t elf_aux_entry; |
49 #endif | 49 #endif |
50 // When we find the VDSO mapping in the process's address space, this | 50 // When we find the VDSO mapping in the process's address space, this |
51 // is the name we use for it when writing it to the minidump. | 51 // is the name we use for it when writing it to the minidump. |
52 // This should always be less than NAME_MAX! | 52 // This should always be less than NAME_MAX! |
53 const char kLinuxGateLibraryName[] = "linux-gate.so"; | 53 const char kLinuxGateLibraryName[] = "linux-gate.so"; |
54 | 54 |
55 // We produce one of these structures for each thread in the crashed process. | 55 // We produce one of these structures for each thread in the crashed process. |
56 struct ThreadInfo { | 56 struct ThreadInfo { |
57 pid_t tgid; // thread group id | 57 pid_t tgid; // thread group id |
58 pid_t ppid; // parent process | 58 pid_t ppid; // parent process |
59 | 59 |
60 // Even on platforms where the stack grows down, the following will point to | 60 // Even on platforms where the stack grows down, the following will point to |
61 // the smallest address in the stack. | 61 // the smallest address in the stack. |
62 const void* stack; // pointer to the stack area | 62 const void* stack; // pointer to the stack area |
63 size_t stack_len; // length of the stack to copy | 63 size_t stack_len; // length of the stack to copy |
64 | 64 |
65 #if defined(__i386) || defined(__x86_64) | |
65 user_regs_struct regs; | 66 user_regs_struct regs; |
66 user_fpregs_struct fpregs; | 67 user_fpregs_struct fpregs; |
67 #if defined(__i386) || defined(__x86_64) | |
68 user_fpxregs_struct fpxregs; | 68 user_fpxregs_struct fpxregs; |
69 | |
Ted Mielczarek
2010/02/05 16:54:41
Somewhere along the way this got broken, this line
| |
70 static const unsigned kNumDebugRegisters = 8; | 69 static const unsigned kNumDebugRegisters = 8; |
71 debugreg_t dregs[8]; | 70 debugreg_t dregs[8]; |
71 #elif defined(__ARM_EABI__) | |
72 // Mimicking how strace does this(see syscall.c, search for GETREGS) | |
73 struct user_regs regs; | |
74 struct user_fpregs fpregs; | |
72 #endif | 75 #endif |
73 }; | 76 }; |
74 | 77 |
75 // One of these is produced for each mapping in the process (i.e. line in | 78 // One of these is produced for each mapping in the process (i.e. line in |
76 // /proc/$x/maps). | 79 // /proc/$x/maps). |
77 struct MappingInfo { | 80 struct MappingInfo { |
78 uintptr_t start_addr; | 81 uintptr_t start_addr; |
79 size_t size; | 82 size_t size; |
80 size_t offset; // offset into the backed file. | 83 size_t offset; // offset into the backed file. |
81 char name[NAME_MAX]; | 84 char name[NAME_MAX]; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 // is the safest way to go.) | 128 // is the safest way to go.) |
126 void* FindBeginningOfLinuxGateSharedLibrary(const pid_t pid) const; | 129 void* FindBeginningOfLinuxGateSharedLibrary(const pid_t pid) const; |
127 private: | 130 private: |
128 bool EnumerateMappings(wasteful_vector<MappingInfo*>* result) const; | 131 bool EnumerateMappings(wasteful_vector<MappingInfo*>* result) const; |
129 bool EnumerateThreads(wasteful_vector<pid_t>* result) const; | 132 bool EnumerateThreads(wasteful_vector<pid_t>* result) const; |
130 | 133 |
131 const pid_t pid_; | 134 const pid_t pid_; |
132 | 135 |
133 mutable PageAllocator allocator_; | 136 mutable PageAllocator allocator_; |
134 | 137 |
135 bool threads_suspened_; | 138 bool threads_suspended_; |
136 wasteful_vector<pid_t> threads_; // the ids of all the threads | 139 wasteful_vector<pid_t> threads_; // the ids of all the threads |
137 wasteful_vector<MappingInfo*> mappings_; // info from /proc/<pid>/maps | 140 wasteful_vector<MappingInfo*> mappings_; // info from /proc/<pid>/maps |
138 }; | 141 }; |
139 | 142 |
140 } // namespace google_breakpad | 143 } // namespace google_breakpad |
141 | 144 |
142 #endif // CLIENT_LINUX_HANDLER_LINUX_DUMPER_H_ | 145 #endif // CLIENT_LINUX_HANDLER_LINUX_DUMPER_H_ |
OLD | NEW |