forked from OSchip/llvm-project
[sanitizer] Small buffer tests for __sanitizer_symbolize_pc
llvm-svn: 343534
This commit is contained in:
parent
9af02f2028
commit
a477e59b03
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue