12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #if defined(__sparc__)
- #if defined(__arch64__) || defined(__sparcv9)
- #define STACK_BIAS 2047
- #else
- #define STACK_BIAS 0
- #endif
- #include "sanitizer_common.h"
- #include "sanitizer_stacktrace.h"
- namespace __sanitizer {
- void BufferedStackTrace::UnwindFast(uptr pc, uptr bp, uptr stack_top,
- uptr stack_bottom, u32 max_depth) {
-
- CHECK_GE(max_depth, 2);
- const uptr kPageSize = GetPageSizeCached();
- #if defined(__GNUC__)
-
-
- trace_buffer[0] = GetNextInstructionPc(pc);
- #else
- trace_buffer[0] = pc;
- #endif
- size = 1;
- if (stack_top < 4096) return;
-
- #if defined(__sparc_v9__) || defined(__sparcv9__) || defined(__sparcv9)
- asm volatile("flushw" ::: "memory");
- #else
- asm volatile("ta 3" ::: "memory");
- #endif
-
-
-
-
- uptr prev_bp = GET_CURRENT_FRAME();
- uptr next_bp = prev_bp;
- unsigned int i = 0;
- while (next_bp != bp && IsAligned(next_bp, sizeof(uhwptr)) && i++ < 8) {
- prev_bp = next_bp;
- next_bp = (uptr)((uhwptr *)next_bp)[14] + STACK_BIAS;
- }
- if (next_bp == bp)
- bp = prev_bp;
-
-
- uptr bottom = stack_bottom;
-
- while (IsValidFrame(bp, stack_top, bottom) && IsAligned(bp, sizeof(uhwptr)) &&
- size < max_depth) {
- uhwptr pc1 = ((uhwptr *)bp)[15];
-
-
-
- if (pc1 < kPageSize)
- break;
- if (pc1 != pc) {
-
-
- trace_buffer[size++] = GetNextInstructionPc((uptr)pc1);
- }
- bottom = bp;
- bp = (uptr)((uhwptr *)bp)[14] + STACK_BIAS;
- }
- }
- }
- #endif
|