+namespace xbt {
+
+/** Contextual information about an execution location (file:line:func and backtrace, procname, pid)
+ *
+ * Constitute the contextual information of where an exception was thrown
+ *
+ * These tuples (__FILE__, __LINE__, __func__, backtrace, procname, pid)
+ * are best created with @ref XBT_THROW_POINT.
+ *
+ * @ingroup XBT_ex
+ */
+class ThrowPoint {
+public:
+ ThrowPoint() = default;
+ explicit ThrowPoint(const char* file, int line, const char* function, Backtrace&& bt, std::string&& actor_name,
+ int pid)
+ : file_(file)
+ , line_(line)
+ , function_(function)
+ , backtrace_(std::move(bt))
+ , procname_(std::move(actor_name))
+ , pid_(pid)
+ {
+ }
+
+ const char* file_ = nullptr;
+ int line_ = 0;
+ const char* function_ = nullptr;
+ Backtrace backtrace_;
+ std::string procname_ = ""; /**< Name of the process who thrown this */
+ int pid_ = 0; /**< PID of the process who thrown this */
+};
+
+/** Create a ThrowPoint with (__FILE__, __LINE__, __func__) */
+#define XBT_THROW_POINT \
+ ::simgrid::xbt::ThrowPoint(__FILE__, __LINE__, __func__, simgrid::xbt::Backtrace(), xbt_procname(), xbt_getpid())
+
+class XBT_PUBLIC ImpossibleError : public std::logic_error {
+public:
+ explicit ImpossibleError(const std::string& arg) : std::logic_error(arg) {}
+ ~ImpossibleError();
+};
+
+class XBT_PUBLIC UnimplementedError : public std::logic_error {
+public:
+ explicit UnimplementedError(const std::string& arg) : std::logic_error(arg) {}
+ ~UnimplementedError();
+};
+
+} // namespace xbt