[compiler-rt] r343534 - [sanitizer] Small buffer tests for __sanitizer_symbolize_pc
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 1 13:39:49 PDT 2018
Author: vitalybuka
Date: Mon Oct 1 13:39:49 2018
New Revision: 343534
URL: http://llvm.org/viewvc/llvm-project?rev=343534&view=rev
Log:
[sanitizer] Small buffer tests for __sanitizer_symbolize_pc
Modified:
compiler-rt/trunk/test/sanitizer_common/TestCases/symbolize_pc.cc
Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/symbolize_pc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/symbolize_pc.cc?rev=343534&r1=343533&r2=343534&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/symbolize_pc.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/symbolize_pc.cc Mon Oct 1 13:39:49 2018
@@ -7,6 +7,17 @@
int GLOBAL_VAR_ABC;
+void SymbolizeSmallBuffer() {
+ char data[] = "abcdef";
+ __sanitizer_symbolize_pc(__builtin_return_address(0), "%p %F %L", data, 0);
+ printf("UNCHANGED '%s'\n", data);
+ __sanitizer_symbolize_pc(__builtin_return_address(0), "%p %F %L", data, 1);
+ printf("EMPTY '%s'\n", data);
+ __sanitizer_symbolize_pc(__builtin_return_address(0), "%p %F %L", data,
+ sizeof(data));
+ printf("PARTIAL '%s'\n", data);
+}
+
void SymbolizeCaller() {
char data[100];
__sanitizer_symbolize_pc(__builtin_return_address(0), "%p %F %L", data,
@@ -31,10 +42,16 @@ void SymbolizeData() {
printf("GLOBAL: %s\n", data);
}
-// CHECK: FIRST_FORMAT 0x{{.*}} in main symbolize_pc.cc:[[@LINE+3]]
-// CHECK: SECOND_FORMAT FUNC:main LINE:[[@LINE+2]] FILE:symbolize_pc.cc
int main() {
+ // CHECK: UNCHANGED 'abcdef'
+ // CHECK: EMPTY ''
+ // CHECK: PARTIAL '0x{{.*}}'
+ SymbolizeSmallBuffer();
+
+ // CHECK: FIRST_FORMAT 0x{{.*}} in main symbolize_pc.cc:[[@LINE+2]]
+ // CHECK: SECOND_FORMAT FUNC:main LINE:[[@LINE+1]] FILE:symbolize_pc.cc
SymbolizeCaller();
+
+ // CHECK: GLOBAL: GLOBAL_VAR_ABC
SymbolizeData();
}
-// CHECK: GLOBAL: GLOBAL_VAR_ABC
More information about the llvm-commits
mailing list