#include <stdio.h>
#include <string.h>
#include "omConfig.h"
#include "omDerivedConfig.h"
#include "omStructs.h"
#include "omRet2Info.h"
#include "omGetBackTrace.h"
Go to the source code of this file.
|
void | omInitRet_2_Info (const char *argv0) |
|
int | omBackTrace_2_RetInfo (void **bt, omRetInfo info, int max) |
|
int | omPrintRetInfo (omRetInfo info, int max, FILE *fd, const char *fmt) |
|
int | omPrintBackTrace (void **bt, int max, FILE *fd) |
|
int | omPrintCurrentBackTraceMax (FILE *fd, int max) |
|
int | omFilterRetInfo_i (omRetInfo info, int max, int i) |
|
int | _omPrintBackTrace (void **bt, int max, FILE *fd, OM_FLR_DECL) |
|
int | _omPrintCurrentBackTrace (FILE *fd, OM_FLR_DECL) |
|
#define OM_MAX_BACKTRACE_DEPTH 16 |
int _omPrintBackTrace |
( |
void ** |
bt, |
|
|
int |
max, |
|
|
FILE * |
fd, |
|
|
OM_FLR_DECL |
|
|
) |
| |
Definition at line 200 of file omRet2Info.c.
219 #ifdef OM_TRACK_RETURN
223 #ifndef OM_INTERNAL_DEBUG
226 #ifdef OM_TRACK_RETURN
230 #ifdef OM_TRACK_FILE_LINE
232 omFilterRetInfo(info, i, strcmp(
f, file_i) == 0 &&
l + 2 >= line_i &&
l - 2 <= line_i);
236 #if defined(OM_TRACK_RETURN) && defined(OM_TRACK_FILE_LINE)
237 if (
r !=
NULL && info[0].addr ==
r &&
l > 0 &&
f != 0)
239 strcpy(info[0].file,
f);
248 #ifdef OM_TRACK_FILE_LINE
249 fprintf(
fd,
" %s:%d",
f,
l);
251 #ifdef OM_TRACK_RETURN
252 fprintf(
fd,
" ra=%p",
r);
255 #ifndef OM_INTERNAL_DEBUG
260 #ifdef OM_PRINT_RETURN_ADDRESS
#define omFilterRetInfo(info, max, cond)
#define OM_MAX_BACKTRACE_DEPTH
static int max(int a, int b)
int omBackTrace_2_RetInfo(void **bt, omRetInfo info, int max)
int omPrintRetInfo(omRetInfo info, int max, FILE *fd, const char *fmt)
int _omPrintCurrentBackTrace |
( |
FILE * |
fd, |
|
|
OM_FLR_DECL |
|
|
) |
| |
Definition at line 270 of file omRet2Info.c.
#define OM_MAX_BACKTRACE_DEPTH
#define omGetBackTrace(bt, s, max)
int _omPrintBackTrace(void **bt, int max, FILE *fd, OM_FLR_DECL)
int omBackTrace_2_RetInfo |
( |
void ** |
bt, |
|
|
omRetInfo |
info, |
|
|
int |
max |
|
) |
| |
Definition at line 46 of file omRet2Info.c.
48 int i=0,
j=0, filled = 0;
51 memset(
info, 0,
max*
sizeof(omRetInfo_t));
63 #if defined(HAVE_POPEN) && defined(OM_PROG_ADDR2LINE)
69 l = sprintf(
command,
"%s -s -C -f -e %s",
85 while ((filled <
j) &&
86 (fscanf(pipe,
"%200[^\n]\n%200[^:]:%d\n",
info[filled].func,
info[filled].file, &(
info[filled].line)) == 3))
88 if (*
info[filled].func !=
'?' && *
info[filled].file !=
'?' &&
info[filled].line > 0)
#define OM_MAX_BACKTRACE_DEPTH
static int max(int a, int b)
static char om_this_prog[MAXPATHLEN]
int omFilterRetInfo_i |
( |
omRetInfo |
info, |
|
|
int |
max, |
|
|
int |
i |
|
) |
| |
void omInitRet_2_Info |
( |
const char * |
argv0 | ) |
|
Definition at line 34 of file omRet2Info.c.
static char om_this_prog[MAXPATHLEN]
int omPrintBackTrace |
( |
void ** |
bt, |
|
|
int |
max, |
|
|
FILE * |
fd |
|
) |
| |
Definition at line 150 of file omRet2Info.c.
158 #ifdef OM_PRINT_RETURN_ADDRESS
#define OM_MAX_BACKTRACE_DEPTH
static int max(int a, int b)
int omBackTrace_2_RetInfo(void **bt, omRetInfo info, int max)
int omPrintRetInfo(omRetInfo info, int max, FILE *fd, const char *fmt)
int omPrintCurrentBackTraceMax |
( |
FILE * |
fd, |
|
|
int |
max |
|
) |
| |
Definition at line 165 of file omRet2Info.c.
171 if (
max <= 0)
return 0;
#define OM_MAX_BACKTRACE_DEPTH
static int max(int a, int b)
#define omGetBackTrace(bt, s, max)
int omPrintBackTrace(void **bt, int max, FILE *fd)
int omPrintRetInfo |
( |
omRetInfo |
info, |
|
|
int |
max, |
|
|
FILE * |
fd, |
|
|
const char * |
fmt |
|
) |
| |
Definition at line 99 of file omRet2Info.c.
111 if (fmt[l] ==
'p') fprintf(
fd,
"%p",
info[i].addr);
112 else if (fmt[l] ==
'f') fprintf(
fd,
"%-20s", (*
info[i].file !=
'\0' ?
info[i].file :
"??"));
113 else if (fmt[l] ==
'F') fprintf(
fd,
"%-20s", (*
info[i].func !=
'\0' ?
info[i].func :
"??"));
114 else if (fmt[l] ==
'l') fprintf(
fd,
"%d",
info[i].line);
115 else if (fmt[l] ==
'N')
117 if (*
info[i].func !=
'\0')
119 char*
found = (
char*) strchr(
info[i].func,
'(');
120 if (found) *found =
'\0';
121 fprintf(
fd,
"%-20s",
info[i].func);
122 if (found) *found =
'(';
125 fprintf(
fd,
"%-20s",
"??");
127 else if (fmt[l] ==
'L')
129 int n = fprintf(
fd,
"%s:%d", (*
info[i].func !=
'\0' ?
info[i].file :
"??"),
info[i].line);
130 if (n < 20) fprintf(
fd,
"%*s", 20-n,
" ");
132 else if (fmt[l] ==
'i') fprintf(
fd,
"%d", i);
const CanonicalForm CFMap CFMap int &both_non_zero int n
static int max(int a, int b)