Commit Graph

268 Commits

Author SHA1 Message Date
Nick Kledzik 0fef333dee Properly sign extend delta in compact unwind info
llvm-svn: 207170
2014-04-25 01:39:06 +00:00
Nick Kledzik f00751bfa1 Fix one missed use of DW_EH_PE_omit in r203626
llvm-svn: 207169
2014-04-25 01:35:29 +00:00
Nick Kledzik 49fdc41b21 Remove unused/obsolete ARM64 constants
llvm-svn: 207064
2014-04-24 02:33:46 +00:00
Dan Albert 5f60710f2b Fix virtual class with non-virtual dtor complaint
Fixes compiler complaint about:
src/Unwind/UnwindCursor.hpp:366:25: error: 'libunwind::AbstractUnwindCursor' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor]

llvm-svn: 206942
2014-04-23 04:46:46 +00:00
Dan Albert 0056c8eb01 Fixes incorrect #ifs for SJ/LJ exceptions
The was working because, given __APPLE__, _LIBUNWIND_BUILD_SJLJ_APIS was set to
__arm__, but other ARM targets not using SJ/LJ will fail to compile.

llvm-svn: 206941
2014-04-23 04:45:42 +00:00
Dan Albert c579b935c3 Fixes type of dyldInfo for glibc/bionic systems
Darwin and the BSDs define a tagged struct dl_info typedef'd as Dl_info. glibc
and bionic typedef an anonymous struct as Dl_info.

llvm-svn: 206939
2014-04-23 04:20:57 +00:00
Jonathan Roelofs 9fc137bd1d Replace bzero with memset
... so that we can use newlib as the c library.

llvm-svn: 206427
2014-04-16 23:26:55 +00:00
Nick Kledzik 0f64d66304 Properly sign extend sdata2/4 in unwinder. Patch by Patrick Wildt
llvm-svn: 206122
2014-04-12 23:22:52 +00:00
Nick Kledzik 74ebf58742 Properly conditionalize DwarfFDECache<A>::dyldUnloadHook. Patch by Patrick Wildt
llvm-svn: 206121
2014-04-12 22:11:11 +00:00
Logan Chien aacc1c76f9 Code cleanup and re-indent cxa_exception.hpp
llvm-svn: 206108
2014-04-12 11:56:41 +00:00
Joerg Sonnenberger 7955feb82f The content of .eh_frame may be misaligned, so use memcpy. This is seen
in the wild on SH3.

llvm-svn: 205756
2014-04-08 11:43:49 +00:00
Joerg Sonnenberger fd0d20fae7 Include stdlib.h for getenv when !NDEBUG.
llvm-svn: 205573
2014-04-03 22:00:08 +00:00
Joerg Sonnenberger dfd7c9f324 Simplify.
llvm-svn: 204292
2014-03-20 01:28:28 +00:00
Joerg Sonnenberger 1ed1a3d994 Fix DW_CFA_GNU_args_size handling. The primary architecture using this
opcode is VAX. A function call pushes the number of arguments given onto
the stack and "ret" will pop it automatically. The FDE of the caller
contains the amount of stack space used for arguments (and possibly
extra padding), so unwinding has to compensate for this when "returning"
from a function. This is exactly the case when step() is done. The
existing handling in unw_set_reg no longer makes sense.

llvm-svn: 204290
2014-03-20 01:23:55 +00:00
Joerg Sonnenberger 59155e79cc 0 is a valid LSDA encoding and can be seen in statically linked
programs. Initialize lsdaEncoding to DW_EH_PE_omit and check for that
value to decide whether a value should be decoded.

