aboutsummaryrefslogtreecommitdiff
path: root/src/client/mac/handler/minidump_generator.h
diff options
context:
space:
mode:
authorted.mielczarek@gmail.com <ted.mielczarek@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-12-15 21:55:56 +0000
committerted.mielczarek@gmail.com <ted.mielczarek@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-12-15 21:55:56 +0000
commit0344a368deac6abaa280a298bcea9bb00a90df3f (patch)
tree48245f419549c51163ea1cffdc9ba35989001485 /src/client/mac/handler/minidump_generator.h
parentAllow writing on-request minidumps with an exception stream (diff)
downloadbreakpad-0344a368deac6abaa280a298bcea9bb00a90df3f.tar.xz
Allow out-of-process minidump generation to work on processes of a different CPU architecture
R=mark at http://breakpad.appspot.com/241001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@746 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/mac/handler/minidump_generator.h')
-rw-r--r--src/client/mac/handler/minidump_generator.h50
1 files changed, 29 insertions, 21 deletions
diff --git a/src/client/mac/handler/minidump_generator.h b/src/client/mac/handler/minidump_generator.h
index 39f28402..224ad1c2 100644
--- a/src/client/mac/handler/minidump_generator.h
+++ b/src/client/mac/handler/minidump_generator.h
@@ -47,25 +47,8 @@ namespace google_breakpad {
using std::string;
-#if TARGET_CPU_X86_64 || TARGET_CPU_PPC64
-#define TOP_OF_THREAD0_STACK 0x00007fff5fbff000
-#else
-#define TOP_OF_THREAD0_STACK 0xbffff000
-#endif
-
-#if TARGET_CPU_X86_64
-typedef x86_thread_state64_t breakpad_thread_state_t;
-typedef MDRawContextAMD64 MinidumpContext;
-#elif TARGET_CPU_X86
-typedef i386_thread_state_t breakpad_thread_state_t;
-typedef MDRawContextX86 MinidumpContext;
-#elif TARGET_CPU_PPC64
-typedef ppc_thread_state64_t breakpad_thread_state_t;
-typedef MDRawContextPPC64 MinidumpContext;
-#elif TARGET_CPU_PPC
-typedef ppc_thread_state_t breakpad_thread_state_t;
-typedef MDRawContextPPC MinidumpContext;
-#endif
+const u_int64_t TOP_OF_THREAD0_STACK_64BIT = 0x00007fff5fbff000LL;
+const u_int32_t TOP_OF_THREAD0_STACK_32BIT = 0xbffff000;
// Use the REGISTER_FROM_THREADSTATE to access a register name from the
// breakpad_thread_state_t structure.
@@ -129,6 +112,8 @@ class MinidumpGenerator {
// Helpers
u_int64_t CurrentPCForStack(breakpad_thread_state_data_t state);
+ bool GetThreadState(thread_act_t target_thread, thread_state_t state,
+ mach_msg_type_number_t *count);
bool WriteStackFromStartAddress(mach_vm_address_t start_addr,
MDMemoryDescriptor *stack_location);
bool WriteStack(breakpad_thread_state_data_t state,
@@ -139,11 +124,31 @@ class MinidumpGenerator {
bool WriteCVRecord(MDRawModule *module, int cpu_type,
const char *module_path);
bool WriteModuleStream(unsigned int index, MDRawModule *module);
-
size_t CalculateStackSize(mach_vm_address_t start_addr);
-
int FindExecutableModule();
+ // Per-CPU implementations of these methods
+ bool WriteStackPPC(breakpad_thread_state_data_t state,
+ MDMemoryDescriptor *stack_location);
+ bool WriteContextPPC(breakpad_thread_state_data_t state,
+ MDLocationDescriptor *register_location);
+ u_int64_t CurrentPCForStackPPC(breakpad_thread_state_data_t state);
+ bool WriteStackPPC64(breakpad_thread_state_data_t state,
+ MDMemoryDescriptor *stack_location);
+ bool WriteContextPPC64(breakpad_thread_state_data_t state,
+ MDLocationDescriptor *register_location);
+ u_int64_t CurrentPCForStackPPC64(breakpad_thread_state_data_t state);
+ bool WriteStackX86(breakpad_thread_state_data_t state,
+ MDMemoryDescriptor *stack_location);
+ bool WriteContextX86(breakpad_thread_state_data_t state,
+ MDLocationDescriptor *register_location);
+ u_int64_t CurrentPCForStackX86(breakpad_thread_state_data_t state);
+ bool WriteStackX86_64(breakpad_thread_state_data_t state,
+ MDMemoryDescriptor *stack_location);
+ bool WriteContextX86_64(breakpad_thread_state_data_t state,
+ MDLocationDescriptor *register_location);
+ u_int64_t CurrentPCForStackX86_64(breakpad_thread_state_data_t state);
+
// disallow copy ctor and operator=
explicit MinidumpGenerator(const MinidumpGenerator &);
void operator=(const MinidumpGenerator &);
@@ -158,6 +163,9 @@ class MinidumpGenerator {
mach_port_t exception_thread_;
mach_port_t crashing_task_;
mach_port_t handler_thread_;
+
+ // CPU type of the task being dumped.
+ cpu_type_t cpu_type_;
// System information
static char build_string_[16];