This is Unofficial EPICS BASE Doxygen Site
epics::pvData::ExceptionMixin Class Reference

#include "epicsException.h"

+ Inheritance diagram for epics::pvData::ExceptionMixin:

Public Member Functions

 ExceptionMixin (const char *file, int line)
 
void print (FILE *fp=stderr) const
 
std::string show () const
 

Detailed Description

Definition at line 72 of file epicsException.h.

Constructor & Destructor Documentation

epics::pvData::ExceptionMixin::ExceptionMixin ( const char *  file,
int  line 
)
inline

Definition at line 81 of file epicsException.h.

82  :m_file(file)
83  ,m_line(line)
84 #if defined(EXCEPT_USE_BACKTRACE)
85  {
86  m_depth=backtrace(m_stack,EXCEPT_DEPTH);
87  }
88 #elif defined(EXCEPT_USE_CAPTURE)
89  {
90  m_depth=CaptureStackBackTrace(0,EXCEPT_DEPTH,m_stack,0);
91  }
92 #else
93  {}
#define EXCEPT_DEPTH
char * line
Definition: reader.c:25

Member Function Documentation

void epics::pvData::ExceptionMixin::print ( FILE *  fp = stderr) const

Definition at line 23 of file epicsException.cpp.

24 {
25  fprintf(fp, "On line %d of %s\n",m_line,m_file);
26 
27 #if defined(EXCEPT_USE_BACKTRACE)
28  if(m_depth>0) {
29  fflush(fp); // must flush before using raw handle
30  backtrace_symbols_fd(m_stack, m_depth, fileno(fp));
31  fprintf(fp, "To translate run 'addr2line -e execname 0xXXXXXXX ...'\n"
32  " Note: Must be compiled with debug symbols\n");
33  }
34 #endif
35 }
string epics::pvData::ExceptionMixin::show ( ) const

Definition at line 38 of file epicsException.cpp.

39 {
40  std::ostringstream out;
41 
42  out<<"On line "<<m_line<<" of "<<m_file<<"\n";
43 
44 #if defined(EXCEPT_USE_BACKTRACE)
45  if (m_depth>0) {
46 
47  char **symbols=backtrace_symbols(m_stack, m_depth);
48 
49  for(int i=0; i<m_depth; i++) {
50  out<<symbols[i]<<"\n";
51  }
52 
53  std::free(symbols);
54  }
55 
56 #endif
57  return out.str();
58 }
int i
Definition: scan.c:967

The documentation for this class was generated from the following files: