mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-01-05 05:58:24 +01:00
issue 372 - fix Mac OS X minidump generation code to handle x86-64 properly. r=mark at http://breakpad.appspot.com/103001
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@578 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
f2dfb88b2a
commit
131c0c6a83
6 changed files with 54 additions and 17 deletions
|
|
@ -36,7 +36,6 @@
|
|||
#include <mach-o/loader.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/resource.h>
|
||||
#include <mach/mach_vm.h>
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
|
|
@ -50,6 +49,12 @@ using MacStringUtils::IntegerValueAtIndex;
|
|||
|
||||
namespace google_breakpad {
|
||||
|
||||
#if __LP64__
|
||||
#define LC_SEGMENT_ARCH LC_SEGMENT_64
|
||||
#else
|
||||
#define LC_SEGMENT_ARCH LC_SEGMENT
|
||||
#endif
|
||||
|
||||
// constructor when generating from within the crashed process
|
||||
MinidumpGenerator::MinidumpGenerator()
|
||||
: exception_type_(0),
|
||||
|
|
@ -615,8 +620,10 @@ bool MinidumpGenerator::WriteSystemInfoStream(
|
|||
info_ptr->processor_architecture = MD_CPU_ARCHITECTURE_PPC;
|
||||
break;
|
||||
case CPU_TYPE_I386:
|
||||
info_ptr->processor_architecture = MD_CPU_ARCHITECTURE_X86;
|
||||
case CPU_TYPE_X86_64:
|
||||
// hw.cputype is currently always I386 even on an x86-64 system
|
||||
#ifdef __i386__
|
||||
info_ptr->processor_architecture = MD_CPU_ARCHITECTURE_X86;
|
||||
// ebx is used for PIC code, so we need
|
||||
// to preserve it.
|
||||
#define cpuid(op,eax,ebx,ecx,edx) \
|
||||
|
|
@ -629,6 +636,18 @@ bool MinidumpGenerator::WriteSystemInfoStream(
|
|||
"=c" (ecx), \
|
||||
"=d" (edx) \
|
||||
: "0" (op))
|
||||
#elif defined(__x86_64__)
|
||||
info_ptr->processor_architecture = MD_CPU_ARCHITECTURE_AMD64;
|
||||
#define cpuid(op,eax,ebx,ecx,edx) \
|
||||
asm ("cpuid \n\t" \
|
||||
: "=a" (eax), \
|
||||
"=b" (ebx), \
|
||||
"=c" (ecx), \
|
||||
"=d" (edx) \
|
||||
: "0" (op))
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
int unused, unused2;
|
||||
// get vendor id
|
||||
cpuid(0, unused, info_ptr->cpu.x86_cpu_info.vendor_id[0],
|
||||
|
|
@ -659,7 +678,7 @@ bool MinidumpGenerator::WriteSystemInfoStream(
|
|||
((info_ptr->cpu.x86_cpu_info.version_information & 0xFF00000) >> 20);
|
||||
}
|
||||
|
||||
#endif // __i386__
|
||||
#endif // __i386__ || __x86_64_
|
||||
break;
|
||||
default:
|
||||
info_ptr->processor_architecture = MD_CPU_ARCHITECTURE_UNKNOWN;
|
||||
|
|
@ -763,7 +782,7 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index,
|
|||
memset(module, 0, sizeof(MDRawModule));
|
||||
|
||||
for (unsigned int i = 0; cmd && (i < header->ncmds); i++) {
|
||||
if (cmd->cmd == LC_SEGMENT) {
|
||||
if (cmd->cmd == LC_SEGMENT_ARCH) {
|
||||
|
||||
const breakpad_mach_segment_command *seg =
|
||||
reinterpret_cast<const breakpad_mach_segment_command *>(cmd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue