summaryrefslogtreecommitdiff
path: root/addr2line.c
AgeCommit message (Collapse)Author
2018-08-13FreeBSD 11.0 lacks ELFCOMPRESS_ZLIBnaruse
FreeBSD 11.0 unfortunately lacks ELF compression definitions in their elf.h (sys/elf_common.h), and 11.1 introduced them. https://github.com/freebsd/freebsd/commit/b9167d33a12b8a6c279be9cd1005874728e808c9 Though we can add workaround, we simply drop support because FreeBSD 11.0 is already EOL at November 30, 2017. https://www.freebsd.org/security/unsupported.html git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13Don't free allocated uncompressed_debug_line until backtrace is printednaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13Define parse_compressed_debug_line() only ifdef SUPPORT_COMPRESSED_DEBUG_LINEnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13support compressed debug_linenaruse
re-commit r64328 https://blogs.oracle.com/solaris/elf_section_compression-v2 https://gnu.wildebeest.org/blog/mjw/2016/01/13/elf-libelf-compressed-sections-and-elfutils/ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13Revert "support compressed debug_line"naruse
This reverts commit r64328 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13support compressed debug_linenaruse
https://blogs.oracle.com/solaris/elf_section_compression-v2 https://gnu.wildebeest.org/blog/mjw/2016/01/13/elf-libelf-compressed-sections-and-elfutils/ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-31Add PRINTF_ARGS to kprintfkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-09addr2line.c (kprintf): staticnormal
This function is not used outside of addr2line.c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-08addr2line.c: no need to keep fd around after mmapnormal
POSIX mmap(3) manpage stipulates mmap bumps the reference count of the file description. Thus keeping a file descriptor to maintain the reference is not necessary. If this didn't work, every extension .so would require a permanent FD, which is obviously not the case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-18Support C89 if possiblengoto
* addr2line.c: Because stdbool.h is a C99 feature, compile error occurs with some old compilers without specifying C99 options. Fix compile error with Oracle Solaris Studio 12.4 on Solaris 10. [Bug #14200] [ruby-dev:50366] * missing/stdbool.h: Alternative of stdbool.h for C89 compilers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-18addr2line.c: fix r60841 for glibc before 2.22normal
SHF_COMPRESSED was not defined until glibc 2.22, and there are older distros (e.g. Debian 8.x jessie) which do not have this defined. Perhaps it is safe to define SHF_COMPRESSED to (1 << 11) ourselves, too, since ELF should be a standardized format. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-18explictly skip compressed debug linenaruse
To identify the line of backtrace with ease, show the offset address of library. You can just find the source filename and the line with `addr2line -e libruby.so.2.5.0 0xXXXX` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16make a func static.ko1
* addr2line.c (main_exe_path): make it static. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-26get rid of strcpynobu
* addr2line.c (follow_debuglink): insert global_debug_dir by using memmove instead of copying to temporary buffer. * dln.c (dln_load): use memcpy with the known length instead of strcpy. * gc.c (rb_gc_unprotect_logging): use strdup instead of malloc and strcpy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-18addr2line.c: boundary checksnobu
* addr2line.c (parse_debug_line_cu): boundary checks for compressed debug sections. [ruby-dev:49840] [Bug #12850] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28* addr2line.c: drop to support ATARI ST platform. It was discontinuedhsbt
more than two decades ago. [fix GH-1350] Patch by @cremno * include/ruby/ruby.h: ditto. * io.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-29* addr2line.c: define toupper for its use. fix r54391.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-14* addr2line.c (fill_lines): get base addrs in fill_lines to use itnaruse
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* addr2line.c (main_exe_path): support FreeBSD.naruse
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-11* addr2line.c (rb_dump_backtrace_with_lines): set base addressnaruse
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-10* addr2line.c (append_obj): clear allocated memory.naruse
* 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-01* addr2line.c (rb_dump_backtrace_with_lines): don't depend hard codednaruse
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-03-31* addr2line.c (fill_lines): use dynsym, which is used for dynamicnaruse
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-28revert r45417naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-27* addr2line.c (fill_lines): check shdr[i].sh_type because even ifnaruse
.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-26temporally change for powerpc64-linux fc18naruse
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-26remove break because strtab/symtab is usually the last segmentnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26temporaly show sym->st_name and so onnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26* addr2line.c (fill_lines): loop reverse order not to overwritenaruse
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* addr2line.c (follow_debuglink): show message if it closes openednaruse
(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* addr2line.c (fill_line): pass and use offset instead ofnaruse
curobj_baseaddr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26don't write _start as is; use dlsymnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25temporaly change/add to debug on powerpc64-linuxnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25* addr2line.c (fill_lines): don't run fill_lines multiple times.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25main is not a pubic function, use _start insteadnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25* addr2line.c (rb_dump_backtrace_with_lines): a function to get mustnaruse
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* addr2line.c (fill_lines): skip if path is NULL.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-24* addr2line.c (rb_dump_backtrace_with_lines): fetch path of thenaruse
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* addr2line.c (parse_debug_line_cu): explicitly specify signed charnaruse
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-22* addr2line.c (fill_lines): compare the file names of object in whichnaruse
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-15* addr2line.c (fill_lines): return address is just after callingnaruse
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-14* addr2line.c (fill_lines): fetch symbol names from ELF binary'snaruse
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-10* configure.in: always check dladdr(1).naruse
* 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-02-27use strlcatnobu
* 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
2013-10-26* addr2line.c: Include ELF header after system headers (especiallyakr
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-04-06* addr2line.c: use more generic type:naruse
* 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* addr2line.c: quad_t and u_quad_t is not available on Solaris.ngoto
__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-05* addr2line.c: include ruby/missing.h to fix compile error on Debian.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-26Suppress -Werror=shorten-64-to-32naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24* addr2line.c (putce): suppress unused return value warning.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e