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

177 commits

Author SHA1 Message Date
Konstantin Belousov b73c618a31 Merge branch 'master' into freebsd 2010-05-02 16:29:02 +03:00
Arun Sharma 215afa30b7 Add unwind descriptors to getcontext.S 2010-04-28 16:32:30 -07:00
Lassi Tuura a9dce3c06e During the stack unwinding process, the return address points to
the instruction after the call for a normal frame. libunwind uses
IP-1 to lookup unwind information. However, this is not necessary for
interrupted frames such as signal frames (or interrupt frames) in
the kernel context.

This patch handles both cases correctly.

Based on work by Mark Wielaard <mwielaard@redhat.com>
2010-04-24 19:16:09 -07:00
Konstantin Belousov 2709abc883 msync() also may be called on unaligned address. 2010-04-21 15:33:37 +03:00
Konstantin Belousov 4454413242 Account for possible unaligned access. 2010-04-21 15:18:02 +03:00
Konstantin Belousov ee99dbec87 Use mincore instead of msync when available 2010-04-20 17:45:18 +03:00
Konstantin Belousov 75b76d1f45 Save FPU context for i386. 2010-04-17 00:18:33 +03:00
Arun Sharma 5a70fab451 Fix compiler warnings on x86 Linux 2010-04-14 18:54:20 -07:00
Konstantin Belousov 127acf8e97 Use correct offset name and value for ucontext offset in struct sigframe 2010-04-14 12:15:05 +03:00
Konstantin Belousov 0d311ea161 Add abort() after sigreturn calls 2010-04-14 12:10:34 +03:00
Konstantin Belousov 34b064bf22 Fix typo. 2010-04-14 12:10:14 +03:00
Konstantin Belousov 02d0cb6f71 Do not save FPU context on x86 for now; XMM save area must be 16-bytes aligned 2010-04-13 14:20:22 +03:00
Konstantin Belousov ae7eebb839 Separate getcontext implementation for x86 2010-04-13 14:11:39 +03:00
Konstantin Belousov 66e49bdd41 Save %eax for i386 2010-04-13 13:55:23 +03:00
Konstantin Belousov 5a7407dd94 Merge branch 'master' into freebsd 2010-04-12 22:34:24 +03:00
Giuseppe Scrivano eb8857a324 Silence a compiler warning 2010-04-12 10:45:31 -07:00
Konstantin Belousov 21f0e90ce8 Rework 69001646fa, store sigframe address into sigcontext_addr. 2010-04-11 22:01:08 +03:00
Konstantin Belousov f10f851916 Add slightly more debug output 2010-04-11 14:59:36 +03:00
Konstantin Belousov 69001646fa Store the ucontext_t pointer to properly handle resume across signal frames. 2010-04-11 13:48:14 +03:00
Konstantin Belousov dd1c7b6c1a Declare mxcsr as XMM 2010-04-10 18:48:35 +03:00
Konstantin Belousov 53f7e650e0 For FreeBSD/i386, add real offset values for FPU context fields. 2010-04-10 18:48:16 +03:00
Konstantin Belousov 6f7b335e89 Add my copyrights to several files that contain essential modifications 2010-04-10 01:42:26 +03:00
Konstantin Belousov 9fe75c7d93 Save FPU state when saving context. For XMM-capable CPUs only (for now). 2010-04-10 00:47:08 +03:00
Konstantin Belousov 117ccd246d Move all XMM offsets into one place. 2010-04-10 00:46:51 +03:00
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