1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-09-21 05:12:51 +02:00
Commit graph

1790 commits

Author SHA1 Message Date
Konstantin Belousov
b3757e7792 Restore the linking when --enable-debug-frame is not specified 2010-05-29 01:07:40 +03:00
Arun Sharma
00aed9631b Add an experimental and optional frame chain unwinding for ARM
The environment variable UNW_ARM_UNWIND_METHOD controls the unwind method.

1 - debug_frame unwinding
2 - frame chain unwinding,
3 - 1 & 2 (default))

Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-26 19:28:44 -07:00
Arun Sharma
46e10c5abe Support .debug_frame based unwinding in _UPTi_find_unwind_table()
Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-26 19:25:41 -07:00
Arun Sharma
546463d1e7 Factor out and export dwarf_find_debug_frame() function
Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-26 19:21:30 -07:00
Konstantin Belousov
298e575f2c Fix freebsd build 2010-05-17 21:57:59 +03:00
Arun Sharma
8ee7b1762e Add ip argument to _UPTi_find_unwind_table.
Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-15 12:15:49 -07: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
Arun Sharma
b115ab645a Ignore separate debug files which contain a .gnu_debuglink section.
Current implementation fails to find separate debug symbols when
.gnu_debuglink is set to the same name of the target ELF basename
(e.g. "libc.so.6" for /lib/libc.so.6). This patch fixes this by ignoring
separate debug files that contain a .gnu_debuglink section.

It also fixes a small typo in a related Debug() line.

Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-15 11:57:35 -07:00
Arun Sharma
66b7335ff3 Adds missing register offsets for ARM
Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-15 11:56:37 -07:00
Konstantin Belousov
e1493dc011 Merge branch 'master' into freebsd 2010-05-03 17:59:50 +03:00
Arun Sharma
aa3bb307a3 Fix merge errors 2010-05-03 07:47:41 -07:00
Konstantin Belousov
c84005e9c8 Add unwind annotations for freebsd/x86 getcontext.S.
Rearrange the code to put the slow branch out of main body,
and pinch the fixed amount of stack space to be able to annotate
the code.
2010-05-02 17:06:24 +03:00
Konstantin Belousov
b73c618a31 Merge branch 'master' into freebsd 2010-05-02 16:29:02 +03:00
Arun Sharma
0176c4f723 Merge commit 'fdc534ccb05d1e6c0438345d292203343a811701' 2010-04-28 17:27:38 -07:00
Arun Sharma
fdc534ccb0 Silence a compiler warning 2010-04-28 16:38:27 -07:00
Arun Sharma
215afa30b7 Add unwind descriptors to getcontext.S 2010-04-28 16:32:30 -07:00
Arun Sharma
c140d8598d Undo commit f252f5ff4e for now.
Seems to introduce a couple of test breakages.
2010-04-25 09:44:59 -07:00
Arun Sharma
d3c4bc4295 Fix a compiler warning 2010-04-25 09:24:40 -07:00
Lassi Tuura
045c55b2a2 Be conservative in all pointer derefrences by default.
Since most people can't completely control their compile or runtime
environment, it becomes hard to ensure that unwind data is perfect.
2010-04-24 19:24:49 -07:00
Lassi Tuura
d4fbc8326a Detect end of stack in x86-64 rbp-based walk. 2010-04-24 19:22:08 -07:00
Lassi Tuura
92cc7fd78a Remove obsolete code for 'old way' of handling x86-64 signal frames. 2010-04-24 19:21:52 -07:00
Lassi Tuura
f252f5ff4e Recognise and unwind through PLT. 2010-04-24 19:21:26 -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
Lassi Tuura
4c553ceb2c Identify end-of-stack by undefined return address location. 2010-04-24 17:18:31 -07:00
Lassi Tuura
dac2d001af Identify signal frames by augmentation attribute. 2010-04-24 17:18:26 -07:00
Lassi Tuura
250382c56d Use wider format when printing addresses in debug format. 2010-04-24 17:18:19 -07:00
Konstantin Belousov
58f290e1ce Add config.h. 2010-04-21 15:43:05 +03: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
Konstantin Belousov
b1c68e060c Arrange the FreeBSD ucontext offset definitions in ascending order. 2010-04-17 00:17:58 +03:00
Giuseppe Scrivano
a67654e86f [PATCH] Reduce scope of the eh_frame_end local variable 2010-04-14 12:11:29 -07:00
Arun Sharma
1d9c5a356d Fix compiler warnings on x86_64 Linux 2010-04-14 12:01:37 -07: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
1e77c66a51 Fix FreeBSD/x86_64 sigcontext restore 2010-04-14 12:04:28 +03:00
Konstantin Belousov
61f4345a9e Fix an issue where len was too short for sysctl to recieve the process
vm map.
2010-04-13 15:33:11 +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
Arun Sharma
c2d78041cc GCC compatibility on x86 for C++ exception handling 2010-04-12 12:08:43 -07:00
Giuseppe Scrivano
eb8857a324 Silence a compiler warning 2010-04-12 10:45:31 -07:00
Konstantin Belousov
843190597c Remove unneeded include.
Noted by:	Arun Sharma
2010-04-11 22:07:31 +03:00
Konstantin Belousov
21f0e90ce8 Rework 69001646fa, store sigframe address into sigcontext_addr. 2010-04-11 22:01:08 +03:00
Konstantin Belousov
42bc15c72c Provide proper register offsets in the gregset for FreeBSD/i386 2010-04-11 19:18:07 +03:00
Konstantin Belousov
f10f851916 Add slightly more debug output 2010-04-11 14:59:36 +03:00
Konstantin Belousov
e33fa9f73c Ditch using the libutil, it is not async-signal safe. 2010-04-11 14:36:24 +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
f01a043712 Convince gcc that x86_64_sigreturn cannot return, as declared. 2010-04-11 13:47:28 +03:00
Konstantin Belousov
a688d6c4c9 Remove unused variable. 2010-04-10 18:51:17 +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
ccc0ae665b More move of osdep code. 2010-04-05 16:25:36 +03:00
Konstantin Belousov
a40641f326 Trim spaces 2010-04-05 16:25:20 +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
bd2798805a Reformat os-freebsd.c. 2010-04-03 23:29:28 +03:00
Konstantin Belousov
5715d912f4 Make setjmp/longjmp work at least on FreeBSD/amd64.
FreeBSD-supplied setjmp() saves incremented stack pointer into jmpbuf.

