[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2-29-g7759216

Service Account noreply at mpich.org
Wed Dec 16 15:12:07 CST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  77592165aa38afc218e2f3f5913be4a7e3ef923c (commit)
      from  59f3540a5b8e69e363bc972a7d1194e04592a692 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/77592165aa38afc218e2f3f5913be4a7e3ef923c

commit 77592165aa38afc218e2f3f5913be4a7e3ef923c
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Wed Dec 9 16:41:36 2015 -0600

    some backtrace cleanup to remove warnings
    
    - use preprocessor to compile just one of our backtrace options
    - configure checks if we need a prototype or not
    
    Signed-off-by: Sangmin Seo <sseo at anl.gov>

diff --git a/src/mpl/configure.ac b/src/mpl/configure.ac
index d4cdb0d..aa4cf7f 100644
--- a/src/mpl/configure.ac
+++ b/src/mpl/configure.ac
@@ -206,6 +206,8 @@ AC_CHECK_FUNCS(backtrace_symbols)
 AC_CHECK_LIB(backtrace, backtrace_create_state)
 AC_CHECK_LIB(unwind, unw_backtrace)
 
+AC_CHECK_DECLS([backtrace_create_state, backtrace_print])
+
 dnl Check for ATTRIBUTE
 PAC_C_GNU_ATTRIBUTE
 
diff --git a/src/mpl/include/mplutil.h b/src/mpl/include/mplutil.h
index 2937751..0873175 100644
--- a/src/mpl/include/mplutil.h
+++ b/src/mpl/include/mplutil.h
@@ -13,6 +13,19 @@
 extern "C" {
 #endif
 
+#if !MPL_HAVE_DECL_BACKTRACE_CREATE_STATE
+struct backtrace_state;
+typedef void (*backtrace_error_callback)(void *data, const char *msg,
+                                         int errnum);
+
+extern struct backtrace_state *backtrace_create_state(
+        const char *filename, int threaded,
+        backtrace_error_callback error_callback, void *data);
+#endif
+#if !MPL_HAVE_DECL_BACKTRACE_PRINT
+extern void backtrace_print(struct backtrace_state *state, int skip, FILE *);
+#endif
+
 #define MPL_BACKTRACE_BUFFER_LEN 1024
 #define MPL_MAX_TRACE_DEPTH 32
 void MPL_backtrace_show(FILE *output);
diff --git a/src/mpl/src/mplutil.c b/src/mpl/src/mplutil.c
index c55dd38..5abd999 100644
--- a/src/mpl/src/mplutil.c
+++ b/src/mpl/src/mplutil.c
@@ -36,48 +36,15 @@
  *
  */
 
-#ifdef MPL_HAVE_BACKTRACE_SYMBOLS
-static inline void backtrace_libc(FILE *output)
-{
-#ifndef MPL_MAX_TRACE_DEPTH
-#define MPL_MAX_TRACE_DEPTH 32
-#endif
-    void *trace[MPL_MAX_TRACE_DEPTH];
-    char **stack_strs;
-    char backtrace_buffer[MPL_BACKTRACE_BUFFER_LEN];
-    int frames, i, ret, chars = 0;
-
-    frames = backtrace(trace, MPL_MAX_TRACE_DEPTH);
-    stack_strs = backtrace_symbols(trace, frames);
-
-    for (i = 0; i < frames; i++) {
-        ret = MPL_snprintf(backtrace_buffer + chars,
-                       MPL_BACKTRACE_BUFFER_LEN - chars,
-                       "%s\n", stack_strs[i]);
-        if (ret + chars >= MPL_BACKTRACE_BUFFER_LEN) {
-            /* the extra new line will be more readable than a merely
-             * truncated string */
-            backtrace_buffer[MPL_BACKTRACE_BUFFER_LEN - 2] = '\n';
-            backtrace_buffer[MPL_BACKTRACE_BUFFER_LEN - 1] = '\0';
-            break;
-        }
-        chars += ret;
-    }
-    fprintf(output, "%s", backtrace_buffer);
-    free(stack_strs);
-}
-#endif
-
 #ifdef MPL_HAVE_LIBBACKTRACE
+
 static inline void backtrace_libback(FILE *output)
 {
     struct backtrace_state *btstate;
     btstate = backtrace_create_state(NULL, 1, NULL, NULL);
     backtrace_print(btstate, 0, output);
 }
-#endif
-
-#ifdef MPL_HAVE_LIBUNWIND
+#elif defined MPL_HAVE_LIBUNWIND
 static inline void backtrace_libunwind(FILE *output)
 {
     unw_cursor_t cursor;
@@ -108,12 +75,43 @@ static inline void backtrace_libunwind(FILE *output)
     }
     fprintf(output, "%s", backtrace_buffer);
 }
+
+#elif defined MPL_HAVE_BACKTRACE_SYMBOLS
+static inline void backtrace_libc(FILE *output)
+{
+#ifndef MPL_MAX_TRACE_DEPTH
+#define MPL_MAX_TRACE_DEPTH 32
 #endif
+    void *trace[MPL_MAX_TRACE_DEPTH];
+    char **stack_strs;
+    char backtrace_buffer[MPL_BACKTRACE_BUFFER_LEN];
+    int frames, i, ret, chars = 0;
+
+    frames = backtrace(trace, MPL_MAX_TRACE_DEPTH);
+    stack_strs = backtrace_symbols(trace, frames);
 
+    for (i = 0; i < frames; i++) {
+        ret = MPL_snprintf(backtrace_buffer + chars,
+                       MPL_BACKTRACE_BUFFER_LEN - chars,
+                       "%s\n", stack_strs[i]);
+        if (ret + chars >= MPL_BACKTRACE_BUFFER_LEN) {
+            /* the extra new line will be more readable than a merely
+             * truncated string */
+            backtrace_buffer[MPL_BACKTRACE_BUFFER_LEN - 2] = '\n';
+            backtrace_buffer[MPL_BACKTRACE_BUFFER_LEN - 1] = '\0';
+            break;
+        }
+        chars += ret;
+    }
+    fprintf(output, "%s", backtrace_buffer);
+    free(stack_strs);
+}
+#else
 static inline void backtrace_unsupported(FILE *output)
 {
     fprintf(output, "No backtrace info available\n");
 }
+#endif
 
 /* Pick one of the many ways one could dump out a call stack*/
 void MPL_backtrace_show(FILE *output)

-----------------------------------------------------------------------

Summary of changes:
 src/mpl/configure.ac      |    2 +
 src/mpl/include/mplutil.h |   13 ++++++++
 src/mpl/src/mplutil.c     |   68 ++++++++++++++++++++++-----------------------
 3 files changed, 48 insertions(+), 35 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list