Граф коммитов

57 Коммитов

Автор SHA1 Сообщение Дата
naruse b0188253dc * addr2line.c (fill_lines): get base addrs in fill_lines to use it
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
2014-04-14 10:08:04 +00:00
naruse c05940a403 * addr2line.c (main_exe_path): support FreeBSD.
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
2014-04-14 10:08:02 +00:00
naruse c7ad29f58f * addr2line.c (rb_dump_backtrace_with_lines): set base address
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
2014-04-11 04:48:26 +00:00
naruse b8eb899785 * addr2line.c (append_obj): clear allocated memory.
* addr2line.c (rb_dump_backtrace_with_lines): free `base_addrs'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-10 07:19:53 +00:00
naruse 99d1f5f88b * addr2line.c (rb_dump_backtrace_with_lines): don't depend hard coded
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
2014-04-01 03:38:05 +00:00
naruse f265ce708d * addr2line.c (fill_lines): use dynsym, which is used for dynamic
linking and always exists, if there's no symtab.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-31 22:39:07 +00:00
naruse 209a310c47 revert r45417
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28 01:23:02 +00:00
naruse acc3cf5f30 * addr2line.c (fill_lines): check shdr[i].sh_type because even if
.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
2014-03-27 03:01:59 +00:00
naruse c6aa2c467b temporally change for powerpc64-linux fc18
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
2014-03-26 21:46:23 +00:00
naruse 2d8c3e7851 remove break because strtab/symtab is usually the last segment
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 10:59:44 +00:00
naruse 623da1525a temporaly show sym->st_name and so on
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 07:40:51 +00:00
naruse 2bf56deded * addr2line.c (fill_lines): loop reverse order not to overwrite
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
2014-03-26 04:30:43 +00:00
naruse f3867e2203 * addr2line.c (follow_debuglink): show message if it closes opened
(and maybe used) elf binary.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 01:38:23 +00:00
naruse b8ba4016ac * addr2line.c (fill_line): pass and use offset instead of
curobj_baseaddr.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 01:38:05 +00:00
naruse 537623e43d don't write _start as is; use dlsym
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 00:02:24 +00:00
naruse 3bd0fd118d temporaly change/add to debug on powerpc64-linux
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25 23:55:58 +00:00
naruse 633b2fc9d7 * addr2line.c (fill_lines): don't run fill_lines multiple times.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25 23:55:39 +00:00
naruse 0fe34c4c3b main is not a pubic function, use _start instead
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25 18:44:32 +00:00
naruse c1b81d3578 * addr2line.c (rb_dump_backtrace_with_lines): a function to get must
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
2014-03-25 16:58:45 +00:00
naruse cd2afc30fd * addr2line.c (fill_lines): skip if path is NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25 16:58:42 +00:00
naruse 2e47a521e6 * addr2line.c (rb_dump_backtrace_with_lines): fetch path of the
executable from /proc/self/exe on Linux.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-24 06:28:32 +00:00
naruse d2b1deda92 * addr2line.c (parse_debug_line_cu): explicitly specify signed char
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
2014-03-24 04:18:28 +00:00
naruse 14c9cf885c * addr2line.c (fill_lines): compare the file names of object in which
symbols exist. [Bug #9654] [ruby-dev:48058]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-22 14:06:11 +00:00
naruse 356644685e * addr2line.c (fill_lines): return address is just after calling
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
2014-03-15 22:15:30 +00:00
naruse 6c08032d2f * addr2line.c (fill_lines): fetch symbol names from ELF binary's
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
2014-03-14 06:29:39 +00:00
naruse be7cc58370 * configure.in: always check dladdr(1).
* 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
2014-03-10 03:20:53 +00:00
nobu 057098bfdc use strlcat
* addr2line.c (follow_debuglink): use strlcat instead of strncat.

* dln.c (aix_loaderror): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-27 07:10:13 +00:00
akr fdf7b4586f * addr2line.c: Include ELF header after system headers (especially
sys/types.h) to avoid compilation failure,
  "usr/include/sh3/elf_machdep.h:4:2: error: #error Define _BYTE_ORDER!",
  on NetBSD/sh3 (dreamcast, hpcsh, landisk, mmeye).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-26 03:04:27 +00:00
naruse c73c876d54 * addr2line.c: use more generic type:
* u_char -> unsigned char
  * u_short -> unsigned short
  * u_int -> unsigned int
  * u_long -> unsigned long
  * quad_t -> int64_t
  * u_quad_t -> uint64_t

* addr2line.c (imax): inline is defined by configure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-06 19:27:04 +00:00
ngoto 5427a5df05 * addr2line.c: quad_t and u_quad_t is not available on Solaris.
__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
2013-04-06 14:45:06 +00:00
akr 702250a412 * addr2line.c: include ruby/missing.h to fix compile error on Debian.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-05 11:23:36 +00:00
naruse 4fa7a0d8df Suppress -Werror=shorten-64-to-32
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-26 01:42:33 +00:00
kosaki b95336b2fe * addr2line.c (putce): suppress unused return value warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24 21:00:03 +00:00
naruse 3de1811788 * addr2line.c (kprintf): added from FreeBSD libstand's printf.
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
2013-03-23 16:05:51 +00:00
naruse 65a277d717 * addr2line.c (rb_dump_backtrace_with_lines): output line at once.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-21 15:04:57 +00:00
kosaki 585afbbc6a * 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
2012-12-21 17:21:12 +00:00
knu 1c0323adbc Fix build when gcc is used and the platform's libc lacks alloca().
* 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
2012-11-09 03:34:08 +00:00
naruse cc4c0ab862 * addr2line.c: SIZE_MAX is defined in stdint.h, so r36755 breaks
32bit FreeBSD. [ruby-core:47360] [Bug #6948]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-29 05:37:28 +00:00
nobu b78fdf1a82 addr2line.c: suppress warnings
* 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
2012-08-21 13:32:13 +00:00
usa 9bae83f89f * addr2line.c (fill_lines): need check and cast of the file size of
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
2012-08-21 08:32:01 +00:00
naruse 6a7666e562 * io.c (io_encoding_set): suppress warnings. [ruby-dev:45627]
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
2012-05-06 12:39:59 +00:00
nobu c037f1f616 * adjust style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15 01:39:00 +00:00
naruse 4342469e8c * addr2line.c (PATH_MAX): define if not defined. [ruby-core:40840]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-08 14:31:56 +00:00
naruse e33183acca * addr2line.c: use USE_ELF instead of __ELF__ because Solaris
doesn't define it. USE_ELF is already provided by configure.
  patched by Naohisa Goto. [ruby-dev:44066] [Bug #4998]

* addr2line.h: ditto.

* vm_dump.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-08 12:23:10 +00:00
mame eb78d224e3 * addr2line.c: fix r32407 to check HAVE_ALLOCA_H.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-05 05:08:23 +00:00
mame a5305216bb * addr2line.c: include <alloca.h> to fix a build issue on Solaris.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-04 16:32:05 +00:00
naruse 6a288deabc * addr2line.c (uleb128): cast the value to unsigned long.
* addr2line.c (fill_lines): print error when lseek fails.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-02 16:14:32 +00:00
naruse 48de1e292a * addr2line.c: suppressed shorten-64-to-32 warnings.
* regcomp.c: ditto.
* regexec.c: ditto.
* regint.h: ditto.
* regparse.c: ditto.
* regparse.h: ditto.
* time.c: ditto.
* variable.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-31 03:44:57 +00:00
naruse e57215bf51 * addr2line.c (get_nth_dirname): decrement the directory index
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
2011-01-12 15:35:07 +00:00
naruse 4acff773ae * addr2line.c: OpenBSD uses the elf_abi.h header file instead of the
elf.h header file. patched by Jeremy Evans [ruby-core:34384]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 02:35:07 +00:00