I have no idea whether siglongjmp ever worked on amd64, since
UNW_NUM_EH_REGS == 2 and abort at siglongjmp.c:81 is firing.
2010-04-03 19:02:43 +03:00
Konstantin Belousov
31ece3eaa1 Fix setcontext for amd64 freebsd 2010-04-03 18:28:31 +03:00
Konstantin Belousov
9bb9c972e6 Merge with origin/master 2010-03-31 16:01:38 +03:00
Arun Sharma
6203f1cd0f Cleanup a mapped elf image.
Without this, we end up with mmap leaks. Thanks to Humberto Abdelnur
for suggesting this.
2010-03-26 15:54:14 -07:00
Arun Sharma
7bd264e292 Fix up what looks like an unintentional semi colon.
Thanks to Lassi Tuura for noticing it.
2010-03-23 10:37:21 -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
Arun Sharma
f8a15e9679 Fix a couple of test breakages on x86_64
setcontext() now restores the signal mask. Also remove a check
in the test that doesn't seem to be valid.
2010-03-10 22:52:12 -08: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
9f79621a29 Enough for now for ptrace backend 2010-03-08 20:55:50 +02:00
Konstantin Belousov
752ce15c4f Preliminary version of freebsd syscall unwinder 2010-03-08 19:45:54 +02:00
Konstantin Belousov
c1b1c10cfc Fix memory leak on error 2010-03-08 18:48:27 +02:00
Konstantin Belousov
89e1df2d32 Fix _UI_siglongjmp_cont name 2010-03-08 15:55:29 +02:00
Konstantin Belousov
0f1c0f5f66 Fix resume. 2010-03-08 15:51:39 +02:00
Konstantin Belousov
43ed5b3e56 Add required assembler magic. 2010-03-08 00:57:50 +02:00
Konstantin Belousov
5f5b1a5daa tdep_get_elf_image should be public 2010-03-08 00:52:26 +02:00
Konstantin Belousov
093855f12a Remove unneeded includes of sys/types.h 2010-03-08 00:25:22 +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
Konstantin Belousov
d0d5f9979b Correct rsp offset 2010-03-07 21:20:43 +02:00
Konstantin Belousov
efd0655ff4 Silence warning about symbol redefinition. 2010-03-07 17:27:41 +02:00
Konstantin Belousov
d7eea91448 Cast caddr_t argument for ptrace 2010-03-07 12:27:03 +02:00
Konstantin Belousov
200147d0f2 Handle fpu state 2010-03-06 23:22:46 +02:00
Konstantin Belousov
62218e10eb Provide proper offsets for gregs in freebsd ucontext. Note that fp regs are not handled. 2010-03-06 22:33:11 +02:00
Konstantin Belousov
63ae8ca894 Correct assignments, remove unneeded includes. 2010-03-06 22:32:11 +02:00
Konstantin Belousov
4de09a9c15 Implement freebsd-specific vm walker. 2010-03-06 18:53:27 +02:00
Konstantin Belousov
81f2de0083 Add implementation of unw_is_signal_frame for freebsd. 2010-03-06 18:08:44 +02:00
Konstantin Belousov
1ba7599250 Add FreeBSD stub. 2010-03-06 17:54:51 +02:00
Konstantin Belousov
2646e0fde8 Add freebsd stub 2010-03-06 17:51:00 +02:00
Konstantin Belousov
3eabce18b1 Include sys/types.h when needed. 2010-03-06 16:43:39 +02:00
Konstantin Belousov
29c110265f _NSIG. 2010-03-06 16:43:18 +02:00
Konstantin Belousov
c7ffca11ae FreeBSD way to name registers. 2010-03-06 16:35:32 +02:00
Konstantin Belousov
78cb28b4a6 PT_CONTINUE. 2010-03-06 16:20:47 +02:00
Konstantin Belousov
d4a4ddd23d Provide access to the general regs on FreeBSD. 2010-03-06 16:17:21 +02:00
Konstantin Belousov
cf6ae3548f Code to read/write user memory on FreeBSD 2010-03-06 15:04:56 +02:00
Konstantin Belousov
d11456ffbf Code to read/write fpregs on FreeBSD 2010-03-06 14:55:11 +02:00
Konstantin Belousov
905034ce72 Initial attempt at the build infrastructure for FreeBSD. 2010-03-06 00:41:37 +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
Stefan Demharter
752076789f Be gcc compatible for C++ exceptions on 32 bit platforms. 2010-02-21 22:45:08 -08:00
Arun Sharma
5a1d3c6fd7 Remove bogus check on scan_string which is guaranteed to fail every time. 2010-02-21 22:35:26 -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
9626d66019 Fix a race condition in dwarf unwinding.
Original code was accessing rs_cache memory without holding a lock
in some cases. If there was sufficient cache pressure, entry being
accessed may be overwritten by another thread, resulting in a data
race.

We now make a thread local copy of the data, before releasing the
lock. If we end up supporting UNW_CACHE_PER_THREAD properly
in the future, this memcpy should be unnecessary.
2009-11-24 15:18:48 -08:00
Paul Pluzhnikov
2648a77f04 Simplify control flow
Greetings,

Attached patch gets rid of additional unnecessary branch (rs_get_cache
can not return NULL unless caching_policy is UNW_CACHE_NONE), gets rid of
goto's, and makes apply_reg_state (major CPU consumer) execute with cache
lock not held (before the patch, apply_reg_state was called with lock held
for newly-inserted entries, but not for found-in-cache entries).

Tested on Linux/x86_64 with no regressions.

Thanks,
--
Paul Pluzhnikov
2009-11-20 12:04:13 -08:00
Paul Pluzhnikov
f958b9dc4f Get rid of some bogus checks.
Greetings,

Attached patch is rather on the obvious side:
- rs1 can't be NULL since it's assigned on previous line
- rs_new never returns NULL, and if it ever did, we'd crash on memcpy that
  preceeds the NULL check.

