From 05a3699b49642d43655022f365b7bb8c7ed4460b Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 18 Feb 2017 03:27:49 -0800 Subject: [PATCH] Update pcas CA error msgs to include the pv name for easier debugging. --- src/ca/legacy/pcas/generic/casPVI.cc | 32 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/ca/legacy/pcas/generic/casPVI.cc b/src/ca/legacy/pcas/generic/casPVI.cc index 50e5d27a7..48692b99b 100644 --- a/src/ca/legacy/pcas/generic/casPVI.cc +++ b/src/ca/legacy/pcas/generic/casPVI.cc @@ -26,6 +26,11 @@ #include "casAsyncIOI.h" #include "casMonitor.h" + +// Use casErrMessage instead of errMessage to show PV name +#define casErrMessage(S, PM) \ + errPrintf(S, __FILE__, __LINE__, ", %s, %s", getName(), PM) + casPVI::casPVI ( casPV & intf ) : pCAS ( NULL ), pPV ( & intf ), nMonAttached ( 0u ), nIOAttached ( 0u ), deletePending ( false ) {} @@ -146,7 +151,7 @@ caStatus casPVI::updateEnumStringTable ( casCtx & ctxIn ) // gddArray(int app, aitEnum prim, int dimen, ...); gdd * pTmp = new gddScalar ( gddAppType_enums ); if ( pTmp == NULL ) { - errMessage ( S_cas_noMemory, + casErrMessage ( S_cas_noMemory, "unable to create gdd for read of application type \"enums\" string" " conversion table for enumerated PV" ); return S_cas_noMemory; @@ -156,8 +161,8 @@ caStatus casPVI::updateEnumStringTable ( casCtx & ctxIn ) gddAppType_enums, MAX_ENUM_STATES ); if ( status != S_cas_success ) { pTmp->unreference (); - errMessage ( status, - "unable to to config gdd for read of application type \"enums\" string" + casErrMessage ( status, + "unable to config gdd for read of application type \"enums\" string" " conversion table for enumerated PV"); return status; } @@ -187,9 +192,9 @@ void casPVI::updateEnumStringTableAsyncCompletion ( const gdd & resp ) epicsGuard < epicsMutex > guard ( this->mutex ); if ( resp.isContainer() ) { - errMessage ( S_cas_badType, - "application type \"enums\" string conversion table for" - " enumerated PV was a container (expected vector of strings)" ); + casErrMessage ( S_cas_badType, + "Invalid \"enums\" string conversion table for" + " enumerated PV (container instead of vector of strings)" ); return; } @@ -197,14 +202,14 @@ void casPVI::updateEnumStringTableAsyncCompletion ( const gdd & resp ) if ( resp.primitiveType() == aitEnumString ) { aitString *pStr = (aitString *) resp.dataVoid (); if ( ! this->enumStrTbl.setString ( 0, pStr->string() ) ) { - errMessage ( S_cas_noMemory, + casErrMessage ( S_cas_noMemory, "no memory to set enumerated PV string cache" ); } } else if ( resp.primitiveType() == aitEnumFixedString ) { aitFixedString *pStr = (aitFixedString *) resp.dataVoid (); if ( ! this->enumStrTbl.setString ( 0, pStr->fixed_string ) ) { - errMessage ( S_cas_noMemory, + casErrMessage ( S_cas_noMemory, "no memory to set enumerated PV string cache" ); } } @@ -232,7 +237,7 @@ void casPVI::updateEnumStringTableAsyncCompletion ( const gdd & resp ) aitString *pStr = (aitString *) resp.dataVoid (); for ( index = 0; indexenumStrTbl.setString ( index, pStr[index].string() ) ) { - errMessage ( S_cas_noMemory, + casErrMessage ( S_cas_noMemory, "no memory to set enumerated PV string cache" ); } } @@ -241,19 +246,18 @@ void casPVI::updateEnumStringTableAsyncCompletion ( const gdd & resp ) aitFixedString *pStr = (aitFixedString *) resp.dataVoid (); for ( index = 0; index < count; index++ ) { if ( ! this->enumStrTbl.setString ( index, pStr[index].fixed_string ) ) { - errMessage ( S_cas_noMemory, + casErrMessage ( S_cas_noMemory, "no memory to set enumerated PV string cache" ); } } } else { - errMessage ( S_cas_badType, - "application type \"enums\" string conversion" - " table for enumerated PV isnt a string type?" ); + casErrMessage( S_cas_badType, + "bad \"enums\" string conversion table for enumerated PV" ); } } else { - errMessage ( S_cas_badType, + casErrMessage ( S_cas_badType, "application type \"enums\" string conversion table" " for enumerated PV was multi-dimensional" " (expected vector of strings)" );