ruby-changes:21656
From: nobu <ko1@a...>
Date: Fri, 11 Nov 2011 17:09:59 +0900 (JST)
Subject: [ruby-changes:21656] nobu:r33705 (trunk): * vm_dump.c (HAVE_BACKTRACE): fallback to 0.
nobu 2011-11-11 17:09:48 +0900 (Fri, 11 Nov 2011) New Revision: 33705 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33705 Log: * vm_dump.c (HAVE_BACKTRACE): fallback to 0. * vm_dump.c (rb_vm_bugreport): show "Other runtime information" header only when available. * vm_dump.c (rb_vm_bugreport): get rid of modifying the content of VM directly. * vm_dump.c (rb_vm_bugreport): check if vm is non-null. Pointed out by Ikegami Daisuke <ikegami.da@g...>. Thank you. Modified files: trunk/ChangeLog trunk/vm_dump.c Index: ChangeLog =================================================================== --- ChangeLog (revision 33704) +++ ChangeLog (revision 33705) @@ -1,3 +1,17 @@ +Fri Nov 11 17:09:45 2011 Nobuyoshi Nakada <nobu@r...> + + * vm_dump.c (HAVE_BACKTRACE): fallback to 0. + + * vm_dump.c (rb_vm_bugreport): show "Other runtime information" + header only when available. + + * vm_dump.c (rb_vm_bugreport): get rid of modifying the content of + VM directly. + + * vm_dump.c (rb_vm_bugreport): check if vm is non-null. + Pointed out by Ikegami Daisuke <ikegami.da@g...>. + Thank you. + Fri Nov 11 12:36:37 2011 KOSAKI Motohiro <kosaki.motohiro@g...> * io.c (pipe_open): Remove fflush(stdin). it's no effect. Index: vm_dump.c =================================================================== --- vm_dump.c (revision 33704) +++ vm_dump.c (revision 33705) @@ -593,6 +593,9 @@ #if defined(__FreeBSD__) && defined(__OPTIMIZE__) #undef HAVE_BACKTRACE #endif +#ifndef HAVE_BACKTRACE +#define HAVE_BACKTRACE 0 +#endif #if HAVE_BACKTRACE # include <execinfo.h> #elif defined(_WIN32) @@ -774,7 +777,15 @@ void rb_vm_bugreport(void) { - rb_vm_t *vm = GET_VM(); +#ifdef __linux__ +# define PROC_MAPS_NAME "/proc/self/maps" +#endif +#ifdef PROC_MAPS_NAME + enum {other_runtime_info = 1}; +#else + enum {other_runtime_info = 0}; +#endif + const rb_vm_t *const vm = GET_VM(); if (vm) { int i = 0; SDR(); @@ -823,22 +834,29 @@ fprintf(stderr, "\n"); #endif /* HAVE_BACKTRACE */ - fprintf(stderr, "-- Other runtime information " - "-----------------------------------------------\n\n"); - { + if (other_runtime_info || vm) { + fprintf(stderr, "-- Other runtime information " + "-----------------------------------------------\n\n"); + } + if (vm) { int i; + VALUE name; - fprintf(stderr, "* Loaded script: %s\n", StringValueCStr(vm->progname)); + name = vm->progname; + fprintf(stderr, "* Loaded script: %s\n", StringValueCStr(name)); fprintf(stderr, "\n"); fprintf(stderr, "* Loaded features:\n\n"); for (i=0; i<RARRAY_LEN(vm->loaded_features); i++) { - fprintf(stderr, " %4d %s\n", i, StringValueCStr(RARRAY_PTR(vm->loaded_features)[i])); + name = RARRAY_PTR(vm->loaded_features)[i]; + fprintf(stderr, " %4d %s\n", i, StringValueCStr(name)); } fprintf(stderr, "\n"); + } -#if __linux__ + { +#ifdef PROC_MAPS_NAME { - FILE *fp = fopen("/proc/self/maps", "r"); + FILE *fp = fopen(PROC_MAPS_NAME, "r"); if (fp) { fprintf(stderr, "* Process memory map:\n\n"); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/