LEFT | RIGHT |
1 // Copyright (c) 2014, Google Inc. | 1 // Copyright (c) 2014, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 12 matching lines...) Expand all Loading... |
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 |
30 #include "client/linux/dump_writer_common/thread_info.h" | 30 #include "client/linux/dump_writer_common/thread_info.h" |
31 | 31 |
32 #include <string.h> | 32 #include <string.h> |
| 33 #include <assert.h> |
33 | 34 |
34 #include "common/linux/linux_libc_support.h" | 35 #include "common/linux/linux_libc_support.h" |
35 #include "google_breakpad/common/minidump_format.h" | 36 #include "google_breakpad/common/minidump_format.h" |
36 | 37 |
37 namespace { | 38 namespace { |
38 | 39 |
39 #if defined(__i386__) | 40 #if defined(__i386__) |
40 // Write a uint16_t to memory | 41 // Write a uint16_t to memory |
41 // out: memory location to write to | 42 // out: memory location to write to |
42 // v: value to write. | 43 // v: value to write. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 253 |
253 out->epc = mcontext.pc; | 254 out->epc = mcontext.pc; |
254 out->badvaddr = 0; // Not stored in mcontext | 255 out->badvaddr = 0; // Not stored in mcontext |
255 out->status = 0; // Not stored in mcontext | 256 out->status = 0; // Not stored in mcontext |
256 out->cause = 0; // Not stored in mcontext | 257 out->cause = 0; // Not stored in mcontext |
257 | 258 |
258 for (int i = 0; i < MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT; ++i) | 259 for (int i = 0; i < MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT; ++i) |
259 out->float_save.regs[i] = mcontext.fpregs.fp_r.fp_fregs[i]._fp_fregs; | 260 out->float_save.regs[i] = mcontext.fpregs.fp_r.fp_fregs[i]._fp_fregs; |
260 | 261 |
261 out->float_save.fpcsr = mcontext.fpc_csr; | 262 out->float_save.fpcsr = mcontext.fpc_csr; |
| 263 #if _MIPS_SIM == _ABIO32 |
262 out->float_save.fir = mcontext.fpc_eir; | 264 out->float_save.fir = mcontext.fpc_eir; |
| 265 #endif |
263 } | 266 } |
264 #endif // __mips__ | 267 #endif // __mips__ |
265 | 268 |
266 // Returns the pointer to general purpose register area. | 269 void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) { |
267 const void* ThreadInfo::GetGeneralPurposeRegisters() const { | 270 assert(gp_regs || size); |
268 #if defined(__mips__) | 271 #if defined(__mips__) |
269 return &mcontext.gregs; | 272 if (gp_regs) |
| 273 *gp_regs = mcontext.gregs; |
| 274 if (size) |
| 275 *size = sizeof(mcontext.gregs); |
270 #else | 276 #else |
271 return ®s; | 277 if (gp_regs) |
272 #endif | 278 *gp_regs = ®s; |
273 } | 279 if (size) |
274 | 280 *size = sizeof(regs); |
275 // Returns the size of general purpose register area. | 281 #endif |
276 size_t ThreadInfo::GetGeneralPurposeRegistersSize() const { | 282 } |
| 283 |
| 284 void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) { |
| 285 assert(fp_regs || size); |
277 #if defined(__mips__) | 286 #if defined(__mips__) |
278 return sizeof(mcontext.gregs); | 287 if (fp_regs) |
| 288 *fp_regs = &mcontext.fpregs; |
| 289 if (size) |
| 290 *size = sizeof(mcontext.fpregs); |
279 #else | 291 #else |
280 return sizeof(regs); | 292 if (fp_regs) |
281 #endif | 293 *fp_regs = &fpregs; |
282 } | 294 if (size) |
283 | 295 *size = sizeof(fpregs); |
284 // Returns the pointer to float point register area. | |
285 const void* ThreadInfo::GetFloatPointRegisters() const { | |
286 #if defined(__mips__) | |
287 return &mcontext.fpregs; | |
288 #else | |
289 return &fpregs; | |
290 #endif | |
291 } | |
292 | |
293 // Returns the size of float point register area. | |
294 size_t ThreadInfo::GetFloatPointRegistersSize() const { | |
295 #if defined(__mips__) | |
296 return sizeof(mcontext.fpregs); | |
297 #else | |
298 return sizeof(fpregs); | |
299 #endif | 296 #endif |
300 } | 297 } |
301 | 298 |
302 } // namespace google_breakpad | 299 } // namespace google_breakpad |
LEFT | RIGHT |