This is Unofficial EPICS BASE Doxygen Site
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
osdBackTrace.cpp
Go to the documentation of this file.
1
/*
2
* Copyright: Stanford University / SLAC National Laboratory.
3
*
4
* EPICS BASE is distributed subject to a Software License Agreement found
5
* in file LICENSE that is included with this distribution.
6
*
7
* Author: Till Straumann <strauman@slac.stanford.edu>, 2014
8
*/
9
10
#include <ucontext.h>
11
12
#include "
epicsStackTracePvt.h
"
13
14
struct
wlk
{
15
void
**
buf
;
16
int
max
;
17
int
cur
;
18
};
19
20
21
extern
"C"
{
22
23
static
int
24
walker(uintptr_t addr,
int
sig,
void
*arg)
25
{
26
struct
wlk
*w_p = (
struct
wlk
*)arg;
27
if
( w_p->
cur
< w_p->
max
)
28
w_p->
buf
[w_p->
cur
++] = (
void
*)addr;
29
return
0;
30
}
31
32
}
33
34
int
epicsBackTrace
(
void
**
buf
,
int
buf_sz)
35
{
36
ucontext_t u;
37
struct
wlk
d;
38
d.
buf
=
buf
;
39
d.
max
= buf_sz;
40
d.
cur
= 0;
41
if
( getcontext(&u) )
42
return
-1;
43
walkcontext( &u, walker, &d );
44
return
d.
cur
;
45
}
epicsStackTracePvt.h
wlk
Definition:
osdBackTrace.cpp:14
epicsBackTrace
int epicsBackTrace(void **buf, int buf_sz)
Definition:
osdBackTrace.cpp:12
wlk::cur
int cur
Definition:
osdBackTrace.cpp:17
wlk::buf
void ** buf
Definition:
osdBackTrace.cpp:15
wlk::max
int max
Definition:
osdBackTrace.cpp:16
modules
libcom
src
osi
os
solaris
osdBackTrace.cpp
Generated by
1.8.11