[compiler-rt] r214604 - [ASan] Use metadata to pass source-level information from Clang to ASan.
Alexey Samsonov
vonosmas at gmail.com
Fri Aug 1 17:35:51 PDT 2014
Author: samsonov
Date: Fri Aug 1 19:35:50 2014
New Revision: 214604
URL: http://llvm.org/viewvc/llvm-project?rev=214604&view=rev
Log:
[ASan] Use metadata to pass source-level information from Clang to ASan.
Instead of creating global variables for source locations and global names,
just create metadata nodes and strings. They will be transformed into actual
globals in the instrumentation pass (if necessary). This approach is more
flexible:
1) we don't have to ensure that our custom globals survive all the optimizations
2) if globals are discarded for some reason, we will simply ignore metadata for them
and won't have to erase corresponding globals
3) metadata for source locations can be reused for other purposes: e.g. we may
attach source location metadata to alloca instructions and provide better descriptions
for stack variables in ASan error reports.
No functionality change.
Modified:
compiler-rt/trunk/lib/asan/asan_globals.cc
Modified: compiler-rt/trunk/lib/asan/asan_globals.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_globals.cc?rev=214604&r1=214603&r2=214604&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_globals.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_globals.cc Fri Aug 1 19:35:50 2014
@@ -73,8 +73,13 @@ ALWAYS_INLINE void PoisonRedZones(const
static void ReportGlobal(const Global &g, const char *prefix) {
Report("%s Global[%p]: beg=%p size=%zu/%zu name=%s module=%s dyn_init=%zu\n",
- prefix, &g, (void*)g.beg, g.size, g.size_with_redzone, g.name,
+ prefix, &g, (void *)g.beg, g.size, g.size_with_redzone, g.name,
g.module_name, g.has_dynamic_init);
+ if (g.location) {
+ Report(" location (%p): name=%s[%p], %d %d\n", g.location,
+ g.location->filename, g.location->filename, g.location->line_no,
+ g.location->column_no);
+ }
}
bool DescribeAddressIfGlobal(uptr addr, uptr size) {
More information about the llvm-commits
mailing list