X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8f7ec2e4b08cd2b27aa34b2c9fec2af0ad79d53a..3203afd846219ef8b41cadda945ea0a98103c46f:/src/xbt/exception.cpp diff --git a/src/xbt/exception.cpp b/src/xbt/exception.cpp index bf5caf1abd..e8048f88f0 100644 --- a/src/xbt/exception.cpp +++ b/src/xbt/exception.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2005-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2005-2023. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -17,15 +17,14 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_exception, xbt, "Exceptions"); void _xbt_throw(char* message, const char* file, int line, const char* func) { - simgrid::Exception e( - simgrid::xbt::ThrowPoint(file, line, func, simgrid::xbt::Backtrace(), xbt_procname(), xbt_getpid()), - message ? message : ""); + simgrid::Exception e(simgrid::xbt::ThrowPoint(file, line, func, simgrid::xbt::Backtrace(), sg_actor_self_get_name(), + sg_actor_self_get_pid()), + message ? message : ""); xbt_free(message); throw e; } -namespace simgrid { -namespace xbt { +namespace simgrid::xbt { ImpossibleError::~ImpossibleError() = default; InitializationError::~InitializationError() = default; @@ -38,7 +37,7 @@ void log_exception(e_xbt_log_priority_t prio, const char* context, std::exceptio auto* with_context = dynamic_cast(&exception); if (with_context != nullptr) { - XBT_LOG(prio, "%s %s by %s/%d: %s", context, name.c_str(), with_context->throw_point().procname_.c_str(), + XBT_LOG(prio, "%s %s by %s/%ld: %s", context, name.c_str(), with_context->throw_point().procname_.c_str(), with_context->throw_point().pid_, exception.what()); // Do we have a backtrace? if (not simgrid::config::get_value("exception/cutpath")) { @@ -104,8 +103,7 @@ XBT_ATTRIB_NORETURN static void handler() } catch (const simgrid::ForcefulKillException&) { - XBT_ERROR("Received a ForcefulKillException at the top-level exception handler. Maybe a Java->C++ call that is not " - "protected in a try/catch?"); + XBT_ERROR("Received a ForcefulKillException at the top-level exception handler. Please help fix this bug."); } // We don't know how to manage other exceptions @@ -129,8 +127,7 @@ void install_exception_handler() }); } -} // namespace xbt -} // namespace simgrid +} // namespace simgrid::xbt void xbt_throw_impossible(const char* file, int line, const char* func) {