[llvm-commits] [PATCH] llvm-symbolizer: symbolize global variables

Alexey Samsonov samsonov at google.com
Thu Jan 10 01:54:13 PST 2013


  Regarding eugenis@ suggestion: I think that adding "explicit" keyword is probably fine (I don't like CAPS, though). But we should be able to do a "best effort" in case it's not provided - we may either try to symbolize address assuming it's in .text, and if we fail, try .data, or do smth better like actually looking at where these sections are (it's not really portable and, yes, have problems with tls).


================
Comment at: tools/llvm-symbolizer/llvm-symbolizer.cpp:141
@@ +140,3 @@
+                     uint64_t &Start, uint64_t &Size) const {
+    return getNameFromSymbolTable(SymbolRef::ST_Data,
+                                  ModuleOffset, Name, Start, Size);
----------------
There is a UseSymbolTable option, which may be used here (if it's false, just don't access it). In this case, the comment for this option should be changed accordingly.

================
Comment at: tools/llvm-symbolizer/llvm-symbolizer.cpp:305
@@ +304,3 @@
+static void symbolizeData(std::string ModuleName, std::string ModuleOffsetStr) {
+  std::string Name = "??";
+  uint64_t Start = 0;
----------------
There is kSymbolizerBadString already defined in other function.

================
Comment at: tools/llvm-symbolizer/llvm-symbolizer.cpp:314
@@ +313,3 @@
+        int status = 0;
+        char *DemangledName = __cxa_demangle(Name.c_str(), 0, 0, &status);
+        if (status == 0) {
----------------
You would need to #ifdef-guard this code on platforms which don't have __cxa_demangle.


http://llvm-reviews.chandlerc.com/D277



More information about the llvm-commits mailing list