annotate libsanitizer/sanitizer_common/sanitizer_stacktrace_printer.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 //===-- sanitizer_stacktrace_printer.h --------------------------*- C++ -*-===//
kono
parents:
diff changeset
2 //
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
111
kono
parents:
diff changeset
6 //
kono
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
kono
parents:
diff changeset
8 //
kono
parents:
diff changeset
9 // This file is shared between sanitizers' run-time libraries.
kono
parents:
diff changeset
10 //
kono
parents:
diff changeset
11 //===----------------------------------------------------------------------===//
kono
parents:
diff changeset
12 #ifndef SANITIZER_STACKTRACE_PRINTER_H
kono
parents:
diff changeset
13 #define SANITIZER_STACKTRACE_PRINTER_H
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 #include "sanitizer_common.h"
kono
parents:
diff changeset
16 #include "sanitizer_symbolizer.h"
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 namespace __sanitizer {
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 // Render the contents of "info" structure, which represents the contents of
kono
parents:
diff changeset
21 // stack frame "frame_no" and appends it to the "buffer". "format" is a
kono
parents:
diff changeset
22 // string with placeholders, which is copied to the output with
kono
parents:
diff changeset
23 // placeholders substituted with the contents of "info". For example,
kono
parents:
diff changeset
24 // format string
kono
parents:
diff changeset
25 // " frame %n: function %F at %S"
kono
parents:
diff changeset
26 // will be turned into
kono
parents:
diff changeset
27 // " frame 10: function foo::bar() at my/file.cc:10"
kono
parents:
diff changeset
28 // You may additionally pass "strip_path_prefix" to strip prefixes of paths to
kono
parents:
diff changeset
29 // source files and modules, and "strip_func_prefix" to strip prefixes of
kono
parents:
diff changeset
30 // function names.
kono
parents:
diff changeset
31 // Here's the full list of available placeholders:
kono
parents:
diff changeset
32 // %% - represents a '%' character;
kono
parents:
diff changeset
33 // %n - frame number (copy of frame_no);
kono
parents:
diff changeset
34 // %p - PC in hex format;
kono
parents:
diff changeset
35 // %m - path to module (binary or shared object);
kono
parents:
diff changeset
36 // %o - offset in the module in hex format;
kono
parents:
diff changeset
37 // %f - function name;
kono
parents:
diff changeset
38 // %q - offset in the function in hex format (*if available*);
kono
parents:
diff changeset
39 // %s - path to source file;
kono
parents:
diff changeset
40 // %l - line in the source file;
kono
parents:
diff changeset
41 // %c - column in the source file;
kono
parents:
diff changeset
42 // %F - if function is known to be <foo>, prints "in <foo>", possibly
kono
parents:
diff changeset
43 // followed by the offset in this function, but only if source file
kono
parents:
diff changeset
44 // is unknown;
kono
parents:
diff changeset
45 // %S - prints file/line/column information;
kono
parents:
diff changeset
46 // %L - prints location information: file/line/column, if it is known, or
kono
parents:
diff changeset
47 // module+offset if it is known, or (<unknown module>) string.
kono
parents:
diff changeset
48 // %M - prints module basename and offset, if it is known, or PC.
kono
parents:
diff changeset
49 void RenderFrame(InternalScopedString *buffer, const char *format, int frame_no,
kono
parents:
diff changeset
50 const AddressInfo &info, bool vs_style,
kono
parents:
diff changeset
51 const char *strip_path_prefix = "",
kono
parents:
diff changeset
52 const char *strip_func_prefix = "");
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 void RenderSourceLocation(InternalScopedString *buffer, const char *file,
kono
parents:
diff changeset
55 int line, int column, bool vs_style,
kono
parents:
diff changeset
56 const char *strip_path_prefix);
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 void RenderModuleLocation(InternalScopedString *buffer, const char *module,
kono
parents:
diff changeset
59 uptr offset, ModuleArch arch,
kono
parents:
diff changeset
60 const char *strip_path_prefix);
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 // Same as RenderFrame, but for data section (global variables).
kono
parents:
diff changeset
63 // Accepts %s, %l from above.
kono
parents:
diff changeset
64 // Also accepts:
kono
parents:
diff changeset
65 // %g - name of the global variable.
kono
parents:
diff changeset
66 void RenderData(InternalScopedString *buffer, const char *format,
kono
parents:
diff changeset
67 const DataInfo *DI, const char *strip_path_prefix = "");
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 } // namespace __sanitizer
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 #endif // SANITIZER_STACKTRACE_PRINTER_H