Tested on Linux/x86_64 with no regressions.

Thanks,
--
Paul Pluzhnikov
2009-11-20 11:40:05 -08:00
Arun Sharma
d7089547e2 Fix a warning message on i386
Without this, we may be accessing data beyond the array bounds.
2009-10-23 22:38:11 -07:00
Arun Sharma
491d576529 Fix compiler warnings on x86_64 2009-10-16 14:01:50 -07:00
Paul Pluzhnikov
b56375e76a Reduce stack use and apply CONFIG_DEBUG_FRAME to more code.
Currently, libunwind allocates several PATH_MAX entries on stack, while
trying to find a binary via /proc/.../maps.

However stack space may be at premium (especially when sigaltstack is used),
and PATH_MAX on Linux is 4096, while SIGSTKSZ is only 8192 on x86.

Attached patch eliminates multiple PATH_MAX stack allocations, and simplifies
code in maps_next, at the cost of being unable to do anything if we can't
mmap one page. It appears to me that under such low-memory conditions,
libunwind will fail shortly elsewhere anyway.

This patch also disables more of debug_frame-handling code when
CONFIG_DEBUG_FRAME is undefined.

Tested on Linux/x86_64 with and without CONFIG_DEBUG_FRAME, no regressions.
2009-10-07 12:51:03 -07:00
Paul Pluzhnikov
fc2934aade Make the remaining sigprocmask calls conditional on --enable-block-signals 2009-09-29 23:14:50 -07:00
Paul Pluzhnikov
839db77b7b Wait if there is contention on the cache
The behavior on wait vs abort unwind depends on the locking primitive
chosen by the user. This makes the API consistent and independent of
the locking primitive.
2009-09-25 09:38:55 -07: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
4b8404d153 Remove the special casing of ia64 for GetIPInfo()
This rule (no IP adjustment on ia64) may be correct for locating the right FDE.

Unfortunately the same adjusted/unadjusted return address is being used also by
__gxx_personality_v0() to locate the right call-site (the try {} block) for
unwinding.  And this case is already sensitive for off-by-one PC values.
Unlike the FDE location where the function prologue + epilogue make it immune
against off-by-one PC calculations.

Therefore suggesting to unify it with non-ia64 case.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
2009-04-24 11:10:08 -07:00
Arun Sharma
6aec15799d Fix ppc32 build.
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
2009-04-13 11:44:45 -07:00
Arun Sharma
40afb6667d Use a shorter path for include
This should've been a part of: 2fce54102c
2009-04-13 10:57:21 -07:00
Arun Sharma
2fce54102c Implement _Unwind_GetIPInfo() as required by the C++ ABI
Provide a special implementation for ia64, because the unwind
information is such that an IP adjustment is not necessary before
looking up unwind info.

Bad things happen if libunwind only provides parts of the ABI and
the rest come from libgcc.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
2009-04-02 22:22:05 -07:00
Arun Sharma
9607c6407c Fixup CONFIG_DEBUG_FRAME support. 2009-03-17 19:08:58 -07:00
Arun Sharma
ec53de82ec [PATCH] Avoiding name conflict with the GNU-specific dprintf in stdio.h
Signed-off-by: Yang Zhang <yaaang@gmail.com>
2009-03-16 21:37:11 -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
Arun Sharma
5822fca27a Enable Intel C++ compatibility only when C++ exceptions are enabled. 2009-03-16 21:34:49 -07:00
Arun Sharma
0bce5f0016 Remove auto generated files. 2009-03-16 21:34:49 -07:00
Arun Sharma
a2c27a4ab7 Make .debug_frame support optional.
Because these code paths use malloc and stdio, they could
cause deadlocks when we try to unwind stack from inside malloc.
2009-03-16 21:21:58 -07:00
David Mosberger-Tang
638302ed73 Rerun autoreconf. 2008-06-16 14:43:21 -06:00
Arun Sharma
ef29eade44 This patch eliminates one system call per unwind by not using the
getcontext in libc.

Also cleanup the namespace (check-name-space passes on x86_64 now).
Replace uses of offsets.h with ucontext_i.h.
Rename _x86_64_setcontext to _Ux86_64_setcontext.

TBD: Add CFI annotations for get/setcontext.

Signed-off-by: Paul Pluzhnikov <ppluzhnikov@google.com>
Signed-off-by: Arun Sharma <arun.sharma@google.com>
2008-06-16 14:42:16 -06:00
Arun Sharma
649f1fb344 [X86-64] For local unwinding, we have a defence mechanism against
bad/missing unwind information, which could result in libunwind
dereferencing bad pointers. This mechanism is based on msync(2) system
call and significantly reduces the chances of a bad pointer
dereference in libunwind.

The original idea was to turn this mechanism on only when necessary
i.e. libunwind didn't find proper unwind information for a IP.

There are a couple of problems in the current implementation.

* The flag is global and is modified without locking
* The flag isn't reset when starting a new unwind

The attached patch makes ->validate a per-thread setting by moving it
into struct cursor from unw_local_addr_space and resets it to false
when starting a new unwind. As a result, cursor->as_arg points to the
cursor itself instead of the ucontext (for the local case).

This was found to reduce the number of msync() system calls from an
application using libunwind significantly.

Signed-off-by: Paul Pluzhnikov <ppluzhnikov@google.com>
Signed-off-by: Arun Sharma <arun.sharma@google.com>
2008-06-16 14:35:53 -06:00
David Mosberger-Tang
183d28a066 Rebuild autoconf files with autoreconf. 2008-06-16 14:30:38 -06:00
Arun Sharma
8081e82ba1 Make the linking of C++ ABI related code for exceptions optional.
The default is to have it enabled.

Signed-off-by: Arun Sharma <arun.sharma@google.com>
2008-06-16 14:28:36 -06:00
Bruna Moreira
1eddefc371 [ARM] This patch add some missing bits on ARM platform.
* src/arm/unwind_i (arm_lock, arm_local_resume): Define.
 * src/ptrace/_UPT_find_proc_info.c: Handle ARM like X86 etc.
 * tests/flush-cache.S (flush_cache): Add (dummy) ARM-version.
	ARM does need executable stack, even on Linux...

