CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
chromium: updated to 62.0.32.02.75
[ports/opt-arm.git] / chromium / breakpad-use-ucontext_t.patch
CommitLineData
5cd4e9ca
VM
1From b6a312ed8e144a37da840ae50dbd39df5ffb7e9f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 2 Jul 2017 16:34:54 -0700
4Subject: [PATCH 2/2] replace struct ucontext with ucontext_t
5
6glibc 2.26 does not expose struct ucontext any longer
7
8Upstream-Status: Pending
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 .../linux/dump_writer_common/ucontext_reader.cc | 30 +++++++++++-----------
13 .../linux/dump_writer_common/ucontext_reader.h | 10 ++++----
14 .../src/client/linux/handler/exception_handler.cc | 8 +++---
15 .../src/client/linux/handler/exception_handler.h | 2 +-
16 .../linux/microdump_writer/microdump_writer.cc | 2 +-
17 .../linux/minidump_writer/minidump_writer.cc | 2 +-
18 6 files changed, 27 insertions(+), 27 deletions(-)
19
20diff --git a/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
21index c80724dd8..93b4d9f85 100644
22--- a/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
23+++ b/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
24@@ -40,15 +40,15 @@ namespace google_breakpad {
25
26 #if defined(__i386__)
27
28-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
29+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
30 return uc->uc_mcontext.gregs[REG_ESP];
31 }
32
33-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
34+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
35 return uc->uc_mcontext.gregs[REG_EIP];
36 }
37
38-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
39+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
40 const struct _libc_fpstate* fp) {
41 const greg_t* regs = uc->uc_mcontext.gregs;
42
43@@ -88,15 +88,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
44
45 #elif defined(__x86_64)
46
47-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
48+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
49 return uc->uc_mcontext.gregs[REG_RSP];
50 }
51
52-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
53+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
54 return uc->uc_mcontext.gregs[REG_RIP];
55 }
56
57-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
58+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
59 const struct _libc_fpstate* fpregs) {
60 const greg_t* regs = uc->uc_mcontext.gregs;
61
62@@ -145,15 +145,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
63
64 #elif defined(__ARM_EABI__)
65
66-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
67+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
68 return uc->uc_mcontext.arm_sp;
69 }
70
71-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
72+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
73 return uc->uc_mcontext.arm_pc;
74 }
75
76-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
77+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
78 out->context_flags = MD_CONTEXT_ARM_FULL;
79
80 out->iregs[0] = uc->uc_mcontext.arm_r0;
81@@ -184,15 +184,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
82
83 #elif defined(__aarch64__)
84
85-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
86+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
87 return uc->uc_mcontext.sp;
88 }
89
90-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
91+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
92 return uc->uc_mcontext.pc;
93 }
94
95-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
96+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
97 const struct fpsimd_context* fpregs) {
98 out->context_flags = MD_CONTEXT_ARM64_FULL;
99
100@@ -210,15 +210,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
101
102 #elif defined(__mips__)
103
104-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
105+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
106 return uc->uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP];
107 }
108
109-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
110+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
111 return uc->uc_mcontext.pc;
112 }
113
114-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
115+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
116 #if _MIPS_SIM == _ABI64
117 out->context_flags = MD_CONTEXT_MIPS64_FULL;
118 #elif _MIPS_SIM == _ABIO32
119diff --git a/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
120index b6e77b4b5..2369a9ad3 100644
121--- a/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
122+++ b/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
123@@ -41,21 +41,21 @@ namespace google_breakpad {
124
125 // Wraps platform-dependent implementations of accessors to ucontext structs.
126 struct UContextReader {
127- static uintptr_t GetStackPointer(const struct ucontext* uc);
128+ static uintptr_t GetStackPointer(const ucontext_t* uc);
129
130- static uintptr_t GetInstructionPointer(const struct ucontext* uc);
131+ static uintptr_t GetInstructionPointer(const ucontext_t* uc);
132
133 // Juggle a arch-specific ucontext into a minidump format
134 // out: the minidump structure
135 // info: the collection of register structures.
136 #if defined(__i386__) || defined(__x86_64)
137- static void FillCPUContext(RawContextCPU *out, const ucontext *uc,
138+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
139 const struct _libc_fpstate* fp);
140 #elif defined(__aarch64__)
141- static void FillCPUContext(RawContextCPU *out, const ucontext *uc,
142+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
143 const struct fpsimd_context* fpregs);
144 #else
145- static void FillCPUContext(RawContextCPU *out, const ucontext *uc);
146+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc);
147 #endif
148 };
149
150diff --git a/breakpad/src/client/linux/handler/exception_handler.cc b/breakpad/src/client/linux/handler/exception_handler.cc
151index b63f973b8..f2688acaf 100644
152--- a/breakpad/src/client/linux/handler/exception_handler.cc
153+++ b/breakpad/src/client/linux/handler/exception_handler.cc
154@@ -439,9 +439,9 @@ bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) {
155 // Fill in all the holes in the struct to make Valgrind happy.
156 memset(&g_crash_context_, 0, sizeof(g_crash_context_));
157 memcpy(&g_crash_context_.siginfo, info, sizeof(siginfo_t));
158- memcpy(&g_crash_context_.context, uc, sizeof(struct ucontext));
159+ memcpy(&g_crash_context_.context, uc, sizeof(ucontext_t));
160 #if defined(__aarch64__)
161- struct ucontext* uc_ptr = (struct ucontext*)uc;
162+ ucontext_t* uc_ptr = (ucontext_t*)uc;
163 struct fpsimd_context* fp_ptr =
164 (struct fpsimd_context*)&uc_ptr->uc_mcontext.__reserved;
165 if (fp_ptr->head.magic == FPSIMD_MAGIC) {
166@@ -452,7 +452,7 @@ bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) {
167 // FP state is not part of user ABI on ARM Linux.
168 // In case of MIPS Linux FP state is already part of struct ucontext
169 // and 'float_state' is not a member of CrashContext.
170- struct ucontext* uc_ptr = (struct ucontext*)uc;
171+ ucontext_t* uc_ptr = (ucontext_t*)uc;
172 if (uc_ptr->uc_mcontext.fpregs) {
173 memcpy(&g_crash_context_.float_state, uc_ptr->uc_mcontext.fpregs,
174 sizeof(g_crash_context_.float_state));
175@@ -476,7 +476,7 @@ bool ExceptionHandler::SimulateSignalDelivery(int sig) {
176 // ExceptionHandler::HandleSignal().
177 siginfo.si_code = SI_USER;
178 siginfo.si_pid = getpid();
179- struct ucontext context;
180+ ucontext_t context;
181 getcontext(&context);
182 return HandleSignal(sig, &siginfo, &context);
183 }
184diff --git a/breakpad/src/client/linux/handler/exception_handler.h b/breakpad/src/client/linux/handler/exception_handler.h
185index 591c31085..846df772f 100644
186--- a/breakpad/src/client/linux/handler/exception_handler.h
187+++ b/breakpad/src/client/linux/handler/exception_handler.h
188@@ -191,7 +191,7 @@ class ExceptionHandler {
189 struct CrashContext {
190 siginfo_t siginfo;
191 pid_t tid; // the crashing thread.
192- struct ucontext context;
193+ ucontext_t context;
194 #if !defined(__ARM_EABI__) && !defined(__mips__)
195 // #ifdef this out because FP state is not part of user ABI for Linux ARM.
196 // In case of MIPS Linux FP state is already part of struct
197diff --git a/breakpad/src/client/linux/microdump_writer/microdump_writer.cc b/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
198index 6f5b43559..a508667a0 100644
199--- a/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
200+++ b/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
201@@ -571,7 +571,7 @@ class MicrodumpWriter {
202
203 void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
204
205- const struct ucontext* const ucontext_;
206+ const ucontext_t* const ucontext_;
207 #if !defined(__ARM_EABI__) && !defined(__mips__)
208 const google_breakpad::fpstate_t* const float_state_;
209 #endif
210diff --git a/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
211index 86009b9f6..f2aec73d7 100644
212--- a/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
213+++ b/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
214@@ -1248,7 +1248,7 @@ class MinidumpWriter {
215 const int fd_; // File descriptor where the minidum should be written.
216 const char* path_; // Path to the file where the minidum should be written.
217
218- const struct ucontext* const ucontext_; // also from the signal handler
219+ const ucontext_t* const ucontext_; // also from the signal handler
220 #if !defined(__ARM_EABI__) && !defined(__mips__)
221 const google_breakpad::fpstate_t* const float_state_; // ditto
222 #endif
223--
2242.13.2
225