[llvm-commits] [compiler-rt] r169122 - in /compiler-rt/trunk/lib: sanitizer_common/sanitizer_symbolizer.cc sanitizer_common/sanitizer_symbolizer.h tsan/rtl/tsan_report.cc tsan/rtl/tsan_report.h tsan/rtl/tsan_rtl_report.cc tsan/rtl/tsan_symbolize.cc
Kostya Serebryany
kcc at google.com
Mon Dec 3 03:54:16 PST 2012
Could you please add an output test, please?
On Mon, Dec 3, 2012 at 3:45 PM, Dmitry Vyukov <dvyukov at google.com> wrote:
> Author: dvyukov
> Date: Mon Dec 3 05:45:34 2012
> New Revision: 169122
>
> URL: http://llvm.org/viewvc/llvm-project?rev=169122&view=rev
> Log:
> tsan: describe global vars (module+offset for now)
>
> Modified:
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.cc
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h
> compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
> compiler-rt/trunk/lib/tsan/rtl/tsan_report.h
> compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
> compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.cc?rev=169122&r1=169121&r2=169122&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.cc
> (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.cc Mon Dec
> 3 05:45:34 2012
> @@ -256,6 +256,17 @@
> // Otherwise, the data was filled by external symbolizer.
> return actual_frames;
> }
> +
> + bool SymbolizeData(uptr addr, AddressInfo *frame) {
> + LoadedModule *module = FindModuleForAddress(addr);
> + if (module == 0)
> + return false;
> + const char *module_name = module->full_name();
> + uptr module_offset = addr - module->base_address();
> + frame->FillAddressAndModuleInfo(addr, module_name, module_offset);
> + return true;
> + }
> +
> bool InitializeExternalSymbolizer(const char *path_to_symbolizer) {
> int input_fd, output_fd;
> if (!StartSymbolizerSubprocess(path_to_symbolizer, &input_fd,
> &output_fd))
> @@ -307,6 +318,10 @@
> return symbolizer.SymbolizeCode(address, frames, max_frames);
> }
>
> +bool SymbolizeData(uptr address, AddressInfo *frame) {
> + return symbolizer.SymbolizeData(address, frame);
> +}
> +
> bool InitializeExternalSymbolizer(const char *path_to_symbolizer) {
> return symbolizer.InitializeExternalSymbolizer(path_to_symbolizer);
> }
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h?rev=169122&r1=169121&r2=169122&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h
> (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h Mon Dec
> 3 05:45:34 2012
> @@ -58,6 +58,7 @@
> // of descriptions actually filled.
> // This function should NOT be called from two threads simultaneously.
> uptr SymbolizeCode(uptr address, AddressInfo *frames, uptr max_frames);
> +bool SymbolizeData(uptr address, AddressInfo *frame);
>
> // Starts external symbolizer program in a subprocess. Sanitizer
> communicates
> // with external symbolizer via pipes.
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc?rev=169122&r1=169121&r2=169122&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc Mon Dec 3 05:45:34 2012
> @@ -80,8 +80,9 @@
>
> static void PrintLocation(const ReportLocation *loc) {
> if (loc->type == ReportLocationGlobal) {
> - Printf(" Location is global '%s' of size %zu at %zx %s:%d\n",
> - loc->name, loc->size, loc->addr, loc->file, loc->line);
> + Printf(" Location is global '%s' of size %zu at %zx %s:%d
> (%s+%p)\n\n",
> + loc->name, loc->size, loc->addr, loc->file, loc->line,
> + loc->module, loc->offset);
> } else if (loc->type == ReportLocationHeap) {
> Printf(" Location is heap block of size %zu at %p allocated",
> loc->size, loc->addr);
> @@ -91,7 +92,7 @@
> Printf(" by thread %d:\n", loc->tid);
> PrintStack(loc->stack);
> } else if (loc->type == ReportLocationStack) {
> - Printf(" Location is stack of thread %d:\n", loc->tid);
> + Printf(" Location is stack of thread %d:\n\n", loc->tid);
> }
> }
>
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.h?rev=169122&r1=169121&r2=169122&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_report.h (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.h Mon Dec 3 05:45:34 2012
> @@ -58,6 +58,8 @@
> ReportLocationType type;
> uptr addr;
> uptr size;
> + char *module;
> + uptr offset;
> int tid;
> char *name;
> char *file;
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=169122&r1=169121&r2=169122&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Mon Dec 3 05:45:34
> 2012
> @@ -220,9 +220,11 @@
> loc->type = ReportLocationGlobal;
> loc->addr = addr;
> loc->size = size;
> + loc->module = symb->module ? internal_strdup(symb->module) : 0;
> + loc->offset = symb->offset;
> loc->tid = 0;
> - loc->name = symb->func;
> - loc->file = symb->file;
> + loc->name = symb->func ? internal_strdup(symb->func) : 0;
> + loc->file = symb->file ? internal_strdup(symb->file) : 0;
> loc->line = symb->line;
> loc->stack = 0;
> internal_free(symb);
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc?rev=169122&r1=169121&r2=169122&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc Mon Dec 3 05:45:34
> 2012
> @@ -52,7 +52,7 @@
> }
>
> ReportStack *SymbolizeCode(uptr addr) {
> - if (0 != internal_strcmp(flags()->external_symbolizer_path, "")) {
> + if (flags()->external_symbolizer_path[0]) {
> static const uptr kMaxAddrFrames = 16;
> InternalScopedBuffer<AddressInfo> addr_frames(kMaxAddrFrames);
> for (uptr i = 0; i < kMaxAddrFrames; i++)
> @@ -79,6 +79,12 @@
> }
>
> ReportStack *SymbolizeData(uptr addr) {
> + if (flags()->external_symbolizer_path[0]) {
> + AddressInfo frame;
> + if (!__sanitizer::SymbolizeData(addr, &frame))
> + return 0;
> + return NewReportStackEntry(frame);
> + }
> return SymbolizeDataAddr2Line(addr);
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121203/d252c244/attachment.html>
More information about the llvm-commits
mailing list