with dladdr_fbases introduced at r45563.
it didn't get before if the executalbe is not pie.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
At least sh, csh, tcsh, bash, and zsh sets realpath of the main
executable for dladdr, but gdb doesn't.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
which is retrived from dladdr to dladdr_fbases, to skip already
parsed objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
symbol '_start'.
* addr2line.c (fill_lines): instead of above, get a dynamic symbol
in the main executable and use it to know the base address.
* addr2line.c (follow_debuglink0): use obj_info_t instead of
line_info_t to handle object related data.
* addr2line.c (main_exe_path): defined for Linux.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
.symtab section exists, the section's type can be SHT_NOBITS and
actual data doesn't exist in the file. [Bug #9654]
revert r45441.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
fc18 powerpc64's libc6-dbg has symtab/strtab but it can't be
referenced. therefore add workaround not to see them.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
the basis of base addresses comparison.
* addr2line.c: use uintptr_t instead of intptr_t for poinrters.
* addr2line.c (rb_dump_backtrace_with_lines): don't use syms.
* vm_dump.c (rb_print_backtrace): ditto.
* addr2line.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
be a function in the main executable, whose absolute path is not
available by dladdr, and ruby get it by /proc/self/exe on Linux.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
because DWARF's line_Base is signed char and char maybe unsigned.
patched by Rei Odaira. [ruby-dev:48068] [Bug #9654]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
address. Therefore noreturn function with tail call's return
address may be in another function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
symbol table if it is built with cc -g and not stripped.
Now ruby can show static symbols on Linux though glibc's
backtrace_symbols(3) don't show them.
* addr2line.c (rb_dump_backtrace_with_lines): use dladdr(3) to
detect what object file declares the symbol because
dl_iterate_phdr can't detect the main executable file
and codes on the stack.
NOTE: signal trampolines sometimes on the user stack. (FreeBSD)
* addr2line.c (rb_dump_backtrace_with_lines): stop showing
backtrace if the function's name is main.
NOTE: FreeBSD's backtrace (libexecinfo) shows _start and
an additional address. Why it doesn't remove them on dladdr phase
is, dladdr may fail to detect the main function but detect
as _start function. Therefore it must be after scanning
the symbol table and getting correct name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* addr2line.c (fill_lines): show the line number in C backtrace if
ruby is built without --enable-shared (PIE) on Linux.
patch is originally by Shinichiro Hamaji
https://twitter.com/shinh/status/441957774264504321
NOTE: ld doesn't insert __executable_start for PIE.
dladdr(3)'s argument must be a function pointer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
__inline is not available with old compilers on Solaris.
[ruby-dev:47229] [Bug #8227]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
this is consided as async signal safe function.
* addr2line.c (rb_dump_backtrace_with_lines): use kfprintf.
[Bug #8144] [ruby-core:53632]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (alloca), eval_intern.h (alloca), gc.c
(alloca): Make alloca() globally available by moving the
ultimate ifdef's to ruby/ruby.h. Gcc hides its builtin alloca()
when compiling with -ansi, and linking thus fails on platforms
that lack their own alloca() implementation in libc, which
include OpenBSD and some ports of NetBSD. We use alloca()
everywhere including from within third party C extentions, so
alloca() must be made globally available. [Bug #7307]
* addr2line.c (alloca): Replace the alloca() part with the
ultimate ifdef's. [Bug #7307]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* addr2line.c (fill_lines): check file size overflow only if it is
necessary, and suppress a sign-compare warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
target binary because there are some platforms which off_t > size_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
this tmp1 is not required after r35538.
* addr2line.c: suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
because the index specifies the index of given included_directories
which is separated by NUL and its index is begun from 1.
Note that 0 specifies the current directory of the compilation.
see also http://www.dwarfstd.org/doc/dwarf-2.0.0.pdf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e