Created a std::string in the base StopInfo class for the description and
cleaned up all base classes that had their own copy. Added a SetDescription
accessor to the StopInfo class.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132615 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/StopInfo.cpp b/source/Target/StopInfo.cpp
index 33d9a32..a958710 100644
--- a/source/Target/StopInfo.cpp
+++ b/source/Target/StopInfo.cpp
@@ -253,8 +253,7 @@
public:
StopInfoUnixSignal (Thread &thread, int signo) :
- StopInfo (thread, signo),
- m_description()
+ StopInfo (thread, signo)
{
}
@@ -306,9 +305,6 @@
}
return m_description.c_str();
}
-
-private:
- std::string m_description;
};
//----------------------------------------------------------------------
@@ -337,7 +333,47 @@
virtual const char *
GetDescription ()
{
+ if (m_description.empty())
return "trace";
+ else
+ return m_description.c_str();
+ }
+};
+
+
+//----------------------------------------------------------------------
+// StopInfoException
+//----------------------------------------------------------------------
+
+class StopInfoException : public StopInfo
+{
+public:
+
+ StopInfoException (Thread &thread, const char *description) :
+ StopInfo (thread, LLDB_INVALID_UID)
+ {
+ if (description)
+ SetDescription (description);
+ }
+
+ virtual
+ ~StopInfoException ()
+ {
+ }
+
+ virtual StopReason
+ GetStopReason () const
+ {
+ return eStopReasonException;
+ }
+
+ virtual const char *
+ GetDescription ()
+ {
+ if (m_description.empty())
+ return "exception";
+ else
+ return m_description.c_str();
}
};
@@ -380,7 +416,6 @@
private:
ThreadPlanSP m_plan_sp;
- std::string m_description;
};
StopInfoSP
@@ -418,3 +453,9 @@
{
return StopInfoSP (new StopInfoThreadPlan (plan_sp));
}
+
+StopInfoSP
+StopInfo::CreateStopReasonWithException (Thread &thread, const char *description)
+{
+ return StopInfoSP (new StopInfoException (thread, description));
+}