Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(34)

Unified Diff: src/client/mac/handler/minidump_generator.cc

Issue 103001: Fix dump generation on 64-bit Mac OS X (Closed) Base URL: http://google-breakpad.googlecode.com/svn/trunk/
Patch Set: Updated with mark's comments Created 14 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/client/mac/Breakpad.xcodeproj/project.pbxproj ('k') | src/common/mac/macho_utilities.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/client/mac/handler/minidump_generator.cc
===================================================================
--- src/client/mac/handler/minidump_generator.cc (revision 577)
+++ src/client/mac/handler/minidump_generator.cc (working copy)
@@ -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 @@
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 @@
info_ptr->processor_architecture = MD_CPU_ARCHITECTURE_PPC;
break;
case CPU_TYPE_I386:
+ 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;
-#ifdef __i386__
// ebx is used for PIC code, so we need
// to preserve it.
#define cpuid(op,eax,ebx,ecx,edx) \
@@ -629,6 +636,18 @@
"=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
Mark Mentovai 2010/04/29 17:56:27 Here is where you might consider placing an #error
+
+#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 @@
((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 @@
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);
« no previous file with comments | « src/client/mac/Breakpad.xcodeproj/project.pbxproj ('k') | src/common/mac/macho_utilities.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted