[PATCH] [compiler-rt] Symbolizer refactoring: SymbolizerTool and better interface

Alexey Samsonov vonosmas at gmail.com
Fri Feb 27 11:43:36 PST 2015


LGTM, but please address all the comments below before committing (there's a bug introduced in InteranalSymbolizer, so be careful). Keep an eye on WinSymbolizer - looks like we will be able to inherit it from SymbolizerTool as well, make our current "POSIXSymbolizer" class the only class implementing "Symbolizer" interface, and get rid of the latter.

Thanks for doing this!


================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc:373
@@ +372,3 @@
+  bool SymbolizePC(uptr addr, SymbolizedStack *stack) override {
+    const char *buf = SendCommand(/*is_data*/ false, stack->info.module,
+                                  stack->info.module_offset);
----------------
  if (const char *res = SendCommand(...)) {
    ParseSymbolizePCOutput(res, stack);
    return true;
  }
  return false;

================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc:380
@@ +379,3 @@
+  bool SymbolizeData(uptr addr, DataInfo *info) override {
+    const char *buf =
+        SendCommand(/*is_data*/ false, info->module, info->module_offset);
----------------
same here

================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc:435
@@ +434,3 @@
+  bool SymbolizePC(uptr addr, SymbolizedStack *stack) override {
+    const char *buf =
+        SendCommand(stack->info.module, stack->info.module_offset);
----------------
same here

================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc:498
@@ +497,3 @@
+  bool SymbolizePC(uptr addr, SymbolizedStack *stack) override {
+    bool result = __sanitizer_symbolize_data(
+        stack->info.module, stack->info.module_offset, buffer_, kBufferSize);
----------------
Here you should call __sanitizer_symbolize_code

================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc:505
@@ +504,3 @@
+  bool SymbolizeData(uptr addr, DataInfo *info) override {
+    bool result = __sanitizer_symbolize_code(info->module, info->module_offset,
+                                             buffer_, kBufferSize);
----------------
And here - __sanitizer_symbolize_data

================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc:577
@@ -555,5 +576,3 @@
 
-    const char *str = SendCommand(false, module_name, module_offset);
-    if (str == 0) {
-      // Symbolizer was not initialized or failed.
-      return res;
+    SymbolizerTool *tool = GetSymbolizerTool();
+    if (tool) {
----------------
  if (SymbolizerTool *tool = GetSymbolizerTool()) {
    ...
  }

================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc:601
@@ -581,5 +600,3 @@
     }
-    const char *str = SendCommand(true, module_name, module_offset);
-    if (str == 0)
-      return true;
-    ParseSymbolizeDataOutput(str, info);
+    SymbolizerTool *tool = GetSymbolizerTool();
+    if (tool) {
----------------
same here

http://reviews.llvm.org/D7936

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list