1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-06-30 21:21:45 +02:00
Commit graph

153 commits

Author SHA1 Message Date
Konstantin Belousov f6546e27ed Implement the base code to fetch x86/xmm state on x86. Offsets to be filled. 2010-04-10 00:40:39 +03:00
Konstantin Belousov 2c50c95cde Correct arguments for Debug().
Shut up warning by using the cast.
2010-04-10 00:38:54 +03:00
Arun Sharma d1676f192e Fix warnings on 32 bit x86 2010-04-08 03:12:05 -07:00
Arun Sharma caa6095aec Fix compile errors on Linux 2010-04-07 19:59:06 -07:00
Konstantin Belousov 979af4502f Move local_resume to os-specific file. 2010-04-05 23:00:27 +03:00
Konstantin Belousov 0dbeeeb08d Move uc_addr to os-specific file 2010-04-05 22:42:23 +03:00
Konstantin Belousov 79d012348d Move get_scratch_loc() to os-specific file. 2010-04-05 22:22:55 +03:00
Konstantin Belousov aeee03dd74 Reduce diffs to master 2010-04-05 16:28:46 +03:00
Konstantin Belousov fd88f41818 Merge remote branch 'origin/master' into freebsd
Conflicts:
	src/x86/Gis_signal_frame.c
	src/x86/Gstep.c
	src/x86_64/Gis_signal_frame.c
	src/x86_64/Gstep.c
2010-04-05 16:14:50 +03:00
Arun Sharma 8e53e62db9 Refactor os specific code for x86 (both 32 and 64 bit).
Move Linux specific code into ${arch}/Gos-linux.c
2010-04-04 16:46:13 -07:00
Konstantin Belousov 980ccffe9e Merge remote branch 'origin/master' into freebsd
Conflicts:
	src/x86/Gis_signal_frame.c
2010-04-04 12:44:10 +03:00
Arun Sharma 2b7ca45acc Fix handling of SA_SIGINFO frames on 32 bit x86
Submitted by: Arne de Bruijn <mail@arnedebruijn.nl>
2010-04-03 16:49:18 -07:00
Konstantin Belousov 8a75ba971a Signal trampoline on amd64 for ia32 is special. 2010-03-13 21:26:50 +02:00
Konstantin Belousov e51429280b Handle error return from is_signal_frame 2010-03-13 20:31:12 +02:00
Konstantin Belousov e9cd30040e Move x86 porting further. 2010-03-13 20:28:12 +02:00
Konstantin Belousov 71c4161247 Remove extra empty line 2010-03-13 18:33:22 +02:00
Konstantin Belousov a6b23dcb0c Add partial implementation for is_signal_frame for i386. 2010-03-11 00:50:40 +02:00
Konstantin Belousov 54f8b2fdbe Fill real offsets for freebsd 2010-03-11 00:02:24 +02:00
Konstantin Belousov 47dcc89457 Remove unneeded braces 2010-03-10 23:51:59 +02:00
Konstantin Belousov bb41eba56c FreeBSD/i386 port. get/setcontext need further work 2010-03-09 18:01:25 +02:00
Konstantin Belousov 53095e6b3e Code for resume 2010-03-07 23:43:07 +02:00
Konstantin Belousov c64723835c Support walk over freebsd sigframes 2010-03-07 21:53:01 +02:00
Arun Sharma 3468a6b33d Change MS_SYNC to MS_ASYNC
Hopefully this makes the address validation a bit cheaper.
2010-02-23 10:35:47 -08:00
Paul Pluzhnikov 54752e0df0 Implement getcontext for x86
Greetings,

Attached patch implements getcontext for x86.

Motivation is the same as:
http://lists.nongnu.org/archive/html/libunwind-devel/2008-06/msg00009.html

This also fixes check-name-space on x86.

Tested on Linux/86 with no new failures.

Thanks,
--
Paul Pluzhnikov
2009-12-23 09:59:52 -08:00
Paul Pluzhnikov 0cf76ed0b5 Check for NULL when validating addresses
This is rather on the obvious side.

While doing strace on an executable using libunwind, I noticed a
lot of:

  msync(0, 1, MS_SYNC) = -1 ENOMEM (Cannot allocate memory)

Since we know that the first page isn't mapped (or at least doesn't
contain the data we are looking for), we can eliminate all such
msync calls.

Tested on Linux/x86_64 with no regressions.
2009-12-01 13:59:45 -08:00
Paul Pluzhnikov 84d4150668 Allow caller to block signals.
Greetings,

We use libunwind just for stack traces (I suspect many others do as well).

The use pattern is:

