[前][次][番号順一覧][スレッド一覧]

ruby-changes:26492

From: kosaki <ko1@a...>
Date: Sat, 22 Dec 2012 02:21:23 +0900 (JST)
Subject: [ruby-changes:26492] kosaki:r38543 (trunk): * vm_dump.c (rb_vm_bugreport): revert r38533.

kosaki	2012-12-22 02:21:12 +0900 (Sat, 22 Dec 2012)

  New Revision: 38543

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38543

  Log:
    * vm_dump.c (rb_vm_bugreport): revert r38533.
    * addr2line.c (fill_lines): add ELF sanity check.
      [Bug #7597] [ruby-dev:46786]

  Modified files:
    trunk/ChangeLog
    trunk/addr2line.c
    trunk/vm_dump.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38542)
+++ ChangeLog	(revision 38543)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Dec 22 02:19:38 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* vm_dump.c (rb_vm_bugreport): revert r38533.
+	* addr2line.c (fill_lines): add ELF sanity check.
+	  [Bug #7597] [ruby-dev:46786]
+
 Sat Dec 22 02:05:00 2012  Zachary Scott  <zachary@z...>
 
 	* lib/irb/inspector.rb, lib/irb/context.rb: Move IRB::INSPECTORS and
Index: addr2line.c
===================================================================
--- addr2line.c	(revision 38542)
+++ addr2line.c	(revision 38543)
@@ -493,6 +493,16 @@ fill_lines(int num_traces, void **traces https://github.com/ruby/ruby/blob/trunk/addr2line.c#L493
 	return;
     }
 
+    ehdr = (ElfW(Ehdr) *)file;
+    if (memcmp(ehdr->e_ident, "\177ELF", 4) != 0) {
+	/*
+	 * Huh? Maybe filename was overridden by setproctitle() and
+	 * it match non-elf file.
+	 */
+	close(fd);
+	return;
+    }
+
     current_line->fd = fd;
     current_line->mapped = file;
     current_line->mapped_size = (size_t)filesize;
@@ -506,7 +516,6 @@ fill_lines(int num_traces, void **traces https://github.com/ruby/ruby/blob/trunk/addr2line.c#L516
 	}
     }
 
-    ehdr = (ElfW(Ehdr) *)file;
     shdr = (ElfW(Shdr) *)(file + ehdr->e_shoff);
 
     shstr_shdr = shdr + ehdr->e_shstrndx;
Index: vm_dump.c
===================================================================
--- vm_dump.c	(revision 38542)
+++ vm_dump.c	(revision 38543)
@@ -644,15 +644,14 @@ rb_vm_bugreport(void) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L644
 	char **syms = backtrace_symbols(trace, n);
 
 	if (syms) {
-/* commentout temporarily. we have to fix addr2line. see [Bug #7597] */
-/* #ifdef USE_ELF */
-/* 	    rb_dump_backtrace_with_lines(n, trace, syms); */
-/* #else */
+#ifdef USE_ELF
+	    rb_dump_backtrace_with_lines(n, trace, syms);
+#else
 	    int i;
 	    for (i=0; i<n; i++) {
 		fprintf(stderr, "%s\n", syms[i]);
 	    }
-/* #endif */
+#endif
 	    free(syms);
 	}
 #elif defined(_WIN32)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]