My Project  debian-1:4.1.1-p2+ds-4build1
omRet2Info.h
Go to the documentation of this file.
1 /*******************************************************************
2  * File: omAddr2Info.h
3  * Purpose: translation of return addr to RetInfo
4  * Author: obachman (Olaf Bachmann)
5  * Created: 11/99
6  *******************************************************************/
7 #ifndef OM_RET_2_INFO_H
8 #define OM_RET_2_INFO_H
9 
10 
11 struct omRetInfo_s
12 {
13  void* addr;
14  char func[200]; /* if you change these numbers, alos change */
15  char file[200]; /* the fscanf statement in BackTrace_2_RetInfo */
16  int line;
17 };
18 
19 /* print to fd array of max RetInfo's and use fmt as format string for one RetInfo.
20  The following conversions are recognized:
21  %i -- number of return addr
22  %p -- address (in hex)
23  %F -- function name with arguments (for C++, only)
24  %N -- funtion name without arguments
25  %f -- file
26  %l -- line
27  %L -- file:line
28  return how many lines were printed */
29 #ifndef OM_NDEBUG
30 int omPrintRetInfo(omRetInfo info, int max, FILE *fd, const char* fmt);
31 /* translate array of max BackTrace addresses into array of max RetInfos
32  return how many were translated */
33 int omBackTrace_2_RetInfo(void** bt, omRetInfo info, int max);
34 
35 /* call with argv[0] to enable RetInfo translations */
36 void omInitRet_2_Info(const char* argv0);
37 
38 int omPrintBackTrace(void** bt, int max, FILE* fd);
39 #define omPrintCurrentBackTrace(fd) omPrintCurrentBackTraceMax(fd, 1000)
40 int omPrintCurrentBackTraceMax(FILE* fd, int max);
41 
42 int omFilterRetInfo_i(omRetInfo info, int max, int i);
43 
44 #define omFilterRetInfo(info, max, cond) \
45 do \
46 { \
47  int _max = max; \
48  int _i = max -1; \
49  while (_i > 0) \
50  { \
51  void* addr_i = info[_i].addr; \
52  char* file_i = info[_i].file; \
53  char* func_i = info[_i].func; \
54  int line_i = info[_i].line; \
55  \
56  if (cond) \
57  max = omFilterRetInfo_i(info, max, _i); \
58  _i--; \
59  } \
60 } \
61 while (0)
62 
63 
64 /*BEGINPRIVATE*/
65 int _omPrintBackTrace(void** bt, int max, FILE* fd , OM_FLR_DECL);
66 int _omPrintCurrentBackTrace(FILE* fd , OM_FLR_DECL);
67 /*ENDPRIVATE*/
68 
69 #else /* OM_NDEBUG */
70 #define omPrintRetInfo(i, max, fd, fmt) do {} while (0)
71 #define omBackTrace_2_RetInfo(bt, i, m) do {} while (0)
72 #define omInitRet_2_Info(a) do {} while (0)
73 #define omPrintBackTrace(bt,max,fd) do {} while (0)
74 #define omPrintCurrentBackTrace(fd) do {} while (0)
75 #define omPrintCurrentBackTraceMax(fd,max) do {} while (0)
76 #define omFilterRetInfo_i(info,max,i) do {} while (0)
77 #define omFilterRetInfo(info, max, cond)do {} while (0)
78 #endif /* ! OM_NDEBUG */
79 
80 #endif /* OM_RET_2_INFO_H */
omRetInfo_s::addr
void * addr
Definition: omRet2Info.h:16
omRetInfo_s::file
char file[200]
Definition: omRet2Info.h:18
_omPrintBackTrace
int _omPrintBackTrace(void **bt, int max, FILE *fd, OM_FLR_DECL)
Definition: omRet2Info.c:197
omRetInfo_s::func
char func[200]
Definition: omRet2Info.h:17
omFilterRetInfo_i
int omFilterRetInfo_i(omRetInfo info, int max, int i)
Definition: omRet2Info.c:179
omRetInfo_s::line
int line
Definition: omRet2Info.h:19
_omPrintCurrentBackTrace
int _omPrintCurrentBackTrace(FILE *fd, OM_FLR_DECL)
Definition: omRet2Info.c:267
omPrintCurrentBackTraceMax
int omPrintCurrentBackTraceMax(FILE *fd, int max)
Definition: omRet2Info.c:164
omBackTrace_2_RetInfo
int omBackTrace_2_RetInfo(void **bt, omRetInfo info, int max)
Definition: omRet2Info.c:45
i
int i
Definition: cfEzgcd.cc:125
argv0
char * argv0
Definition: coeffs_test_runner.cpp:14
max
static int max(int a, int b)
Definition: fast_mult.cc:264
omRetInfo
omRetInfo_t * omRetInfo
Definition: omStructs.h:33
omPrintBackTrace
int omPrintBackTrace(void **bt, int max, FILE *fd)
Definition: omRet2Info.c:149
omRetInfo_s
Definition: omRet2Info.h:10
omInitRet_2_Info
void omInitRet_2_Info(const char *argv0)
Definition: omRet2Info.c:33
fd
int status int fd
Definition: si_signals.h:58
info
const ExtensionInfo & info
< [in] sqrfree poly
Definition: facFqFactorize.h:38
omPrintRetInfo
int omPrintRetInfo(omRetInfo info, int max, FILE *fd, const char *fmt)
Definition: omRet2Info.c:98