fall back to .debug_info scan in fatal signal handler
[folly.git] / folly / experimental / symbolizer / Dwarf.h
index ed7d1ae82cab9e4d662459ba29591dc0912bc1f1..192d0c0339fbbedb3a73c9be0e9e8c6085904a5d 100644 (file)
@@ -100,25 +100,37 @@ class Dwarf {
     folly::StringPiece file_;
   };
 
-  struct LocationInfo {
-    LocationInfo() : hasMainFile(false), hasFileAndLine(false), line(0) { }
+  enum class LocationInfoMode {
+    // Don't resolve location info.
+    DISABLED,
+    // Perform CU lookup using .debug_aranges (might be incomplete).
+    FAST,
+    // Scan all CU in .debug_info (slow!) on .debug_aranges lookup failure.
+    FULL,
+  };
 
-    bool hasMainFile;
+  struct LocationInfo {
+    bool hasMainFile = false;
     Path mainFile;
 
-    bool hasFileAndLine;
+    bool hasFileAndLine = false;
     Path file;
-    uint64_t line;
+    uint64_t line = 0;
   };
 
-  /** Find the file and line number information corresponding to address */
-  bool findAddress(uintptr_t address, LocationInfo& info) const;
+  /**
+   * Find the file and line number information corresponding to address.
+   */
+  bool findAddress(uintptr_t address,
+                   LocationInfo& info,
+                   LocationInfoMode mode) const;
 
  private:
-  void init();
   static bool findDebugInfoOffset(uintptr_t address,
                                   StringPiece aranges,
                                   uint64_t& offset);
+
+  void init();
   bool findLocation(uintptr_t address,
                     StringPiece& infoEntry,
                     LocationInfo& info) const;