Signed-off-by: Anderson Lizardo <anderson.lizardo@indt.org.br>
Signed-off-by: Bruna Moreira <bruna.moreira@indt.org.br>
2008-04-21 13:43:18 -06:00
Paul Pluzhnikov
bb9d3dc689 [X86-64] Fix the pattern used to match signal frames.
The current pattern is too restrictive and doesn't work well on
modern glibcs.

Signed-off-by: Paul Pluzhnikov <ppluzhnikov@google.com>
Signed-off-by: Arun Sharma <arun.sharma@google.com>
2008-04-16 08:05:49 -06:00
Daniel Jacobowitz
3842dac733 Add initial ARM and MIPS support. To support this, also enable the
reading of .debug_frame sections (used in lieu of .eh_frame sections
when they're not available).
2008-02-04 17:16:37 -07:00
Mark Wielaard
5ed2da2a40 [DWARF] Fix error return.
* src/dwarf/Gfde.c (dwarf_extract_proc_info_from_fde):
	  Return -UNW_ENOMEM.
2008-02-04 16:31:34 -07:00
David Mosberger-Tang
f5cb2c52dc 2007-12-14 Mark Wielaard <mwielaard@redhat.com>
* src/mi/Gget_reg.c (unw_get_reg): Use tdep_get_ip() when
   looking for UNW_REG_IP.
2008-01-07 15:43:42 -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
David Mosberger-Tang
826374cee5 Merge ../libunwind-v0.98
Conflicts:

	configure
	configure.in
	src/ia64/Ginit.c
2007-11-14 16:51:14 -07:00
David Mosberger-Tang
3899ab7039 Update NEWS file and rerun "autoreconf". 2007-11-14 13:04:15 -07:00
Curt Wohlgemuth
7fda769769 ia64 [src/ia64/Ginit.c]: Don't mark the reference to _Uelf64_get_proc_name
as "weak".  Since the elf-support is in the library anyhow, this serves
     no purpose and in fact causes problem because the weak reference alone
     is not enough to pull in the ELF-code from an archive file, causing to
     spurious failures of get_proc_name.
2007-11-14 12:59:10 -07:00
Curt Wohlgemuth
253f3e5738 [Linux] Fix potentially overlapping memory-copy to use memmove() instead
of memcpy().
2007-10-18 10:45:55 -06: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
Jose Flavio Aguilar Paulino
9ea6af8ed5 [PPC32] Make PPC32 unwinding work for real. 2007-10-08 12:33:18 -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
Jose Flavio Aguilar Paulino
c340d04279 [PPC32] Make get_func_addr() a no-op function.
[PPC64] Add .../lib64 library directory when targeting ppc64.
2007-09-20 11:11:37 -06:00
Jose Flavio Aguilar Paulino
4499bb29a6 [PPC32] First check-in to add preliminary support for Linux/PPC32. 2007-09-12 21:52:25 -06:00
David Mosberger-Tang
6d75df39b5 Regenerate Makefile.in. 2007-08-27 15:31:10 -06:00
Jose Flavio Aguilar Paulino
32e2187fab [PPC64] Get "make check" to work on PPC64 Linux. Add a README entry
describing the expected results.
2007-08-27 09:11:37 -06:00
Jose Flavio Aguilar Paulino
3e24581adc [PPC64] Add PPC64 entry to README and fix David's typo in ppc64/get_func_addr.c 2007-08-24 10:54:00 -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
David Mosberger-Tang
03e05b4138 Fix two minor compiler-warnings. 2007-08-22 12:57:49 -06:00
David Mosberger-Tang
7fdd022ccf Update autoconf files. 2007-08-09 21:18:15 -06:00
Arun Sharma
bcca3ddcc0 [x86-64] Fix cross-compilation. setcontext.S can only be built natively. 2007-08-07 21:09:12 -06:00
David Mosberger-Tang
297315675e Recreate autoconf files. 2007-08-06 20:27:29 -06:00
David Mosberger-Tang
5c95d139df Cleanup some files from previous patch and rerurn autoconf tools. 2007-08-06 19:59:28 -06:00
Arun Sharma
3afd613545 [X86-64]: Instead of auto-generating _u_context_i.h, hardcode the
necessary offsets in offsets.h as is done for other
	  platforms.  This fixes cross-builds.
2007-08-06 19:58:12 -06:00
David Mosberger-Tang
fad8b04c9f Rebuilt configure and Makefile.in files. 2007-08-06 19:56:28 -06:00
Jose Flavio Aguilar Paulino
b33021e4b2 Add PPC64 support. 2007-08-02 09:59:43 -06:00
David Mosberger-Tang
a6393c0be1 Merge ../libunwind-v0.98 2007-06-06 20:58:56 -06:00
Andreas Schwab
09c8c7d0f3 (unw_create_addr_space): Fix address-leak that triggered when function
was called with an unsupported "byte_order".

Signed-off-by: David Mosberger-Tang <dmosberger@gmail.com>
2007-06-06 20:55:36 -06:00
David Mosberger-Tang
7923ae31a0 Re-run aclocal and automake to update Makefiles so new files (e.g.,
x86_64/gen_offsets.c) get distributed.
2007-04-10 20:35:15 -06:00
Arun Sharma
497b987043 Add gen-offsets to the Makefile
This is so that the source file gets distributed and _ucontext_i.h is
generated properly on the target machine.

Signed-off-by: Arun Sharma <arun.sharma@google.com>
2007-04-10 20:18:56 -06:00
Arun Sharma
31440e9796 Make libunwind pass C++ exceptions correctly
When libunwind is linked with a C++ program that throws exceptions,
the exception that's thrown is passed in %rax. However, libc's
setcontext clears %rax, causing problems.

This patch implements a setcontext that doesn't clobber rax.

TBD: Add dwarf CFI annotations

Signed-off-by: Arun Sharma <arun.sharma@google.com>
2007-04-05 20:40:41 -06:00
Arun Sharma
55fe524775 Cleanup the hash() function copied from ia64
Fixes the compiler warning on x86-32.

Signed-off-by: Arun Sharma <arun.sharma@google.com>
2006-08-16 15:43:49 -06:00
Arun Sharma
a5d0c1f8b7 Remove HAVE___THREAD. This was never tested.
Signed-off-by: Arun Sharma <arun.sharma@google.com>
2006-08-16 15:41:32 -06:00
David Mosberger-Tang
62bacfcf1f [x86-64] Minor reformatting for GNU-style and use memset() in lieu of bzero(). 2006-08-10 21:34:31 -06:00
Arun Sharma (अरुण)
795529eee3 [x86-64] Add a known good address cache.
This improves the performance of Lperf-simple from 500ns to 195ns
on the avg.

Signed-off-by: Arun Sharma <arun.sharma@google.com>
2006-08-10 21:30:01 -06:00
David Mosberger-Tang
bde67706ed Delete some backup files that accidentally made it into git. 2006-07-27 21:30:19 -06:00
Arun Sharma
11ea1275bd [dwarf] The sword() function in Gexpr.c doesn't do what's intended.
Yes, it casts to signed, but then converts right back to
unsigned via the return type.  Fixed thus.

Signed-off-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Arun Sharma <arun.sharma@google.com>
2006-07-26 22:12:10 -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
Arun Sharma
8297866bd4 [x86-64] (unw_step): Further refine handling of functions without unwind-info.
CFA should be incremented by 16 in the hope that the previous frame
may have valid unwind info.

Also increase the default frame pointer recognition heuristic from 4k
to 16k.

Signed-off-by: Andrey Veskov <Andrey.Veskov@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@google.com>
2006-07-26 22:06:48 -06:00
Arun Sharma
06d2ffa41a [x86-64] (unw_step): Improve handling of functions which lack unwind info.
If following the frame-chain leads to a frame >= 4KB away, we conclude that
the frame-pointer isn't really valid.
2006-07-26 22:04:40 -06:00
Arun Sharma
7c0907634d [x86-64] (unw_is_signal_frame): If access mem fails, it's not a signal frame. 2006-07-26 21:58:27 -06:00
Arun Sharma
58888a5060 (dwarf_find_save_locs): Also apply register-state after parsing the FDE 2006-07-26 21:55:09 -06:00
Arun Sharma
527225e492 [x86-64] Make a best effort at validating pointers before dereferencing them.
Signed-off-by: Arun Sharma <arun.sharma@google.com>
2006-07-26 21:46:39 -06:00
Arun Sharma
4312719cbc [dwarf] Need to guard against multiple threads accessing the rs cache.
Signed-off-by: Arun Sharma <arun.sharma@google.com>
2006-07-26 21:44:38 -06:00
Arun Sharma
c5dc3c150a [dwarf] Allow return address column to differ from function to function.
Signed-off-by: Andrey Veskov <Andrey.Veskov@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@google.com>
2006-07-26 21:29:50 -06:00
Arun Sharma
60b7af702a (dwarf_find_save_locs): Add a comment.
Now that dwarf_find_save_locs() not just finds the save-locations but
also updates the cursor-state, document this fact (the function really
is misnamed now).
2006-07-26 21:25:37 -06:00
Arun Sharma
3dfde7a3f0 (dwarf_find_save_locs): put_unwind_info() is not needed in the cached case. 2006-07-26 21:23:30 -06:00
Arun Sharma
00db7f752a Implement a ip -> dwarf_reg_state cache.
Signed-off-by: Arun Sharma <arun.sharma@google.com>
2006-07-26 21:18:49 -06:00
David Mosberger-Tang
1a0af36731 Fix forgotten copyright year update. 2006-07-26 15:48:48 -06:00
David Mosberger-Tang
6a89d40236 Fix missed "tdep.h" -> "libunwind_i.h" conversions. 2006-07-26 15:44:23 -06:00
David Mosberger-Tang
8c94e12429 (_UPT_find_proc_info): Fix potential crash due to uninitialized pointer.
Be sure to clear pi->unwind_info when looking up the kernel table and
not needing the unwind-info.  Otherwise, _UPT_put_unwind_info() may
erroneously call free() on the pointer, even though that space wasn't
malloc'd, leading to crashes..
2006-07-26 15:43:23 -06:00
David Mosberger-Tang
fd2fa63a6c Fix missed merge on setjmp_i.h and siglongjmp.c. 2006-07-26 15:21:52 -06:00
David Mosberger-Tang
69d85f7c14 Restore mi/Ldyn-remote.c. 2006-07-26 15:10:48 -06:00
David Mosberger-Tang
236e370dc5 Remove three Emacs backup-files which accidentially got checked into git. 2006-07-26 14:54:50 -06:00
David Mosberger-Tang
6daeeac60a Revert "Initial revision"
This reverts e6446885f4 commit.
2006-07-26 14:53:49 -06:00
David Mosberger-Tang
a369768c27 Revert "Initial revision"
This reverts 06d223e924 commit.
2006-07-26 14:47:44 -06:00
David Mosberger-Tang
ca69fee8bb Merge ../libunwind-v0.98
Conflicts:

	include/dwarf_i.h
	include/x86/jmpbuf.h
	include/x86_64/jmpbuf.h
	src/hppa/init.h
	src/mi/Gget_fpreg.c
	src/mi/Gset_fpreg.c
	src/mi/strerror.c
2006-07-25 21:41:43 -06:00
David Mosberger-Tang
af2503e223 Fix bug in libunwind-ptrace which can cause reading of random data.
(maps_next): After reading less than a full buffer of data, copy
remaining data to the top of the buffer so as to maintain the
invariant that all data between mi->buf and mi->buf_end is valid.
This avoids maps_next() parsing uninitialized data.
2006-07-25 21:35:30 -06:00
David Mosberger-Tang
f176ad6fc6 Bring git v0.98.5 tree in sync with released v0.98.5.
Sadly, the conversion from Bitkeeper -> CVS -> git wasn't perfect.  Or
so it seems.
2006-07-25 21:32:28 -06:00
hp.com!davidm
36a0275014 Allow write-access to UNW_IA64_BSP and UNW_REG_SP.
(Logical change 1.303)
2005-05-20 15:32:18 +00:00
hp.com!davidm
cf2a44ca49 Use update_nat() instead of equivalent open code.
(Logical change 1.301)
2005-05-20 14:58:46 +00:00
hp.com!davidm
f5de64f9f7 If r1 has been saved in an ABI-specific frame
(such as an interrupt frame), access the saved
value.  Otherwise, pick it up from the unwind-info
for the matching IP.

(Logical change 1.300)
2005-05-20 14:50:54 +00:00
hp.com!davidm
399f120c96 Drop unused readonly variable.
(Logical change 1.299)
2005-05-20 14:13:01 +00:00
hp.com!davidm
3fa950e818 Remove early-out test when IP is zero.
(Logical change 1.298)
2005-05-20 13:35:32 +00:00
hp.com!davidm
19e3bf3ea6 (rbs_switch): Use rbs_get_base() to determine the size of the register
backing store.

(Logical change 1.297)
2005-05-20 13:13:07 +00:00
hp.com!davidm
9724ac492c (common_init): Use rbs_get_base() to determine size of register-backing store.
(Logical change 1.297)
2005-05-20 13:13:07 +00:00
hp.com!davidm
080f8423d9 Read sp and bsp via ia64_get() and then pass them to common_init().
(Logical change 1.296)
2005-05-20 12:47:59 +00:00
hp.com!davidm
50bbc1fe3d (set_as_arg): New function.
(get_initial_stack_pointers): Likewise.
(unw_init_local): Use new functions to make code more readable and add
	Linux kernel support.

(Logical change 1.296)
2005-05-20 12:47:59 +00:00
hp.com!davidm
84bd124a24 (inlined_uc_addr): Remove UNW_IA64_AR_BSP. We no longer need this ugly hack
since the initial BSP is now passed directly into common_init().

(Logical change 1.296)
2005-05-20 12:47:59 +00:00
hp.com!davidm
4992f1c936 (common_init): Take initial sp and bsp values as arguments instead of
reading them via ia64_get().

(Logical change 1.296)
2005-05-20 12:47:59 +00:00
hp.com!davidm
97b483dcaa Drop include of "mempool.h", which causes problems in the kernel, due to
a conflicting <linux/mempool.h>.
(SOS_MEMORY_SIZE): Move to libunwind_i.h.

(Logical change 1.295)
2005-05-20 11:28:16 +00:00
hp.com!davidm
1b63be3f89 (parse_dynamic): Make it a dummy-function of _U_dyn_op isn't defined, i.e.,
if libunwind-dynamic.h isn't in use (as is the case for the kernel at
	the moment).

