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

185 commits

Author SHA1 Message Date
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
homeip.net!davidm
5742642c24 (unw_step): Drop extra 'x' from Debug statement.
(Logical change 1.248)
2004-08-19 12:26:11 +00:00
homeip.net!davidm
8f4a9df420 Rename: src/x86/siglongjmp-x86.S -> src/x86/siglongjmp.S
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
b8f4069f9f Rename: src/x86/siglongjmp-x86.S -> src/x86/siglongjmp.S
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
c298861c67 Rename: src/x86/regname-x86.c -> src/x86/regname.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
85b14bb7f6 Rename: src/x86/regname-x86.c -> src/x86/regname.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
0219cd0e73 Rename: src/x86/is_fpreg-x86.c -> src/x86/is_fpreg.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
188032186b Rename: src/x86/is_fpreg-x86.c -> src/x86/is_fpreg.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
2e94aaed46 Rename: src/x86/Gstep-x86.c -> src/x86/Gstep.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
3dab98edbc Rename: src/x86/Gstep-x86.c -> src/x86/Gstep.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
fe971b1989 Rename: src/x86/Gresume-x86.c -> src/x86/Gresume.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
bcd0aff352 Rename: src/x86/Gresume-x86.c -> src/x86/Gresume.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
e7671cd144 Rename: src/x86/Gregs-x86.c -> src/x86/Gregs.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
6607424863 Rename: src/x86/Gregs-x86.c -> src/x86/Gregs.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
8652314904 Rename: src/x86/Gis_signal_frame-x86.c -> src/x86/Gis_signal_frame.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
e1eb2d4656 Rename: src/x86/Gis_signal_frame-x86.c -> src/x86/Gis_signal_frame.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
475062bfda Rename: src/x86/Ginit_remote-x86.c -> src/x86/Ginit_remote.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
9f2cd2318d Rename: src/x86/Ginit_remote-x86.c -> src/x86/Ginit_remote.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
66fe735a7d Rename: src/x86/Ginit_local-x86.c -> src/x86/Ginit_local.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
db8a0c4373 Rename: src/x86/Ginit_local-x86.c -> src/x86/Ginit_local.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
5bb574d178 Rename: src/x86/Ginit-x86.c -> src/x86/Ginit.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
588192d301 Rename: src/x86/Ginit-x86.c -> src/x86/Ginit.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
a2bd90a8ed Rename: src/x86/Gglobal-x86.c -> src/x86/Gglobal.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
ab6b58eae7 Rename: src/x86/Gglobal-x86.c -> src/x86/Gglobal.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
9f6b814a25 Rename: src/x86/Gget_save_loc-x86.c -> src/x86/Gget_save_loc.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
cf0945223e Rename: src/x86/Gget_save_loc-x86.c -> src/x86/Gget_save_loc.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
387d1d739b Rename: src/x86/Gget_proc_info-x86.c -> src/x86/Gget_proc_info.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
a4279b3808 Rename: src/x86/Gget_proc_info-x86.c -> src/x86/Gget_proc_info.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
499307bf0f Rename: src/x86/Gcreate_addr_space-x86.c -> src/x86/Gcreate_addr_space.c
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
1682f9745e Rename: src/x86/Gcreate_addr_space-x86.c -> src/x86/Gcreate_addr_space.c
(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
b29905fdc9 Regenerate.
}(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
07d87a5e7d Regenerate.
2004/08/17 16:32:23+02:00 homeip.net!davidm
Rename: src/x86/Lstep-x86.c -> src/x86/Lstep.c

(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
185e9e4c92 Regenerate.
2004/08/17 16:32:23+02:00 homeip.net!davidm
Rename: src/x86/Lresume-x86.c -> src/x86/Lresume.c

(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
84472b4ae4 Regenerate.
2004/08/17 16:32:23+02:00 homeip.net!davidm
Rename: src/x86/Lregs-x86.c -> src/x86/Lregs.c

(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
be5949c452 Regenerate.
2004/08/17 16:32:23+02:00 homeip.net!davidm
Rename: src/x86/Lis_signal_frame-x86.c -> src/x86/Lis_signal_frame.c

(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
244a6fe692 Regenerate.
2004/08/17 16:32:23+02:00 homeip.net!davidm
Rename: src/x86/Linit_remote-x86.c -> src/x86/Linit_remote.c

(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
3613478b71 Regenerate.
2004/08/17 16:32:23+02:00 homeip.net!davidm
Rename: src/x86/Linit_local-x86.c -> src/x86/Linit_local.c

(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
b8760cad51 Regenerate.
2004/08/17 16:32:23+02:00 homeip.net!davidm
Rename: src/x86/Linit-x86.c -> src/x86/Linit.c

(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
531becfa78 Regenerate.
2004/08/17 16:32:22+02:00 homeip.net!davidm
Rename: src/x86/Lglobal-x86.c -> src/x86/Lglobal.c

(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
7e7e51f763 Regenerate.
2004/08/17 16:32:22+02:00 homeip.net!davidm
Rename: src/x86/Lget_save_loc-x86.c -> src/x86/Lget_save_loc.c

(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
72dcdc54f2 Regenerate.
2004/08/17 16:32:22+02:00 homeip.net!davidm
Rename: src/x86/Lget_proc_info-x86.c -> src/x86/Lget_proc_info.c

(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
0974d952fb Regenerate.
2004/08/17 16:32:22+02:00 homeip.net!davidm
Rename: src/x86/Lcreate_addr_space-x86.c -> src/x86/Lcreate_addr_space.c

(Logical change 1.241)
2004-08-17 15:34:28 +00:00
homeip.net!davidm
3f9d2e9c5c Initial revision 2004-08-17 15:34:28 +00:00
hp.com!davidm
5ccc669fa7 (tdep_uc_addr): Declare as HIDDEN. Initialize find_proc_info with
dwarf_find_proc_info, not tdep_find_proc_info.

(Logical change 1.233)
2004-05-06 22:02:00 +00:00
mostang.com!davidm
09ba7e9440 (unw_step): If dwarf_step() returns -UNW_ESTOPUNWIND, take that
as a hard signal that we should stop unwinding.  This
	fixes tests/test_proc_info.

(Logical change 1.224)
2004-05-05 01:54:53 +00:00
hp.com!davidm
410f962b8d Update.
}(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
fcd8dad37e Update.
(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
f913dd3bd1 Start to implement it for real.
(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
88becf1e73 Rename: BitKeeper/deleted/.del-Gget_proc_name-x86.c~b007d49727921c1 -> src/x86/Gget_proc_name-x86.c
(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
62ce00d5f0 Rename x86_init() to tdep_init().
(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
b88369b831 Initial revision 2004-01-30 00:01:24 +00:00
hp.com!davidm
815c101f82 Delete: src/x86/flush_cache-x86.c
}(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
196357239d Delete: src/x86/Lset_caching_policy-x86.c
}(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
2240eea139 Delete: src/x86/Lget_proc_name-x86.c
}(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
5dee82687d Delete: src/x86/Lget_accessors-x86.c
}(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
2cc74f80b4 Delete: src/x86/Lflush_cache-x86.c
}(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
36f4f67b98 Delete: src/x86/Gset_caching_policy-x86.c
}(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
3435b58201 Delete: src/x86/Gget_accessors-x86.c
}(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
cf6c388834 Delete: src/mi/Lset_reg-mi.c
}(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
dbf6df2f72 Delete: src/mi/Lget_reg-mi.c
}(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
1cc4569725 Add warning until it's fully implemented.
(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
21a24ca246 (linux_scratch_loc): New function.
(tdep_access_reg): Rename from x86_access_reg() and fix up some things.
(tdep_access_fpreg): Likewise.

(Logical change 1.162)
2004-01-30 00:01:24 +00:00
hp.com!davidm
ab847fe68e (Logical change 1.162) 2004-01-30 00:01:24 +00:00
hp.com!davidm
627437ce2d Rename: src/x86/set_caching_policy-x86.c -> src/x86/Gset_caching_policy-x86.c
}(Logical change 1.158)
2004-01-22 08:36:15 +00:00
hp.com!davidm
5dadd87801 Rename: src/x86/set_caching_policy-x86.c -> src/x86/Gset_caching_policy-x86.c
(Logical change 1.158)
2004-01-22 08:36:15 +00:00
hp.com!davidm
e384bfac74 Rename: src/x86/get_accessors-x86.c -> src/x86/Gget_accessors-x86.c
}(Logical change 1.158)
2004-01-22 08:36:15 +00:00
hp.com!davidm
28eadb2d17 Rename: src/x86/get_accessors-x86.c -> src/x86/Gget_accessors-x86.c
(Logical change 1.158)
2004-01-22 08:36:15 +00:00
hp.com!davidm
8358a9d89c Regenerate.
(Logical change 1.158)
2004-01-22 08:36:15 +00:00
hp.com!davidm
6975b2dcd9 Initial revision 2004-01-22 08:36:15 +00:00