From cfc8c2b8e0279906cbdb17e5829e2a39a8050def Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 9 Aug 2001 16:29:56 +0000 Subject: [PATCH] better message --- src/ca/cac.cpp | 13 ++++--- src/libCom/osi/os/default/osdAssert.c | 52 ++++++++++++++------------- src/libCom/osi/os/vxWorks/osdAssert.c | 42 ++++++++++++---------- 3 files changed, 59 insertions(+), 48 deletions(-) diff --git a/src/ca/cac.cpp b/src/ca/cac.cpp index f37b1ead9..38f4ebe73 100644 --- a/src/ca/cac.cpp +++ b/src/ca/cac.cpp @@ -1577,22 +1577,27 @@ void cac::vSignal ( int ca_status, const char *pfilenm, "Fatal" }; - this->printf ( "CA.Client.Diagnostic..............................................\n" ); + this->printf ( "CA.Client.Exception...............................................\n" ); this->printf ( " %s: \"%s\"\n", severity[ CA_EXTRACT_SEVERITY ( ca_status ) ], ca_message ( ca_status ) ); if ( pFormat ) { - this->printf ( " Context: \"" ); + this->printf ( "Context: \"" ); this->vPrintf ( pFormat, args ); this->printf ( "\"\n" ); } - if (pfilenm) { - this->printf ( " Source File: %s Line Number: %d\n", + if ( pfilenm ) { + this->printf ( " Source File: %s line %d\n", pfilenm, lineno ); } + + epicsTime current = epicsTime::getCurrent (); + char date[64]; + current.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S.%f"); + this->printf ( " Current Time: %s\n", date ); /* * Terminate execution if unsuccessful diff --git a/src/libCom/osi/os/default/osdAssert.c b/src/libCom/osi/os/default/osdAssert.c index 408bffbde..928dcdb41 100644 --- a/src/libCom/osi/os/default/osdAssert.c +++ b/src/libCom/osi/os/default/osdAssert.c @@ -37,6 +37,7 @@ #include "epicsVersion.h" #include "epicsAssert.h" #include "epicsThread.h" +#include "epicsTime.h" #include "cantProceed.h" /* @@ -46,38 +47,39 @@ epicsShareFunc void epicsShareAPI epicsAssert (const char *pFile, const unsigned line, const char *pExp, const char *pAuthorName) { + epicsTimeStamp current; + char date[64]; + int status; + errlogPrintf ( "\n\n\nA call to \"assert (%s)\" failed in %s line %d.\n", pExp, pFile, line); errlogPrintf ( -"The file \"core\" will be created in the current working directory.\n"); +"EPICS release %s.\n", epicsReleaseVersion ); + + status = epicsTimeGetCurrent ( & current ); + + if ( status == 0 ) { + + epicsTimeToStrftime ( date, sizeof ( date ), + "%a %b %d %Y %H:%M:%S.%f", & current ); + + errlogPrintf ( +"Current time %s.\n", date ); + + } + + if ( ! pAuthorName ) { + pAuthorName = "the author"; + } errlogPrintf ( -"Please save this file and the text of this message in order to assist\n"); +"Please E-mail this message to %s or to tech-talk@aps.anl.gov\n", + pAuthorName ); - errlogPrintf ( -"in diagnosing this problem.\n"); + errlogPrintf ( +"Calling epicsThreadSuspendSelf()\n" ); - if (pAuthorName) { - - errlogPrintf ( -"Please send the text of this message to \"%s\"\n", pAuthorName); - - errlogPrintf ( -"(the author of this call to assert()) or to \"tech-talk@aps.anl.gov\"\n"); - - } - else { - - errlogPrintf ( -"Please contact the author of this software or else send the text of\n"); - - errlogPrintf ( -"this message to \"tech-talk@aps.anl.gov\"\n"); - - } - errlogPrintf ("This problem occurred in \"%s\"\n", epicsReleaseVersion); - errlogPrintf("calling epicsThreadSuspendSelf()\n"); - epicsThreadSuspendSelf(); + epicsThreadSuspendSelf (); } diff --git a/src/libCom/osi/os/vxWorks/osdAssert.c b/src/libCom/osi/os/vxWorks/osdAssert.c index 90a29b48e..866862c5b 100644 --- a/src/libCom/osi/os/vxWorks/osdAssert.c +++ b/src/libCom/osi/os/vxWorks/osdAssert.c @@ -40,6 +40,7 @@ #include "epicsPrint.h" #include "epicsVersion.h" #include "epicsAssert.h" +#include "epicsTime.h" /* * epicsAssert () @@ -52,6 +53,9 @@ epicsShareFunc void epicsShareAPI epicsAssert (const char *pFile, const unsigned const char *pAuthorName) { epicsThreadId threadid = epicsThreadGetIdSelf(); + epicsTimeStamp current; + char date[64]; + int status; epicsPrintf ( "\n\n\n%s: A call to \"assert (%s)\" failed in %s at %d\n", @@ -60,29 +64,29 @@ epicsShareFunc void epicsShareAPI epicsAssert (const char *pFile, const unsigned pFile, line); - if (pAuthorName) { + status = epicsTimeGetCurrent ( & current ); + if ( status == 0 ) { + epicsTimeToStrftime ( date, sizeof ( date ), + "%a %b %d %Y %H:%M:%S.%f", & current ); + epicsPrintf ( +"Current time %s.\n", date ); + } - epicsPrintf ( -"Please send a copy of the output from \"tt (%p)\" and a copy of this message\n", - threadid); + epicsPrintf ( +"EPICS Release %s.\n", epicsReleaseVersion ); - epicsPrintf ( -"to \"%s\" (the author of this call to assert()) or \"tech-talk@aps.anl.gov\"\n", + if ( ! pAuthorName ) { + pAuthorName = "the author"; + } + + epicsPrintf ( +"Please E-mail this message and the output from \"tt (%p)\"\n", + threadid ); + + epicsPrintf ( +"to %s or to tech-talk@aps.anl.gov\n", pAuthorName); - } - else { - - epicsPrintf ( -"Please send a copy of the output from \"tt (%p)\" and a copy of this message\n", - threadid); - - epicsPrintf ( -"to the author or \"tech-talk@aps.anl.gov\"\n"); - - } - epicsPrintf ("This problem occurred in \"%s\"\n", epicsReleaseVersion); - epicsThreadSuspendSelf (); }