Skip to content

Commit

Permalink
[饾榾饾椊饾椏] initial version
Browse files Browse the repository at this point in the history
Created using spr 1.3.4
  • Loading branch information
avillega committed Nov 21, 2023
1 parent f48c4d8 commit a88b199
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ StackTracePrinter *StackTracePrinter::GetOrInit() {
return stacktrace_printer;
}

const char *FormattedStackTracePrinter::StripFunctionName(
const char *function) {
const char *StackTracePrinter::StripFunctionName(const char *function) {
if (!common_flags()->demangle)
return function;
if (!function)
Expand Down Expand Up @@ -324,9 +323,10 @@ void FormattedStackTracePrinter::RenderData(InternalScopedString *buffer,

#endif // !SANITIZER_SYMBOLIZER_MARKUP

void FormattedStackTracePrinter::RenderSourceLocation(
InternalScopedString *buffer, const char *file, int line, int column,
bool vs_style, const char *strip_path_prefix) {
void StackTracePrinter::RenderSourceLocation(InternalScopedString *buffer,
const char *file, int line,
int column, bool vs_style,
const char *strip_path_prefix) {
if (vs_style && line > 0) {
buffer->AppendF("%s(%d", StripPathPrefix(file, strip_path_prefix), line);
if (column > 0)
Expand All @@ -343,9 +343,10 @@ void FormattedStackTracePrinter::RenderSourceLocation(
}
}

void FormattedStackTracePrinter::RenderModuleLocation(
InternalScopedString *buffer, const char *module, uptr offset,
ModuleArch arch, const char *strip_path_prefix) {
void StackTracePrinter::RenderModuleLocation(InternalScopedString *buffer,
const char *module, uptr offset,
ModuleArch arch,
const char *strip_path_prefix) {
buffer->AppendF("(%s", StripPathPrefix(module, strip_path_prefix));
if (arch != kModuleArchUnknown) {
buffer->AppendF(":%s", ModuleArchToString(arch));
Expand Down
28 changes: 8 additions & 20 deletions compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class StackTracePrinter {
public:
static StackTracePrinter *GetOrInit();

virtual const char *StripFunctionName(const char *function) = 0;
// Strip interceptor prefixes from function name.
const char *StripFunctionName(const char *function);

virtual void RenderFrame(InternalScopedString *buffer, const char *format,
int frame_no, uptr address, const AddressInfo *info,
Expand All @@ -34,15 +35,13 @@ class StackTracePrinter {

virtual bool RenderNeedsSymbolization(const char *format) = 0;

virtual void RenderSourceLocation(InternalScopedString *buffer,
const char *file, int line, int column,
bool vs_style,
const char *strip_path_prefix) = 0;
void RenderSourceLocation(InternalScopedString *buffer, const char *file,
int line, int column, bool vs_style,
const char *strip_path_prefix);

virtual void RenderModuleLocation(InternalScopedString *buffer,
const char *module, uptr offset,
ModuleArch arch,
const char *strip_path_prefix) = 0;
void RenderModuleLocation(InternalScopedString *buffer, const char *module,
uptr offset, ModuleArch arch,
const char *strip_path_prefix);
virtual void RenderData(InternalScopedString *buffer, const char *format,
const DataInfo *DI,
const char *strip_path_prefix = "") = 0;
Expand All @@ -53,9 +52,6 @@ class StackTracePrinter {

class FormattedStackTracePrinter : public StackTracePrinter {
public:
// Strip interceptor prefixes from function name.
const char *StripFunctionName(const char *function) override;

// Render the contents of "info" structure, which represents the contents of
// stack frame "frame_no" and appends it to the "buffer". "format" is a
// string with placeholders, which is copied to the output with
Expand Down Expand Up @@ -90,14 +86,6 @@ class FormattedStackTracePrinter : public StackTracePrinter {

bool RenderNeedsSymbolization(const char *format) override;

void RenderSourceLocation(InternalScopedString *buffer, const char *file,
int line, int column, bool vs_style,
const char *strip_path_prefix) override;

void RenderModuleLocation(InternalScopedString *buffer, const char *module,
uptr offset, ModuleArch arch,
const char *strip_path_prefix) override;

// Same as RenderFrame, but for data section (global variables).
// Accepts %s, %l from above.
// Also accepts:
Expand Down

0 comments on commit a88b199

Please sign in to comment.