llvm-svn: 203626
2014-03-11 23:43:43 +00:00
Anders Carlsson 3e107b3bd8 Demangle Dc to decltype(auto) as per the Itanium C++ ABI spec.
llvm-svn: 201533
2014-02-17 21:56:01 +00:00
Jonathan Roelofs c5f7e6fe67 [libcxxabi] Fix broken codesourcery.com links in comments
review: http://llvm-reviews.chandlerc.com/D2718
llvm-svn: 201208
2014-02-12 04:49:09 +00:00
Marshall Clow d230a3d1f6 Fix PR17221 - can't catch virtual base classes when throwing derived NULL pointers. Specifically, libc++abi would crash when you tried it.
llvm-svn: 200904
2014-02-06 04:47:02 +00:00
Marshall Clow 176be6fed5 Fix PR17222 - catching derived classes from thrown null pointer. Adds tests, too
llvm-svn: 200864
2014-02-05 18:19:57 +00:00
Nick Kledzik 1ffee2af6e [libunwind] remove stray conditional
llvm-svn: 200432
2014-01-30 00:27:16 +00:00
Nick Kledzik 53c98b071e Use .p2align instead of .align
llvm-svn: 199941
2014-01-23 21:46:35 +00:00
Nick Kledzik b3500e6061 Add missing alignment directives in assembly
llvm-svn: 199915
2014-01-23 18:42:10 +00:00
Nick Kledzik a625495cb8 Don't redefine static_assert()
llvm-svn: 199860
2014-01-23 02:08:14 +00:00
Nick Kledzik fd0a6cf17a Fix unwinder to build for iOS
llvm-svn: 199859
2014-01-23 02:06:19 +00:00
Howard Hinnant 5a7b4ca21e Implement demangling for user-defined operators.
llvm-svn: 198643
2014-01-06 23:05:04 +00:00
NAKAMURA Takumi d40d387fb1 Update the copyright credits -- Happy new year 2014!
FIXME: Dragonegg may be updated at non-trivial changes.
llvm-svn: 198274
2014-01-01 08:27:31 +00:00
Nico Weber 1c9ff122b6 Add a first cut at a Registers_arm class, to be used for 32bit arm EHABI unwinding.
llvm-svn: 197591
2013-12-18 17:53:55 +00:00
Nico Weber 5f513f9b4a Add mangling macros for Unwind's inline assembly.
This is in preparation for landing an implementation of unw_getcontext
on a system where it's mangled 'unw_getcontext', not '_unw_getcontext'.

llvm-svn: 197523
2013-12-17 21:07:53 +00:00
Howard Hinnant 14fe17f302 Fix demangling crasher. The crasher involved nested <encoding> involving parameter packs, which exposed a logic bug causing an empty vector<string> to be accessed with back(). In addition to fixing the bug, I've inserted numerous preemptive checks for similar bugs in the hopes that if another bug is uncovered, the bug results in an invalid mangled string instead of a demangler crash. Test suite updated with string that was causing the crash.
llvm-svn: 197063
2013-12-11 19:44:25 +00:00
Nico Weber 6b04d06ed3 Rename UnwindRegisters*.s files to UnwindRegisters*.S, step 2 of 2
These files require preprocessing, so their name should end with a capital S.

llvm-svn: 196555
2013-12-06 00:37:21 +00:00
Nico Weber c6a7b1bc92 Rename UnwindRegisters*.s files to UnwindRegisters*.S, step 1 of 2
These files require preprocessing, so their name should end with a capital S.

llvm-svn: 196554
2013-12-06 00:35:35 +00:00
Nico Weber c833ec0fca Fix minor initialization bug in Registers_x86_64.
According to kledzik, this constructor isn't live code, so no functionality
change.

llvm-svn: 196550
2013-12-06 00:11:01 +00:00
Nico Weber 6ceed44db4 80-column wrap a comment in a test
llvm-svn: 196540
2013-12-05 21:54:49 +00:00
Nick Kledzik 87d4a00e9e [unwind] remove darwin build dependency on <mach-o/dyld_priv.h>
llvm-svn: 196436
2013-12-05 00:12:03 +00:00
Marshall Clow 350bda6eb2 Fixed a couple of test errors; changed 'const A const *' to 'const A* const'. Thanks to Nico for the catch
llvm-svn: 196355
2013-12-04 05:39:55 +00:00
Mark Seaborn 664711188f Fix indentation of fields in __cxa_exception to line up
Align to 8 spaces instead of an inconsistent 9.

llvm-svn: 195974
2013-11-30 17:37:21 +00:00
Yaron Keren 7c6bb6500e On Windows, typeids are different between DLLs and EXEs, so comparing
type_info* will work for typeids from the same compiled file but fail
for typeids from a DLL and an executable. Among other things, exceptions
are not caught by handlers since can_catch() returns false.

