forked from OSchip/llvm-project
[Sanitizer] StackTrace: kill CopyTo and reimplement CopyFrom
llvm-svn: 192441
This commit is contained in:
parent
cc00dd4d5d
commit
0cd96165f1
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "sanitizer_common.h"
|
||||
#include "sanitizer_flags.h"
|
||||
#include "sanitizer_libc.h"
|
||||
#include "sanitizer_procmaps.h"
|
||||
#include "sanitizer_stacktrace.h"
|
||||
#include "sanitizer_symbolizer.h"
|
||||
|
@ -34,6 +35,11 @@ uptr StackTrace::GetPreviousInstructionPc(uptr pc) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void StackTrace::CopyFrom(const uptr *src, uptr src_size) {
|
||||
size = Min(src_size, kStackTraceMax);
|
||||
internal_memcpy(trace, src, sizeof(trace[0]) * size);
|
||||
}
|
||||
|
||||
static void PrintStackFramePrefix(uptr frame_num, uptr pc) {
|
||||
Printf(" #%zu 0x%zx", frame_num, pc);
|
||||
}
|
||||
|
|
|
@ -36,20 +36,8 @@ struct StackTrace {
|
|||
uptr trace[kStackTraceMax];
|
||||
static void PrintStack(const uptr *addr, uptr size, bool symbolize,
|
||||
SymbolizeCallback symbolize_callback);
|
||||
void CopyTo(uptr *dst, uptr dst_size) {
|
||||
for (uptr i = 0; i < size && i < dst_size; i++)
|
||||
dst[i] = trace[i];
|
||||
for (uptr i = size; i < dst_size; i++)
|
||||
dst[i] = 0;
|
||||
}
|
||||
|
||||
void CopyFrom(uptr *src, uptr src_size) {
|
||||
size = src_size;
|
||||
if (size > kStackTraceMax) size = kStackTraceMax;
|
||||
for (uptr i = 0; i < size; i++) {
|
||||
trace[i] = src[i];
|
||||
}
|
||||
}
|
||||
void CopyFrom(const uptr *src, uptr src_size);
|
||||
|
||||
void FastUnwindStack(uptr pc, uptr bp, uptr stack_top, uptr stack_bottom,
|
||||
uptr max_depth);
|
||||
|
|
Loading…
Reference in New Issue