harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ibere...@apache.org
Subject svn commit: r926414 - in /harmony/enhanced/trunk/drlvm/vm: port/src/crash_handler/ port/src/crash_handler/em64t/ port/src/crash_handler/linux/ port/src/modules/ vmcore/src/util/
Date Tue, 23 Mar 2010 00:22:40 GMT
Author: iberezhn
Date: Tue Mar 23 00:22:40 2010
New Revision: 926414

URL: http://svn.apache.org/viewvc?rev=926414&view=rev
Log:
Fix crashes in crash handler when /proc is not mounted

Modified:
    harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/em64t/native_unwind_arch.cpp
    harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/linux/stack_dump_os.cpp
    harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/native_unwind.cpp
    harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/stack_dump.cpp
    harmony/enhanced/trunk/drlvm/vm/port/src/modules/native_modules.c
    harmony/enhanced/trunk/drlvm/vm/vmcore/src/util/crash_dump.cpp

Modified: harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/em64t/native_unwind_arch.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/em64t/native_unwind_arch.cpp?rev=926414&r1=926413&r2=926414&view=diff
==============================================================================
--- harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/em64t/native_unwind_arch.cpp (original)
+++ harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/em64t/native_unwind_arch.cpp Tue
Mar 23 00:22:40 2010
@@ -47,7 +47,7 @@ static bool native_check_caller(UnwindCo
 {
     void* target = NULL;
     char* ptr = (char*)*sp;
-    
+
     if (native_dec_instr(context, ptr - 2, &target) == 2 || // CALL r/m64 w/o SIB w/o
disp
         native_dec_instr(context, ptr - 3, &target) == 3 || // CALL r/m64 w/ SIB w/o
disp
         native_dec_instr(context, ptr - 4, &target) == 4 || // CALL r/m64 w/ SIB w/ disp8

Modified: harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/linux/stack_dump_os.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/linux/stack_dump_os.cpp?rev=926414&r1=926413&r2=926414&view=diff
==============================================================================
--- harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/linux/stack_dump_os.cpp (original)
+++ harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/linux/stack_dump_os.cpp Tue Mar
23 00:22:40 2010
@@ -56,8 +56,8 @@ static inline native_segment_t* sd_find_
 
 void sd_get_c_method_info(CFunInfo* info, native_module_t* module, void* ip)
 {
-    *info->name = 0;
-    *info->filename = 0;
+    *info->name = '\0';
+    *info->filename = '\0';
     info->line = -1;
 
     if (!module || !module->filename)
@@ -183,16 +183,24 @@ void sd_init_crash_handler()
 
 void sd_cleanup_crash_handler()
 {
-    STD_FREE(g_curdir);
-    STD_FREE(g_cmdline);
+    if (g_curdir)
+        STD_FREE(g_curdir);
+    if (g_cmdline)
+        STD_FREE(g_cmdline);
 }
 
 void sd_print_cmdline_cwd()
 {
     fprintf(stderr, "\nCommand line:\n");
-    for (const char* ptr = g_cmdline; *ptr; ptr += strlen(ptr) + 1)
-        fprintf(stderr, "%s ", ptr);
-    fprintf(stderr, "\n");
+
+    if (g_cmdline)
+    {
+        for (const char* ptr = g_cmdline; *ptr; ptr += strlen(ptr) + 1)
+            fprintf(stderr, "%s ", ptr);
+        fprintf(stderr, "\n");
+    }
+    else
+        fprintf(stderr, "is unavailable, probably /proc is not mounted\n");
 
     fprintf(stderr, "\nWorking directory:\n%s\n", g_curdir ? g_curdir : "'null'");
 }

Modified: harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/native_unwind.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/native_unwind.cpp?rev=926414&r1=926413&r2=926414&view=diff
==============================================================================
--- harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/native_unwind.cpp (original)
+++ harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/native_unwind.cpp Tue Mar 23 00:22:40
2010
@@ -44,6 +44,9 @@ bool port_init_unwind_context(UnwindCont
     if (!context)
         return false;
 
+    context->clean_modules = false;
+    context->modules = NULL;
+
     if (!modules)
     {
         int mod_count;
@@ -56,15 +59,13 @@ bool port_init_unwind_context(UnwindCont
         context->modules = mod_list;
     }
     else
-    {
-        context->clean_modules = false;
         context->modules = modules;
-    }
 
     if (!native_get_stack_range(context, regs, &context->stack))
     {
         if (context->clean_modules)
             port_clear_modules(&context->modules);
+        context->clean_modules = false;
         return false;
     }
 

Modified: harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/stack_dump.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/stack_dump.cpp?rev=926414&r1=926413&r2=926414&view=diff
==============================================================================
--- harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/stack_dump.cpp (original)
+++ harmony/enhanced/trunk/drlvm/vm/port/src/crash_handler/stack_dump.cpp Tue Mar 23 00:22:40
2010
@@ -40,7 +40,7 @@ static void sd_fill_modules()
 
     int count;
     bool res = port_get_all_modules(&g_modules, &count);
-    assert(res && g_modules && count);
+    assert((res && count) || !g_modules);
 }
 
 
@@ -104,8 +104,12 @@ static void sd_print_vm_line(FILE* file,
 
 static void sd_print_c_line(FILE* file, int count, Registers* regs, CFunInfo* cfi)
 {
-    if (!cfi->name)
+    if (!*cfi->name)
+    {
+        fprintf(file, "%3d: 0x%"W_PI_FMT"  <unknown>\n",
+                count, regs->get_ip());
         return;
+    }
 
     fprintf(file, "%3d: 0x%"W_PI_FMT"  %s (%s:%d)\n",
         count, regs->get_ip(), cfi->name,

Modified: harmony/enhanced/trunk/drlvm/vm/port/src/modules/native_modules.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/trunk/drlvm/vm/port/src/modules/native_modules.c?rev=926414&r1=926413&r2=926414&view=diff
==============================================================================
--- harmony/enhanced/trunk/drlvm/vm/port/src/modules/native_modules.c (original)
+++ harmony/enhanced/trunk/drlvm/vm/port/src/modules/native_modules.c Tue Mar 23 00:22:40
2010
@@ -47,6 +47,12 @@ void port_dump_modules(native_module_t* 
     native_module_t* module;
     size_t i;
 
+    if (!modules)
+    {
+        fprintf(out, "unavailable, probably /proc is not mounted\n");
+        return;
+    }
+
     for (module = modules; module; module = module->next)
     {
         if (!module->filename)

Modified: harmony/enhanced/trunk/drlvm/vm/vmcore/src/util/crash_dump.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/trunk/drlvm/vm/vmcore/src/util/crash_dump.cpp?rev=926414&r1=926413&r2=926414&view=diff
==============================================================================
--- harmony/enhanced/trunk/drlvm/vm/vmcore/src/util/crash_dump.cpp (original)
+++ harmony/enhanced/trunk/drlvm/vm/vmcore/src/util/crash_dump.cpp Tue Mar 23 00:22:40 2010
@@ -450,7 +450,7 @@ static void cd_fill_modules()
 
     int count;
     bool res = port_get_all_modules(&g_modules, &count);
-    assert(res && g_modules && count);
+    assert((res && count) || !g_modules);
 }
 
 static void cd_print_module_info(Registers* regs)



Mime
View raw message