Defining _LIBCXX_DYNAMIC_FALLBACK does not help since can_catch() calls
is_equal() with use_strcmp=false so the string names are not compared.

This patch compares typeids first (cheap) and only they are different
calls strcmp.

llvm-svn: 195502
2013-11-22 21:43:23 +00:00
Yaron Keren dde62a377c Comment correction. syslog() syntax is:
void syslog(int facility_priority, const char* format, ...);

This is indeed how it is used in private_typeinfo.cpp.

llvm-svn: 195452
2013-11-22 12:11:40 +00:00
Howard Hinnant 66da53e0da If libc++ has not declared bad_array_length, then declare it here just so that it gets into the binary.
llvm-svn: 194208
2013-11-07 17:16:37 +00:00
Nick Kledzik 2c88a9bfb0 Swap contents of UnwindRegistersRestore.s and UnwindRegistersSave.s
llvm-svn: 193840
2013-11-01 00:37:20 +00:00
Nick Kledzik fbea189748 Rename LIBUNWIND_AVAIL to LIBUNWIND_UNAVAIL so as to not conflict with other (different) LIBUNWIND_AVAIL define
llvm-svn: 193839
2013-11-01 00:32:26 +00:00
Howard Hinnant 517cb27c43 Move local Db type out to namespace scope.
llvm-svn: 193169
2013-10-22 16:45:48 +00:00
Saleem Abdulrasool 55410fff8e unwinder: conditionalise availability
__attribute__ (( unavailable )) is for Apple specific builds.  Create a macro
to conditionalise the usage of the macro.  This is to aid in porting the
unwinder to other platforms.

llvm-svn: 192868
2013-10-17 03:57:41 +00:00
Nick Kledzik 95a975bc60 [unwind] Fix unw_init_remote_thread() use to void* instead of thread_t for parameter to match other implementations
llvm-svn: 192248
2013-10-08 22:59:34 +00:00
Nick Kledzik 4d95aae2f7 [unwind] add required #include
llvm-svn: 192245
2013-10-08 22:51:34 +00:00
Nick Kledzik f6330ddc0d Fix conditionals on __Unwind_SjLj_* functions to only build for SJLJ based architectures
llvm-svn: 192241
2013-10-08 21:57:22 +00:00
Joerg Sonnenberger 31057d618e Consistent spelling of names.
llvm-svn: 192180
2013-10-08 12:35:07 +00:00
Nick Kledzik 312fcd0e1c libcxxabi contains the runtime support for C++. But, as some folks have
realized, it is not complete.  It relies on some _Unwind_* functions to be
supplied by the OS. That means it cannot be ported to platforms that don’t 
already have an unwinder.  

Years ago Apple wrote its own unwinder for MacOSX and iOS.  To make libcxxabi 
complete, Apple has decided the source code for its unwinder can be contributed
to the open source LLVM libcxxabi project, with a dual licensed under LLVM 
and MIT license.

So, I’ve spent some time cleaning up the sources to make them conform with 
LLVM style and to conditionalize the sources in a way that should make it 
easier to port to other platforms.  The sources are in a separate "Unwind" 
directory under "src" in libcxxabi.  

Background:
Most architectures now use "zero cost" exceptions for C++.  The zero cost means
there are no extra instructions executed if no exceptions are thrown.  But if 
an exception is thrown, the runtime must consult side tables and figure out how
to restore registers and "unwind" from the current stack frame to the catch 
clause.  That ability to modify the stack frames and cause the thread to resume 
in a catch clause with all registers restored properly is the main purpose 
of the unwinder.

This unwinder has two levels of API.  The high level APIs are the _Unwind_* 
functions which the cxa_* exception functions in libcxxabi require.  The low 
level APIs are the unw_* functions which are an interface defined by the the 
old HP libunwind project (which shares no code with this unwinder).

llvm-svn: 192136
2013-10-07 21:39:41 +00:00
Marshall Clow 46c9950f48 Adding bad_array_length to libc++abi
llvm-svn: 190479
2013-09-11 01:42:02 +00:00
Marshall Clow 9735f1a06b Add ability to set OPTIONS for compile
llvm-svn: 190371
2013-09-09 23:53:08 +00:00