#include <logid.h>

Constructor puts (member) pointers to function id-s and parameters on stack. Destructor pops them from stack.
Definition at line 129 of file logid.h.
Public Member Functions | |
| log_FunctionTracer (const log_FunctionID &a_fcnID_p) | |
| log_FunctionTracer (const log_FunctionID &a_fcnID_p, const string &a_fcnArgs_p) | |
| Function entrance with parameters is written in the debug if level is > dbg_EXTAPI or dbg_INOUT flag is set. | |
| virtual | ~log_FunctionTracer () |
Static Public Member Functions | |
| static void | DumpStack (ostream &a_str) |
| Dump current execution stack. | |
| static void | DumpStack (ostream &a_str, log_TraceStack *a_fstack) |
| static log_TraceStack * | GetStack () |
| Get pointer to this thread's stack. | |
Public Attributes | |
| const log_FunctionID & | m_fcnID_p |
| const string * | m_fcnArgs_p |
Private Member Functions | |
| void | Init () |
Static Private Attributes | |
| static bool | m_inited |
| log_FunctionTracer::log_FunctionTracer | ( | const log_FunctionID & | a_fcnID_p | ) |
Definition at line 205 of file log_functiontracer.cpp.
References cmn_Global::dbg, dbg_INOUT, dbg_LOW, dbg_NORM, g_cmn, log_Debugger::GetFlags(), Init(), cmn_Global::IsDbgActive(), IVD_COUT_LOG_m, ivd_GetThreadStack(), log_FunctionID::m_buff, log_FunctionID::m_className, m_fcnID_p, log_FunctionID::m_funcName, m_inited, log_FunctionID::m_line, log_Debugger::Write(), and log_Debugger::WriteHeader().
00207 : m_fcnID_p(a_fcnID_p), 00208 m_fcnArgs_p(NULL) { 00209 IVD_COUT_LOG_m(" log_FunctionTracer::log_FunctionTracer " 00210 << m_fcnID_p.m_className << "::" 00211 << m_fcnID_p.m_funcName) 00212 00213 if (!m_inited) { 00214 Init(); 00215 } 00216 00217 ivd_GetThreadStack()->push_back(this); 00218 00219 // Write function entrance 00220 if (g_cmn.IsDbgActive() && (g_cmn.dbg.GetFlags() & dbg_INOUT) ) { 00221 ostringstream sstr; 00222 00223 g_cmn.dbg.WriteHeader(sstr, dbg_NORM, m_fcnID_p, m_fcnID_p.m_line); 00224 00225 sstr << "==> " << m_fcnID_p.m_buff; 00226 00227 g_cmn.dbg.Write(dbg_LOW, sstr); 00228 } 00229 }

| log_FunctionTracer::log_FunctionTracer | ( | const log_FunctionID & | a_fcnID_p, | |
| const string & | a_fcnArgs_p | |||
| ) |
Function entrance with parameters is written in the debug if level is > dbg_EXTAPI or dbg_INOUT flag is set.
Definition at line 237 of file log_functiontracer.cpp.
References cmn_Global::dbg, dbg_EXTAPI, dbg_INOUT, dbg_LOW, dbg_NORM, g_cmn, log_Debugger::GetFlags(), log_Debugger::GetLevel(), Init(), cmn_Global::IsDbgActive(), IVD_COUT_LOG_m, ivd_GetThreadStack(), log_FunctionID::m_buff, m_fcnID_p, m_inited, log_FunctionID::m_line, log_Debugger::Write(), and log_Debugger::WriteHeader().
00240 : m_fcnID_p(a_fcnID_p), 00241 m_fcnArgs_p(&a_fcnArgs_p) { 00242 IVD_COUT_LOG_m("log_FunctionTracer::log_FunctionTracer(ARG)") 00243 00244 if (!m_inited) { 00245 Init(); 00246 } 00247 00248 ivd_GetThreadStack()->push_back(this); 00249 00250 // Write function entrance 00251 if ( g_cmn.IsDbgActive() && 00252 ( (g_cmn.dbg.GetFlags() & dbg_INOUT) 00253 || g_cmn.dbg.GetLevel() >= dbg_EXTAPI) ) { 00254 00255 ostringstream sstr; 00256 g_cmn.dbg.WriteHeader(sstr, dbg_NORM, m_fcnID_p, m_fcnID_p.m_line); 00257 00258 sstr 00259 << "==> " << m_fcnID_p.m_buff 00260 << "(" << (*m_fcnArgs_p) << ")"; 00261 00262 g_cmn.dbg.Write(dbg_LOW, sstr); 00263 } 00264 }

| log_FunctionTracer::~log_FunctionTracer | ( | ) | [virtual] |
Definition at line 268 of file log_functiontracer.cpp.
References cmn_Global::dbg, dbg_INOUT, dbg_LOW, dbg_NORM, g_cmn, log_Debugger::GetFlags(), cmn_Global::IsDbgActive(), IVD_COUT_LOG_m, ivd_GetThreadStack(), log_FunctionID::m_buff, log_FunctionID::m_className, m_fcnID_p, log_FunctionID::m_funcName, log_FunctionID::m_line, size, log_Debugger::Write(), and log_Debugger::WriteHeader().
00268 { 00269 IVD_COUT_LOG_m(" log_FunctionTracer::~log_FunctionTracer " 00270 << m_fcnID_p.m_className << "::" 00271 << m_fcnID_p.m_funcName) 00272 00273 ivd_GetThreadStack()->pop_back(); 00274 00275 // Write function entrance 00276 if (g_cmn.IsDbgActive() && (g_cmn.dbg.GetFlags() & dbg_INOUT) ) { 00277 ostringstream sstr; 00278 g_cmn.dbg.WriteHeader(sstr, dbg_NORM, m_fcnID_p, m_fcnID_p.m_line); 00279 00280 sstr << "<== " << m_fcnID_p.m_buff; 00281 00282 g_cmn.dbg.Write(dbg_LOW, sstr); 00283 } 00284 #if TGT_OS_windows 00285 if (ivd_GetThreadStack()->size() == 0) { 00286 delete g_traceStack, g_traceStack = NULL; 00287 } 00288 #endif 00289 }

| void log_FunctionTracer::DumpStack | ( | ostream & | a_str | ) | [static] |
Dump current execution stack.
Definition at line 293 of file log_functiontracer.cpp.
References ivd_GetThreadStack().
Referenced by log_Output().
00293 { 00294 DumpStack(a_str, ivd_GetThreadStack()); 00295 }


| void log_FunctionTracer::DumpStack | ( | ostream & | a_str, | |
| log_TraceStack * | a_fstack | |||
| ) | [static] |
Definition at line 298 of file log_functiontracer.cpp.
References log_FunctionID::m_className, m_fcnArgs_p, m_fcnID_p, log_FileID::m_file, log_FunctionID::m_fileID, log_FunctionID::m_funcName, log_FunctionID::m_line, and log_FileID::m_revision.
00298 { 00299 a_str << endl << " Execution stack dump: " << endl; 00300 00301 vector<const log_FunctionTracer*>::reverse_iterator it; 00302 size_t i(a_fstack->size()); 00303 00304 for (it = a_fstack->rbegin(); it != a_fstack->rend(); ++it, --i) { 00305 00306 const log_FunctionTracer* fcn(*it); 00307 a_str << setw(8) << i << ". " 00308 << fcn->m_fcnID_p.m_className << "::" 00309 << fcn->m_fcnID_p.m_funcName; 00310 00311 if (fcn->m_fcnArgs_p != NULL) { 00312 a_str << "(" << *(fcn->m_fcnArgs_p) << ")"; 00313 } 00314 a_str 00315 << " " 00316 << fcn->m_fcnID_p.m_fileID.m_file << " " 00317 << fcn->m_fcnID_p.m_fileID.m_revision << ":" 00318 << fcn->m_fcnID_p.m_line 00319 << endl; 00320 } 00321 a_str << " End of stack dump." << endl; 00322 }
| log_TraceStack * log_FunctionTracer::GetStack | ( | ) | [static] |
Get pointer to this thread's stack.
Definition at line 327 of file log_functiontracer.cpp.
References ivd_GetThreadStack().
Referenced by ivd_BaseException::FormatText().
00327 { 00328 return ivd_GetThreadStack(); 00329 }


| void log_FunctionTracer::Init | ( | ) | [inline, private] |
Definition at line 185 of file log_functiontracer.cpp.
References ie_INVALID_ARG, IVD_COUT_LOG_m, ivd_Error, ivd_GetThreadStack(), m_inited, and ThreadKeyInit().
Referenced by log_FunctionTracer().
00185 { 00186 m_inited = true; 00187 #if IVD_POSIX_OS 00188 int result = pthread_once(&g_keyOnce, ThreadKeyInit); 00189 IVD_COUT_LOG_m("log_FunctionTracer::Init() g_keyOnce=" << g_keyOnce 00190 << " result=" << result) 00191 if (result != 0) { 00192 throw ivd_Error( 00193 ie_INVALID_ARG, 00194 "FATAL ERROR: g_idKey is not valid!", 00195 false); // DO NOT LOG: class used in logging! 00196 } 00197 #endif 00198 00199 // Get the stack that has just been created to initialize it immediatelly. 00200 (void) ivd_GetThreadStack(); 00201 }


Definition at line 141 of file logid.h.
Referenced by DumpStack(), ivd_BaseException::FormatText(), log_FunctionTracer(), log_Output(), and ~log_FunctionTracer().
| const string* log_FunctionTracer::m_fcnArgs_p |
bool log_FunctionTracer::m_inited [static, private] |
1.5.6