[ARM] Support for ARMv6-Z / ARMv6-ZK missing
[oota-llvm.git] / include / llvm / Support / PrettyStackTrace.h
index 6dbce393b97e36e3ff1647e6bf2cd95542fbe3fc..027f9433969d152e984705a2847dd233f1b5a08d 100644 (file)
 #ifndef LLVM_SUPPORT_PRETTYSTACKTRACE_H
 #define LLVM_SUPPORT_PRETTYSTACKTRACE_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
   class raw_ostream;
 
-  /// DisablePrettyStackTrace - Set this to true to disable this module. This
-  /// might be neccessary if the host application installs its own signal
-  /// handlers which conflict with the ones installed by this module.
-  /// Defaults to false.
-  extern bool DisablePrettyStackTrace;
+  void EnablePrettyStackTrace();
 
   /// PrettyStackTraceEntry - This class is used to represent a frame of the
   /// "pretty" stack trace that is dumped when a program crashes. You can define
@@ -32,8 +30,8 @@ namespace llvm {
   /// virtual stack trace.  This gets dumped out if the program crashes.
   class PrettyStackTraceEntry {
     const PrettyStackTraceEntry *NextEntry;
-    PrettyStackTraceEntry(const PrettyStackTraceEntry &); // DO NOT IMPLEMENT
-    void operator=(const PrettyStackTraceEntry&);         // DO NOT IMPLEMENT
+    PrettyStackTraceEntry(const PrettyStackTraceEntry &) = delete;
+    void operator=(const PrettyStackTraceEntry&) = delete;
   public:
     PrettyStackTraceEntry();
     virtual ~PrettyStackTraceEntry();
@@ -52,7 +50,7 @@ namespace llvm {
     const char *Str;
   public:
     PrettyStackTraceString(const char *str) : Str(str) {}
-    virtual void print(raw_ostream &OS) const;
+    void print(raw_ostream &OS) const override;
   };
 
   /// PrettyStackTraceProgram - This object prints a specified program arguments
@@ -62,10 +60,24 @@ namespace llvm {
     const char *const *ArgV;
   public:
     PrettyStackTraceProgram(int argc, const char * const*argv)
-      : ArgC(argc), ArgV(argv) {}
-    virtual void print(raw_ostream &OS) const;
+      : ArgC(argc), ArgV(argv) {
+      EnablePrettyStackTrace();
+    }
+    void print(raw_ostream &OS) const override;
   };
 
+  /// Returns the topmost element of the "pretty" stack state.
+  const void* SavePrettyStackState();
+
+  /// Restores the topmost element of the "pretty" stack state to State, which
+  /// should come from a previous call to SavePrettyStackState().  This is
+  /// useful when using a CrashRecoveryContext in code that also uses
+  /// PrettyStackTraceEntries, to make sure the stack that's printed if a crash
+  /// happens after a crash that's been recovered by CrashRecoveryContext
+  /// doesn't have frames on it that were added in code unwound by the
+  /// CrashRecoveryContext.
+  void RestorePrettyStackState(const void* State);
+
 } // end namespace llvm
 
 #endif