]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/assert: record assert info in g_assert_* globals
authorSage Weil <sage@redhat.com>
Sat, 16 Jun 2018 02:53:32 +0000 (21:53 -0500)
committerSage Weil <sage@redhat.com>
Tue, 19 Jun 2018 18:36:52 +0000 (13:36 -0500)
These will then be available for others who are interested.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/assert.cc
src/global/global_context.cc
src/global/global_context.h

index 4501c8b38a1c19a8e68413ac7d4e05066d96ad42..45d44d12ea1aaf6fc2139fd01b34ded008d4b624 100644 (file)
@@ -35,6 +35,14 @@ namespace ceph {
   void __ceph_assert_fail(const char *assertion, const char *file, int line,
                          const char *func)
   {
+    g_assert_condition = assertion;
+    g_assert_file = file;
+    g_assert_line = line;
+    g_assert_func = func;
+    g_assert_thread = (unsigned long long)pthread_self();
+    pthread_getname_np(pthread_self(), g_assert_thread_name,
+                      sizeof(g_assert_thread_name));
+
     ostringstream tss;
     tss << ceph_clock_now();
 
@@ -75,6 +83,14 @@ namespace ceph {
     ostringstream tss;
     tss << ceph_clock_now();
 
+    g_assert_condition = assertion;
+    g_assert_file = file;
+    g_assert_line = line;
+    g_assert_func = func;
+    g_assert_thread = (unsigned long long)pthread_self();
+    pthread_getname_np(pthread_self(), g_assert_thread_name,
+                      sizeof(g_assert_thread_name));
+
     class BufAppender {
     public:
       BufAppender(char* buf, int size) : bufptr(buf), remaining(size) {
index 05f76321ca3d9d622c84ded10904f27565779983..9e511d44da95fec85580f4c9a69da46c8acb73cb 100644 (file)
  */
 CephContext *g_ceph_context = NULL;
 md_config_t *g_conf = NULL;
+
+const char *g_assert_file = 0;
+int g_assert_line = 0;
+const char *g_assert_func = 0;
+const char *g_assert_condition = 0;
+unsigned long long g_assert_thread = 0;
+char g_assert_thread_name[4096];
index 29e5a973eb51d7a8e17ea9c85eb8f3cf3299a67e..9ac4388d08a260994e92f2661ce2d72aef24c2e8 100644 (file)
@@ -21,4 +21,11 @@ struct md_config_t;
 extern CephContext *g_ceph_context;
 extern md_config_t *g_conf;
 
+extern const char *g_assert_file;
+extern int g_assert_line;
+extern const char *g_assert_func;
+extern const char *g_assert_condition;
+extern unsigned long long g_assert_thread;
+extern char g_assert_thread_name[4096];
+
 #endif