aboutsummaryrefslogtreecommitdiffstats
path: root/community/chromium/musl-fixes-breakpad.patch
blob: 2cbf88ca2037a7515fac56a76a0744d0a905c4ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
index 052ce37..95b0fb4 100644
--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
+++ ./third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
@@ -49,7 +49,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
 }
 
 void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-                                    const struct _libc_fpstate* fp) {
+                                    const struct _fpstate* fp) {
   const greg_t* regs = uc->uc_mcontext.gregs;
 
   out->context_flags = MD_CONTEXT_X86_FULL |
@@ -97,7 +97,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
 }
 
 void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-                                    const struct _libc_fpstate* fpregs) {
+                                    const struct _fpstate* fpregs) {
   const greg_t* regs = uc->uc_mcontext.gregs;
 
   out->context_flags = MD_CONTEXT_AMD64_FULL;
diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
index 2de80b7..4cf1377 100644
--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
+++ ./third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
@@ -50,7 +50,7 @@ struct UContextReader {
   //   info: the collection of register structures.
 #if defined(__i386__) || defined(__x86_64)
   static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-                             const struct _libc_fpstate* fp);
+                             const struct _fpstate* fp);
 #elif defined(__aarch64__)
   static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
                              const struct fpsimd_context* fpregs);
diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
index d1dc331..d1cc562 100644
--- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
+++ ./third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
@@ -48,7 +48,7 @@ class ExceptionHandler;
 #if defined(__aarch64__)
 typedef struct fpsimd_context fpstate_t;
 #elif !defined(__ARM_EABI__) && !defined(__mips__)
-typedef struct _libc_fpstate fpstate_t;
+typedef struct _fpstate fpstate_t;
 #endif
 
 // These entries store a list of memory regions that the client wants included
--- ./breakpad/src/common/linux/elf_core_dump.h.orig
+++ ./third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
@@ -36,6 +36,7 @@
 #include <elf.h>
 #include <link.h>
 #include <stddef.h>
+#include <limits.h>
 
 #include "common/memory_range.h"
 
@@ -51,9 +52,9 @@
   typedef ElfW(Phdr) Phdr;
   typedef ElfW(Word) Word;
   typedef ElfW(Addr) Addr;
-#if __WORDSIZE == 32
+#if ULONG_MAX == 0xffffffff
   static const int kClass = ELFCLASS32;
-#elif __WORDSIZE == 64
+#elif ULONG_MAX == 0xffffffffffffffff
   static const int kClass = ELFCLASS64;
 #else
 #error "Unsupported __WORDSIZE for ElfCoreDump."
--- ./third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc.orig
+++ ./third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
@@ -495,7 +495,9 @@
   siginfo.si_code = SI_USER;
   siginfo.si_pid = getpid();
   ucontext_t context;
+#if defined(__GLIBC__)
   getcontext(&context);
+#endif
   return HandleSignal(sig, &siginfo, &context);
 }
 
@@ -680,9 +682,14 @@
   sys_prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
 
   CrashContext context;
+
+#if defined(__GLIBC__)
   int getcontext_result = getcontext(&context.context);
   if (getcontext_result)
     return false;
+#else
+  return false;
+#endif
 
 #if defined(__i386__)
   // In CPUFillFromUContext in minidumpwriter.cc the stack pointer is retrieved