abort/error: print backtrace, abuse templates, overhaul result/diag (macos not done yet)
This commit is contained in:
@@ -14,23 +14,22 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value) {
|
||||
void AbortImpl(const char *expr, const char *func, const char *file, int line) {
|
||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||
{
|
||||
AMS_LOG("Abort Called\n");
|
||||
AMS_LOG(" Location: %s:%d\n", file, line);
|
||||
AMS_LOG(" Function: %s\n", func);
|
||||
AMS_LOG(" Expression: %s\n", expr);
|
||||
AMS_LOG(" Value: %016" PRIx64 "\n", value);
|
||||
AMS_LOG("\n");
|
||||
}
|
||||
#else
|
||||
AMS_UNUSED(file, line, func, expr, value);
|
||||
AMS_UNUSED(file, line, func, expr);
|
||||
#endif
|
||||
AbortImpl();
|
||||
}
|
||||
|
||||
void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) {
|
||||
void AbortImpl(const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||
{
|
||||
AMS_LOG("Abort Called\n");
|
||||
@@ -48,12 +47,35 @@ void AbortImpl(const char *file, int line, const char *func, const char *expr, u
|
||||
}
|
||||
}
|
||||
#else
|
||||
AMS_UNUSED(file, line, func, expr, value, format);
|
||||
AMS_UNUSED(file, line, func, expr, format);
|
||||
#endif
|
||||
AbortImpl();
|
||||
}
|
||||
|
||||
void AssertionFailureImpl(const char *file, int line, const char *func, const char *expr, u64 value) {
|
||||
void AbortImpl(const char *expr, const char *func, const char *file, int line, const ::ams::Result *result, const char *format, ...) {
|
||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||
{
|
||||
AMS_LOG("Abort Called\n");
|
||||
AMS_LOG(" Location: %s:%d\n", file, line);
|
||||
AMS_LOG(" Function: %s\n", func);
|
||||
AMS_LOG(" Expression: %s\n", expr);
|
||||
AMS_LOG(" Result: 0x%08" PRIx32 "\n", result->GetValue());
|
||||
AMS_LOG("\n");
|
||||
{
|
||||
::std::va_list vl;
|
||||
va_start(vl, format);
|
||||
AMS_VLOG(format, vl);
|
||||
va_end(vl);
|
||||
AMS_LOG("\n");
|
||||
}
|
||||
}
|
||||
#else
|
||||
AMS_UNUSED(file, line, func, expr, result, format);
|
||||
#endif
|
||||
AbortImpl();
|
||||
}
|
||||
|
||||
void OnAssertionFailure(AssertionType type, const char *expr, const char *func, const char *file, int line) {
|
||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||
{
|
||||
AMS_LOG("Assertion Failure\n");
|
||||
@@ -62,14 +84,16 @@ void AssertionFailureImpl(const char *file, int line, const char *func, const ch
|
||||
AMS_LOG(" Expression: %s\n", expr);
|
||||
AMS_LOG(" Value: %016" PRIx64 "\n", value);
|
||||
AMS_LOG("\n");
|
||||
|
||||
AMS_UNUSED(type);
|
||||
}
|
||||
#else
|
||||
AMS_UNUSED(file, line, func, expr, value);
|
||||
AMS_UNUSED(type, expr, func, file, line);
|
||||
#endif
|
||||
AbortImpl();
|
||||
}
|
||||
|
||||
void AssertionFailureImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) {
|
||||
void OnAssertionFailure(AssertionType type, const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||
{
|
||||
AMS_LOG("Assertion Failure\n");
|
||||
@@ -85,9 +109,11 @@ void AssertionFailureImpl(const char *file, int line, const char *func, const ch
|
||||
va_end(vl);
|
||||
AMS_LOG("\n");
|
||||
}
|
||||
|
||||
AMS_UNUSED(type);
|
||||
}
|
||||
#else
|
||||
AMS_UNUSED(file, line, func, expr, value, format);
|
||||
AMS_UNUSED(type, expr, func, file, line, format);
|
||||
#endif
|
||||
AbortImpl();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user