1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-05-17 10:45:18 +02:00
Commit graph

25 commits

Author SHA1 Message Date
Arun Sharma 781d5d5263 One time whitespace fixup.
for f in $(find src include -name '*.[ch]'); do
  expand -t 8 $f > $tmp; mv $tmp $f;
done
2014-09-27 09:47:23 -07:00
Martin Milata 65ac867416 Do not compute load offset for MiniDebugInfo
We already have the value computed based on the executable. Furthermore,
debuginfo need not have valid program header table, thus the result
might be bogus.

Signed-off-by: Martin Milata <mmilata@redhat.com>
2014-06-07 18:07:06 -07:00
Ulrich Weigand 844f1b84cc Pass relocated address to tdep_get_func_addr
The ppc64 implementation of tdep_get_func_addr would crash when
attempting to retrieve the address of a function in a shared
library.  The problem was that it needs to dereference the
function descriptor, but common code was passing the *unrelocated*
adddress of the descriptor to the tdep_get_func_addr routine.

Instead, common code would attempt to relocate the *result* of
tdep_get_func_addr, which is also wrong: the ppc64 implementation
reads the function address from the in-memory copy of the
descriptor, which is already relocation and contains the final
address.

This patch fixes the problem by relocating the descriptor address
before passing it to tdep_get_func_addr, instead of relocating
the result of tdep_get_func_addr.  Since ppc64 is the only
non-trivial implementation of tdep_get_func_addr, this cannot
affect any other platform.

Signed-off-by: Ulrich Weigand <uweigand@de.ibm.com>
2013-12-27 07:08:43 -08:00
Tommi Rantala 96c1bca2b0 Fix header inclusion order in `src/elfxx.c'
Make sure that we have included `config.h' before checking HAVE_LZMA.
This makes a difference at least on MIPS, where we include `elfxx.c'
directly. For other platforms this does not make much difference, as we
are already indirectly including `config.h' from other headers.
2012-10-05 21:24:30 -07:00
Martin Milata 3d5e6c1ddd Search MiniDebugInfo for procedure names
After searching the normal symbol table, look if the binary contains
.gnu_debugdata section. If it does, run LZMA decompression on it, load
the resulting ELF image into memory and call lookup_symbol() on it
again.

lookup_symbol() is modified so that it takes min_dist as a parameter and
only returns a symbol when it finds one that is closer than indicated by
the parameter.

Signed-off-by: Martin Milata <mmilata@redhat.com>
2012-08-10 15:29:07 +02:00
Martin Milata 71c1fffc35 Refactor parts of elfxx.c to allow reusing code
Signed-off-by: Martin Milata <mmilata@redhat.com>
2012-08-10 15:29:07 +02:00
Martin Milata e11a6a4fdf Fix incorrect return code of unw_get_proc_name
The code for symbol lookup (elfxx.c:lookup_symbol) works by iterating
over symbol tables while maintaing the symbol closest to the supplied
instruction pointer. Whenever this search encountered symbol that was
longer than result buffer, the function returned -UNW_ENOMEM even though
the final symbol wasn't too long.

Signed-off-by: Martin Milata <mmilata@redhat.com>
2012-08-06 20:12:38 +02:00
Arun Sharma d276b7a961 Introduce get_proc_name_in_image()
This is similar to get_proc_name() but takes an already mapped
image.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2012-03-12 20:09:18 -07:00
Arun Sharma 3d08506936 Fix undefined symbol: _Uelf64_valid_object
Without this change, we end up building libunwind-${arch}.a with
missing symbols.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
2012-02-12 19:53:38 -08:00
Zachary T Welch 5007f8c794 Improve ELF valid_object() helper
Ensures the ELF header version is valid.

Signed-off-by: Zachary T Welch <zwelch@codesourcery.com>
2011-01-23 17:21:04 -08:00
Arun Sharma 1787a2fd28 Add path and pathlen arguments to tdep_get_elf_image()
Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-15 12:14:09 -07:00
David Mosberger-Tang e6b9f350f7 Introduce a tdep_get_func_addr_hook() in the ELF lookup_symbol()
routine and add address-space argument.  This is needed because on
PPC64, a the function-name symbol refers to a function descriptor
(unlike, for example, on ia64, where the @fptr() operator is needed to
refer to a function descriptor).  Thus, in order to look up the name
of a function, we need to dereference the function descriptor.  To
make matters more "interesting", the function descriptors are normally
resolved by the dynamic linker, so we can't get their values from the
ELF file.  Instead, we have to read them from the running image, hence
the need for the address-space argument.
2007-08-22 13:02:09 -06:00
hp.com!davidm 379fb069d2 Don't include <string.h>, <unistd.h>, <sys/types.h>.
Include "libunwind_i.h" instead of "tdep.h".

(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm 5d8b2e3415 (valid_object): Declare as HIDDEN instead of PROTECTED.
(get_proc_name): Likewise.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
hp.com!davidm c67d345c33 Convert from debug() to Debug().
(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm c4f5974dd1 Declare libunwind-entry-points as PROTECTED to ensure local uses get
resolved within the library itself.

(Logical change 1.151)
2004-01-03 10:50:24 +00:00
hp.com!davidm 4fafd8cbf7 Use Elf_W() instead of ElfW() etc. to avoid clash with <linker.h>.
(Logical change 1.141)
2003-12-20 11:23:44 +00:00
hp.com!davidm dee53d7800 (lookup_symbol): Delete unused variable "str_size".
(Logical change 1.130)
2003-11-27 06:52:54 +00:00
hp.com!davidm 71650257d7 (lookup_symbol): Cast arguments to debug printf() so they compile
without warning on both 32- and 64-bit platforms.

(Logical change 1.104)
2003-09-25 05:29:14 +00:00
mostang.com!davidm 4409fc61d8 Patch by Matthieu Delahaye:
(lookup_symbol): Fix typo: Elf64_Shdr -> ElfW (Shdr).
(get_proc_name): Ditto.

(Logical change 1.67)
2003-03-27 00:44:39 +00:00
mostang.com!davidm 7bfbbb6126 (lookup_symbol): Return -UNW_ENOINFO if symbol cannot be looked up for some reason.
Return -UNW_ENOMEM if string buffer is too small.  This makes the routine
	compatible with the definition of the unw_get_proc_name(3).

(Logical change 1.63)
2003-03-19 19:25:18 +00:00
mostang.com!davidm d098282ff5 Include "tdep.h".
(Logical change 1.59)
2003-03-06 06:14:36 +00:00
mostang.com!davidm 03950aaf01 (lookup_symbol): Print debug output only at very high debug-level.
(get_proc_name): Take "pid" argument.

(Logical change 1.56)
2003-02-27 09:58:57 +00:00
mostang.com!davidm 824d6619b5 (Logical change 1.45) 2003-02-08 10:10:59 +00:00
mostang.com!davidm 5f94e2d488 Initial revision 2003-02-08 10:10:59 +00:00