14#if defined(__GNU_LIBRARY__)
29 std::string
empty =
"" ;
40 if (s_host_type.empty()) build_host_type() ;
49#if defined(DEBUG_LEVEL)
57 default_qualifiers.push_back(qualif) ;
72 const std::string &compiler_name,
const std::string &compiler_version,
73 const std::string &compilation_time,
const std::string &compilation_date,
74 const std::string &package_name) {
75 this->m_file_name = filename ;
76 this->m_line_number = line_number ;
77 this->m_function_name = function_name ;
78 this->m_compiler_name = compiler_name ;
79 this->m_compiler_version = compiler_version ;
80 this->m_compilation_date = compilation_date ;
81 this->m_compilation_time = compilation_time ;
82 this->m_package_name = package_name ;
83#if defined(__GNU_LIBRARY__)
85 const int n_size = backtrace (array,128) ;
86 char ** symbols = backtrace_symbols(array, n_size);
87 for (
int i = 1; i < n_size; i++) {
88 this->m_stack_frames.push_back(symbols[i]);
107 return m_line_number ;
115 return m_function_name ;
125 if (m_position.empty()) {
126 std::ostringstream position_s ;
127 if (! m_package_name.empty()) {
128 position_s << m_package_name <<
":" ;
130 if (! m_file_name.empty()) {
131 const std::string::size_type p = m_file_name.rfind(
'/') ;
132 if (std::string::npos == p) {
133 position_s << m_file_name ;
135 position_s << (m_file_name.substr(p+1)) ;
137 position_s <<
":" << m_line_number <<
" ";
139 if (! m_function_name.empty()) {
140 position_s <<
"(" << m_function_name <<
")" ;
142 m_position = position_s.str();
152 if (m_compiler.empty()) {
153 if (! m_compiler_name.empty()) {
154 std::ostringstream compiler_s ;
155 compiler_s << m_compiler_name <<
" " << m_compiler_version ;
156 m_compiler = compiler_s.str();
158 m_compiler =
"unknown" ;
169 if (m_compilation.empty()) {
170 std::ostringstream compilation_s ;
171 if (! m_compilation_time.empty()) {
172 compilation_s << m_compilation_time <<
" " ;
174 if (! m_compilation_date.empty()) {
175 compilation_s << m_compilation_date ;
177 m_compilation = compilation_s.str();
179 return m_compilation ;
186 return m_package_name ;
190 std::ostringstream plateform_s ;
191#if defined(__linux__)
192 plateform_s <<
"linux" ;
194#if defined(__OpenBSD__)
195 plateform_s <<
"OpenBSD" ;
197#if defined(__FreeBSD__)
198 plateform_s <<
"FreeBSD" ;
200#if defined(__APPLE__) && defined(__MACH__)
201 plateform_s <<
"Darwin" ;
203#if defined(__SOLARIS__)
204 plateform_s <<
"Solaris" ;
207#if defined(__POWERPC__) || defined(__ppc__ ) || defined( __PPC__ ) || defined( powerpc ) || defined( ppc )
208 plateform_s <<
"PowerPC" ;
210#if defined(__i386__) || defined(__INTEL__) || defined( intel ) || defined( _M_IX86 )
211 plateform_s <<
"i386" ;
213#if defined(sparc) || defined(__sparc)
214 plateform_s <<
"Sparc" ;
216 s_host_type= plateform_s.str();
220 return m_stack_frames.size();
224 return m_stack_frames[i] ;
233 std::vector<std::string> qualif = default_qualifiers ;
234 if (! m_package_name.empty()) {
235 qualif.push_back(m_package_name) ;
Source context for Issue.
static std::string s_host_type
static const Context * empty()
const std::string & package_name() const
const std::string & stack_frame(int i) const
std::vector< std::string > qualifiers() const
const std::string & compiler() const
static void build_host_type()
static std::vector< std::string > default_qualifiers
const std::string & compilation() const
static void add_qualifier(const std::string &qualif)
const std::string & position() const
static std::string & host_type()
type of target host
Context(const std::string &filename, int line_number, const std::string &function_name, const std::string &compiler_name, const std::string &compiler_version, const std::string &compilation_time, const std::string &compilation_date, const std::string &package)
const std::string & file() const
const std::string & function() const
static Context * empty_instance