GetStackTrace(void** result, int max_depth)
{
...
  unw_getcontext(&uc);
  unw_init_local(&cursor, &uc);

  while (n < max_depth) {
    if (unw_get_reg(&cursor, UNW_REG_IP, (unw_word_t *) &ip) < 0) {
      break;
    }
    result[n++] = ip;
    if (unw_step(&cursor) <= 0) {
      break;
    }
  }

Given this usage, it is quite convenient for us to block signals (or
prevent signal handlers from re-entering libunwind by other means) at the
"top level", which makes most of the sigprocmask calls performed by
libunwind itself unneccessary.

The second patch in this series adds a configure option which removes most
of the sigprocmask calls.

Attached patch is a preliminary for it -- consolidating all of the
"sigprocmask; mutex_lock;" sequences into lock_acquire and "mutex_unlock;
sigprocmask;" sequences into lock_release.

Thanks,
--
Paul Pluzhnikov

commit 402d15b123d54a7669db7cf17a76dd315094e472
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date:   Mon Sep 21 10:18:28 2009 -0700

    Replace "sigprocmask + mutext_lock" with a single lock_acquire.
    Likewise, replace "mutext_unlock + sigprocmask" with lock_release.
2009-09-25 09:35:31 -07:00
Arun Sharma ff0ae70cc3 Bad pointer validation for 32 bit x86.
This corresponds to commit 649f1fb344.

Signed-off-by: Paul Pluzhnikov <ppluzhnikov@google.com>
2009-03-16 21:34:49 -07:00
David Mosberger-Tang a8be10e251 [X86] Cleanup XMM handling for x86
* Use explicit types for XMM registers
* Support full width (128 bits) access

Signed-off-by: Andrew Cagney <cagney@redhat.com>
Signed-off-by: Arun Sharma <aruns@google.com>
2008-01-07 15:41:20 -07:00
Andrew Cagney 05c8284b43 [X86] 2007-10-10 Andrew Cagney <cagney@redhat.com>
* src/x86/init.h (common_init): Fix typo: use UNW_X86_ESI for
     dwarf.loc[ESI].

Acked-by: Arun Sharma <aruns@google.com>
2007-10-15 10:32:07 -06:00
Jan Kratochvil 57e5696463 Mark Wielaard <mwielaard@redhat.com> writes:
On some systems executable stacks are denied. Since libunwind and the
tests don't actually need executable stacks this patch marks all
assembly files as not needing it.

The original patch comes from frysk:

2007-04-05  Jan Kratochvil  <jan.kratochvil@redhat.com>

    * src/hppa/getcontext.S, src/hppa/setcontext.S, src/hppa/siglongjmp.S,
    src/ia64/Ginstall_cursor.S, src/ia64/Linstall_cursor.S,
    src/ia64/dyn_info_list.S, src/ia64/getcontext.S, src/ia64/longjmp.S,
    src/ia64/setjmp.S, src/ia64/siglongjmp.S, src/ia64/sigsetjmp.S,
    src/ppc64/longjmp.S, src/ppc64/siglongjmp.S, src/x86/longjmp.S,
    src/x86/siglongjmp.S, src/x86_64/longjmp.S, src/x86_64/setcontext.S,
    src/x86_64/siglongjmp.S: Stack should be non-executable, for SELinux.

I added a couple more markers for new files in current libunwind.

Before this patch you would get the following on selinux enabled
systems without allow_exec_stack: error while loading shared
libraries:

libunwind.so.7: cannot enable executable stack as shared object
	requires: Permission denied

After the patch that error disappears and all test results are similar
to the results on systems without executable stack protection.
2007-10-01 08:35:01 -06: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
Arun Sharma cdb96f333c [x86] (common_init): Fix spurious errors caused by uninitialized members.
Signed-off-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Arun Sharma <arun.sharma@google.com>
2006-07-26 22:09:10 -06:00
David Mosberger-Tang a369768c27 Revert "Initial revision"
This reverts 06d223e924 commit.
2006-07-26 14:47:44 -06:00
hp.com!davidm d9e100753f Include "libunwind_i.h" instead of "tdep.h".
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm 07b01ad205 Include "libunwind_i.h" instead of "tdep.h" and "internal.h".
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
mostang.com!davidm 06d223e924 Initial revision 2005-05-03 09:13:17 +00:00
mostang.com!davidm 239ea4e7ea Implement for real. Note: this version is currently broken.
We don't pass sigmask the way this routine expects because it
can't work.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm 7fbb8a9593 Adjust for sigset_t to intrmask_t renaming.
(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm 3f16641760 (x86_local_resume): Delete unused code.
(establish_machine_state): Fix off-by-one error.
	Fix Debug-statement formatting & debug-level.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm fa0828ac7d (unw_step): Also print IP as part of the function-trace.
2004/11/23 12:49:54-08:00 mostang.com!davidm
(unw_step): If dwarf_step() fails on a signal-frame, fill in the
	save-locations for everything that gets saved in the
	sigcontext structure.

2004/10/25 17:43:57+02:00 homeip.net!davidm
Add Debug statement for return-value.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm db1517609c (tdep_access_reg): Buffer writes to EH argument registers (EAX
and EDX) in dwarf.eh_args[].


2004/11/17 02:43:39-08:00 mostang.com!davidm
(tdep_access_reg): Treat UNW_X86_ESP exactly like UNW_X86_CFA.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm bbe87ea403 (common_init): Don't forget to clear c->dwarf members args_size,
ret_addr_column, pi_valid, and pi_is_dynamic.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm 8a66c9c635 (access_reg): Delete left-over Debug statement.
(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm 04fde4a63b (Logical change 1.290) 2005-05-03 09:13:17 +00:00
hp.com!davidm df5acdd24a Fix missing NELEMS -> ARRAY_SIZE adjustment.
(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm caa528e1e8 Add dummy implementation of _UI_longjmp_cont().
(Logical change 1.268)
2004-09-09 16:26:15 +00:00
mostang.com!davidm 21dd6ad5cb (x86_local_resume): Tweak debug-level code to match ia64-version.
(Logical change 1.265)
2004-09-09 10:51:29 +00:00
mostang.com!davidm f226ffec68 (common_init): Don't forget to initialize cursors sigcontext_format
and sigcontext_addr members.

(Logical change 1.263)
2004-09-09 10:47:55 +00:00
hp.com!davidm f576cce748 Drop debug-level for function-trace to 1.
(Logical change 1.257)
2004-08-26 10:02:46 +00:00
homeip.net!davidm be2bed2712 (tdep_access_reg): If c->dwarf.cfa_is_sp is set, treat UNW_X86_64_RSP
as a read-only alias of CFA.

(Logical change 1.253)
2004-08-20 11:23:15 +00:00