(Logical change 1.295)
2005-05-20 11:28:16 +00:00
hp.com!davidm
7894f0edc0 (ia64_strloc): Move to Grbs.c.
(Logical change 1.295)
2005-05-20 11:28:16 +00:00
hp.com!davidm
96407911ee (ia64_strloc): Move here from Ginit.c so it can be shared with the kernel.
(Logical change 1.295)
2005-05-20 11:28:16 +00:00
hp.com!davidm
2e35dd035c Regenerate.
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
3e8a50255c Include from tdep-$(arch) directory after the normal incliude directory.
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
32385d36fd Include "tdep-ia64/rse.h" instead of "ia64/rse.h".
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
1228462adc Include "rse.h" instead of "ia64/rse.h".
Include "libunwind_i.h" instead of "internal.h" and "tdep.h".
Define rbs_cover_and_flush() only for the !UNW_REMOTE_ONLY case.
(ia64_is_big_endian): New macro.
(ia64_get_abi): Likewise.
(ia64_set_abi): Likewise.
(ia64_get_abi_marker): Likewise.

(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
8e6f3c8485 Include "rse.h" instead of "ia64/rse.h".
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
83820a78d1 Include "libunwind_i.h" instead of "tdep.h".
Include "tdep-ia64/rse.h" instead of "ia64/rse.h".

(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
67f90c24be Include "libunwind_i.h" instead of "tdep.h".
Include "elfxx.c" instead of "elf64.c".

(Logical change 1.294)
2005-05-20 09:48:08 +00: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
hp.com!davidm
670dd57e82 Include "libunwind_i.h" instead of "libunwind.h" and a whole bunch of standard
header files.
Use lock_release instead of mutex_unlock/sigprocmask calls.

(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
5724bee8c2 Include "libunwind_i.h" instead of "internal.h".
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
19df6612fa Include "libunwind_i.h" instead of "internal.h" and "tdep.h".
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
b7adf160ee Include "dwarf_i.h" instead of "dwarf.h".
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
c027d98386 Don't include headers already included via unwind_i.h.
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
df3d6af467 Don't include <string.h>.
Include "libunwind_i.h" instead of "tdep.h".

(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
dda1a6d625 Don't include <string.h>.
Include "libunwind_i.h" instead of "internal.h" and "tdep.h".

(Logical change 1.294)
2005-05-20 09:48:08 +00: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
9e8ba174e6 Don't include <string.h> and <stdlib.h>.
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
9fac7579ee Don't include <string.h> and "tdep.h".
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
71acf1d00e Don't include <stdlib.h>.
Include "libunwind_i.h" instead of "tdep.h".

(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
03ba50ccaa Don't include <stdlib.h> and <string.h>.
Include "libunwind_i.h" instead of "tdep.h".

(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
fa2871946a Don't include <assert.h> and <stddef.h>.
Use ia64_get_abi_marker() instead of directly referencing c->last_abi_marker.
(linux_scratch_loc): When accessing an fp-reg, default to IA64_FPREG_LOC.
	Handle more registers for the Linux interrupt-frame case.
(tdep_access_reg): Use ia64_get_abi() instead of c->as->abi.
	Use ia64_is_big_endian() instead of c->as->big_endian.

(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
8bb167d4c1 Don't include <alloca.h> and <stdlib.h>.
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
6675be4926 (linux_interrupt): Enable this code for the kernel, too.
Use ia64_get_abi_marker() instead of c->abi_marker.
	Use ia64_set_abi() instead of storing directly to c->as->abi.

(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
ee6eeb4f7d (get_script_cache): Use HAVE_ATOMIC_H instead of __linux && __KERNEL__.
(Logical change 1.294)
2005-05-20 09:48:08 +00:00
hp.com!davidm
8a1e0a2bcd Auto merged
2005/05/17 14:14:23-07:00 hp.com!davidm
(tdep_access_reg): Access AR.EC via ec_loc instead of cfm_loc.

(Logical change 1.293)
2005-05-17 21:28:19 +00:00
hp.com!davidm
26fdb45d76 Auto merged
2005/05/17 14:14:23-07:00 hp.com!davidm
(linux_sigtramp): Add "prev_cfm_loc" argument.  Use it to set c->ec_loc.
(linux_interrupt): Likewise.
(hpux_sigtramp): Likewise.
(update_frame_state): Copy old cfm_loc to prev_cfm_loc and pass it to
	ABI-specific handlers.  Initialize c->ec_loc to c->cfm_loc by default.

(Logical change 1.293)
2005-05-17 21:28:19 +00:00
hp.com!davidm
a6ba57d556 Auto merged
2005/05/17 06:10:13-07:00 hp.com!davidm
(tdep_access_reg): Don't rotate contents of UNW_IA64_PR.

(Logical change 1.292)
2005-05-17 13:24:49 +00:00
hp.com!davidm
8462f1f87d (pr_ltop): Remove.
(pr_ptol): Remove.

(Logical change 1.292)
2005-05-17 13:24:49 +00:00
mostang.com!davidm
23884c98cb Rename: src/sigsetjmp.c -> src/setjmp/sigsetjmp.c
}(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
4d7f2a5be7 Rename: src/sigsetjmp.c -> src/setjmp/sigsetjmp.c
(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
5ac5853589 Rename: src/setjmp.c -> src/setjmp/setjmp.c
}(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
8e06df0e52 Rename: src/setjmp.c -> src/setjmp/setjmp.c
(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
9bc79a618b Rename: src/dwarf/dwarf-eh.h -> include/dwarf-eh.h
}(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
06d223e924 Initial revision 2005-05-03 09:13:17 +00:00
mostang.com!davidm
4e833d43fc Include "setjmp_i.h".
Abstract ia64-specific code into bsp_match() routine.
Support any platform with at least 2 EH argument registers.

}(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
4f16756123 Include "setjmp_i.h".
Abstract ia64-specific code into bsp_match() routine.
Support any platform with at least 2 EH argument registers.

2004/12/06 01:33:16-08:00 mostang.com!davidm
Rename: src/longjmp.c -> src/setjmp/longjmp.c

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
203c0a5363 Include "setjmp_i.h".
Abstract ia64-specific code into bsp_match() and
resume_restores_sigmask() routines.

}(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
acf90b1f82 Include "setjmp_i.h".
Abstract ia64-specific code into bsp_match() and
resume_restores_sigmask() routines.

2004/12/06 01:33:01-08:00 mostang.com!davidm
Rename: src/siglongjmp.c -> src/setjmp/siglongjmp.c

(Logical change 1.290)
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
7a5549f2d8 Drop "inline" since it's now part of ALWAYS_INLINE.
(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
411331eecb Delete: src/hppa/Lget_reg.c
}(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
ca02ad1708 Delete: src/hppa/Lget_proc_name.c
}(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
181bddfba0 Delete: src/hppa/Gget_reg.c
}(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
f45210852c Delete: src/hppa/Gget_proc_name.c
}(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
10a269d6d0 Also enable DWARF code for UNW_TARGET_HPPA.
2004/11/23 16:59:56-08:00 mostang.com!davidm
(_UPTi_find_unwind_table): Implement first draft for x86/-64.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
b267dfc8c9 Adjust for sigset_t to intrmask_t renaming.
}(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
dc89a17613 Adjust for sigset_t to intrmask_t renaming.
2004/12/02 00:40:45-08:00 mostang.com!davidm
Add copyright notice.
Provide canonical DWARF-based implementation.

2004/11/30 23:38:42-08:00 mostang.com!davidm
Rename: src/hppa/global.c -> src/hppa/Gglobal.c

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
1f5ac0f5bd Adjust for sigset_t to intrmask_t renaming.
2004/11/17 02:43:39-08:00 mostang.com!davidm
(struct callback_data): New structure.
(linear_search): New function.
(callback): Convert to getting auxiliary info passed via a pointer to
	a callback_data structure, rather than an unw_dyn_info_t
	structure.
	Keep track of the maximum load address in max_load_addr.
	If an object doesn't have a binary search-table, fall back
	on a linear search.
(dwarf_find_proc_info): Fill in callback-data structure before calling
	dl_iterate_phdr().  Upon returning, check whether
	cb_data.single_fde is set and, if so, return directly, without
	searching the DWARF unwind-table.
(dwarf_search_unwind_table): Adjust for renaming of
	dwarf_parse_fde() to dwarf_extract_proc_info_from_fde().
	If IP doesn't fall into the IP-range of the FDE-entry found
	by the search, return UNW_ENOINFO.

(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
9f3360a546 Adjust for "ia64_rse" to "rse" prefix change.
2005/02/23 12:55:45-08:00 mostang.com!davidm
(inlined_uc_addr): Adjust for ALWAYS_INLINE change.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
7f8b54ae5c Adjust for "ia64_rse" to "rse" prefix change.
2005/02/20 21:42:55-08:00 mostang.com!davidm
Adjust for NELEMS to ARRAY_SIZE renaming.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
3f73836b87 Adjust for "ia64_rse" to "rse" prefix change.
2004/12/15 15:40:09-08:00 hp.com!davidm
Include "tdep.h" on ia64 (we need the cursor).
(bsp_match): Fix it so it compiles again.
(resume_restore_sigmask): Likewise.

2004/12/06 10:40:49-08:00 mostang.com!davidm

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
3e00b79170 Adjust for "ia64_rse" to "rse" prefix change.
2004/12/06 10:40:49-08:00 mostang.com!davidm
(tdep_access_reg): Fix typo in code to read EH argument registers.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
4849af2d09 Adjust for "ia64_rse" to "rse" prefix change.
2004/11/23 16:59:56-08:00 mostang.com!davidm
(_UPT_access_reg): If the register is out of range, set errno
	to EINVAL.
	When encountering an error while accessing a register,
	print the corresponding error string.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
87081cebab Adjust for "ia64_rse" to "rse" prefix change.
2004/10/25 07:52:30-07:00 hp.com!davidm
(unw_step): Add Debug statement to print return-value.

2004/10/25 05:21:51-07:00 hp.com!davidm
(unw_step): Print IP along with cursor address.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
bf832fc29e Adjust for "ia64_rse" to "rse" prefix change.
(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
17bf4d0af8 (unw_step): If dwarf_step() fails and the frame doesn't look like
a signal-trampoline, assume that it's a PLT stub.
	If non-DWARF stepping fails to change IP and CFA, declare
	it a bad frame.

2004/11/23 16:59:56-08:00 mostang.com!davidm
(unw_step): Also print IP as part of the function-trace.

2004/11/23 16:17:37-08:00 mostang.com!davidm
(unw_step): When dwarf_step() fails on a signal-frame, fill in all
	the known locations because dwarf_step() fails on older
	kernels which don't export the kernel vDSO even though every-
	thing else may be providing proper DWARF unwind-info.

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
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
93599dc278 (unw_init_local): Implement it based on the DWARF unwinder.
(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
0f27732d35 (unw_get_proc_info): Implement it based on dwarf_make_proc_info().
(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
7ac9665fd3 (unw_get_proc_info): Don't freak out if dwarf_make_proc_info() fails.
Unfortunately, it must fail for current versions of libc
	since they fail to provide unwind-info for _start() and
	_dl_start().

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
b1b84400b9 (tdep_uc_addr): Define as HIDDEN.
(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
caa61dfec1 (remote_install_cursor): Fix off-by-one error.
2004/10/25 05:21:51-07:00 hp.com!davidm
(unw_resume): Print IP along with cursor-address.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
46b7b8196c (is_cie_id): New function.
(parse_cie): Adjust for moving DWARF2 extra-info from
	unw_dyn_dwarf_fde_info_t to dwarf_cie_info.
	Add support for `S' augmentation ("special frames").
(dwarf_extract_proc_info_from_fde): Rename frm dwarf_parse_fde().
	Convert to returning data via dwarf_cie_info rather than
	unw_dyn-dwarf_fde_info_t.  Allow 0-length FDE since those
	can be used to indicate the end of the FDE-table.  Return
	the end of the FDE via *ADDRP.  Ignore CIEs (we may pick them
	up during linear searches through the FDE-table).
	Fill in the unwind-info only if really needed.  When needed,
	return the info via a dynamically allocated dwarf_cie_info
	structure.  Add support for `S' augmentation (ABI/tag pairs).

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
c14371409a (fetch_proc_info): Decrement IP before searching for dynamic/static
unwind-info, since DWARF expects us to do so (unlikey for ia64,
	where we are guaranteed that the (return) IP points to the
	correct unwind-info).

2004/11/17 02:43:39-08:00 mostang.com!davidm
(run_cfi_program): Switch over to using dwarf_cie_info instead of
	unw_dyn_dwarf_fde_info_t.
(fetch_proc_info): Clear c->pi before filling it in.
(put_unwind_info): If we got non-dynamic unwind-info, free it
	via a call to mempool_free().
(parse_fde): Switch over to using dwarf_cie_info instead of
	unw_dyn_dwarf_fde_info_t.
(apply_reg_state): Drop accessees to c->cfa_is_sp.

2004/10/25 17:38:51+02:00 homeip.net!davidm
Fix typo: DW_CFA_CFA_expression -> DW_CFA_expression.

2004/10/21 11:15:44+02:00 homeip.net!davidm
Auto merged

2004/10/21 11:15:12+02:00 homeip.net!davidm
(run_cfi_program): Add missing newline in Debug statement.
(apply_reg_state): It was wrong to do a dwarf_get() on the CFA-location
	returned by eval_location_expr().  Instead, we must make sure
	we're dealing with a memory-location and, if so, just extract
	the memory address as the CFA.
	Also, update c->cfa only _after_ the other frame-state has
	been updated.  This seems to be necessary for correct parsing
	of the sigtramp unwind info.  Not sure yet this is 100% correct,
	but it gets us through Gtest-resume-sig.

2004/10/19 23:24:56-07:00 mostang.com!davidm
(run_cfi_program): Fix typos in Debug statements.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
4502aa0ff2 (dwarf_read_encoded_pointer): Implement simply by calling
dwarf_read_encoded_pointer_inlined().

2004/11/17 02:43:39-08:00 mostang.com!davidm
(dwarf_read_encoded_pointer): Declare proc-info-pointer argument
	as "const".

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
3239e7db60 (dwarf_cie_info_pool): New variable.
(dwarf_init): Initialize dwarf_cie_info_pool.

(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
7fcb8006a9 (common_init): Adjust for ALWAYS_INLINE change.
(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
9c025efac2 (_UI_siglongjmp_cont): Provide dummy implementation.
(_UI_longjmp_cont): Likewise.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
mostang.com!davidm
e3180d47a0 (UC_MCONTEXT_{R8-R15,RDI,RSI,RBX,RDX,RAX,RCX}: New macros.
(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
981ff25f70 Regenerate.
2004/12/15 15:36:36-08:00 hp.com!davidm
Regenerate.

2004/12/06 10:40:49-08:00 mostang.com!davidm
Regenerate.

2004/12/04 17:03:36-08:00 mostang.com!davidm
Regenerate.

2004/12/02 00:40:45-08:00 mostang.com!davidm
Regenerate.

2004/11/23 16:59:56-08:00 mostang.com!davidm
Regenerate.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
hp.com!davidm
e6446885f4 Initial revision 2005-05-03 09:13:17 +00:00
hp.com!davidm
516f759229 Fix two typos which kept things from building on x86-64 and other
platforms.

(Logical change 1.290)
2005-05-03 09:13:17 +00:00
hp.com!davidm
0dec41725c Fix missing NELEMS -> ARRAY_SIZE adjustment.
2004/12/02 00:40:45-08:00 mostang.com!davidm

(Logical change 1.290)
2005-05-03 09:13:17 +00:00