1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_dump.c (rb_vm_bugreport): revert r38533.

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kosaki 2012-12-21 17:21:12 +00:00
parent 4da6fa28f8
commit 585afbbc6a
3 changed files with 20 additions and 6 deletions

View file

@ -1,3 +1,9 @@
Sat Dec 22 02:19:38 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* 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@zacharyscott.net> Sat Dec 22 02:05:00 2012 Zachary Scott <zachary@zacharyscott.net>
* lib/irb/inspector.rb, lib/irb/context.rb: Move IRB::INSPECTORS and * lib/irb/inspector.rb, lib/irb/context.rb: Move IRB::INSPECTORS and

View file

@ -493,6 +493,16 @@ fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
return; 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->fd = fd;
current_line->mapped = file; current_line->mapped = file;
current_line->mapped_size = (size_t)filesize; current_line->mapped_size = (size_t)filesize;
@ -506,7 +516,6 @@ fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
} }
} }
ehdr = (ElfW(Ehdr) *)file;
shdr = (ElfW(Shdr) *)(file + ehdr->e_shoff); shdr = (ElfW(Shdr) *)(file + ehdr->e_shoff);
shstr_shdr = shdr + ehdr->e_shstrndx; shstr_shdr = shdr + ehdr->e_shstrndx;

View file

@ -644,15 +644,14 @@ rb_vm_bugreport(void)
char **syms = backtrace_symbols(trace, n); char **syms = backtrace_symbols(trace, n);
if (syms) { if (syms) {
/* commentout temporarily. we have to fix addr2line. see [Bug #7597] */ #ifdef USE_ELF
/* #ifdef USE_ELF */ rb_dump_backtrace_with_lines(n, trace, syms);
/* rb_dump_backtrace_with_lines(n, trace, syms); */ #else
/* #else */
int i; int i;
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
fprintf(stderr, "%s\n", syms[i]); fprintf(stderr, "%s\n", syms[i]);
} }
/* #endif */ #endif
free(syms); free(syms);
} }
#elif defined(_WIN32) #elif defined(_WIN32)