Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
fb290604
Commit
fb290604
authored
Aug 21, 2014
by
Uwe Schulzweida
Browse files
reshGetElem: call show_stackframe() to print a backtrace
parent
985d9e9a
Changes
5
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
fb290604
...
...
@@ -3,6 +3,10 @@
* Version 1.7.0 released
* using CGRIBEX library version 1.7.0
2014-08-21 Uwe Schulzweida
* reshGetElem: call show_stackframe() to print a backtrace
2014-08-20 Uwe Schulzweida
* added CDI function gribapiLibraryVersion(major_version, minor_version, revision_version) [Feature #5043]
...
...
configure
View file @
fb290604
...
...
@@ -24337,6 +24337,18 @@ fi
done
for ac_header in execinfo.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default"
if test "x$ac_cv_header_execinfo_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_EXECINFO_H 1
_ACEOF
fi
done
# ----------------------------------------------------------------------
# Checks for the availability of functions
for ac_func in mallinfo
...
...
configure.ac
View file @
fb290604
...
...
@@ -65,6 +65,7 @@ AC_CHECK_MEMBERS([struct stat.st_blksize])
# ----------------------------------------------------------------------
# Checks for header files
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_HEADERS(execinfo.h)
# ----------------------------------------------------------------------
# Checks for the availability of functions
AC_CHECK_FUNCS([mallinfo])
...
...
src/config.h.in
View file @
fb290604
...
...
@@ -23,6 +23,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
/* Define to 1 if you have the `getline' function. */
#undef HAVE_GETLINE
...
...
src/resource_handle.c
View file @
fb290604
...
...
@@ -9,6 +9,23 @@
#include
<stdlib.h>
#include
<stdio.h>
#if defined (HAVE_EXECINFO_H)
#include
<execinfo.h>
#endif
static
void
show_stackframe
()
{
#if defined (HAVE_EXECINFO_H)
void
*
trace
[
16
];
size_t
trace_size
=
backtrace
(
trace
,
16
);
char
**
messages
=
backtrace_symbols
(
trace
,
trace_size
);
fprintf
(
stderr
,
"[bt] Execution path:
\n
"
);
for
(
size_t
i
=
0
;
i
<
trace_size
;
++
i
)
fprintf
(
stderr
,
"[bt] %s
\n
"
,
messages
[
i
]);
#endif
}
#include
"dmemory.h"
#include
"resource_handle.h"
#include
"namespace.h"
...
...
@@ -379,13 +396,17 @@ reshGetElem(const char *caller, cdiResH resH, const resOps *ops)
else
{
LIST_UNLOCK
();
show_stackframe
();
xabortC
(
caller
,
"Invalid namespace %d or index %d for resource handle %d when using namespace %d of size %d!"
,
nspT
.
nsp
,
nspT
.
idx
,
(
int
)
resH
,
nsp
,
resHList
[
nsp
].
size
);
}
if
(
!
(
listElem
&&
listElem
->
res
.
v
.
ops
==
ops
)
)
xabortC
(
caller
,
"Invalid resource handle %d, list element not found!"
,
(
int
)
resH
);
{
show_stackframe
();
xabortC
(
caller
,
"Invalid resource handle %d, list element not found!"
,
(
int
)
resH
);
}
return
listElem
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment