Renato Golin
128485ba47
ARM Unwind syntax
...
This patch fixes the bad argument that GAS accepted but the IAS didn't,
ie. {#0x20}, moving it to {0x20} which both accept. It also makes the
ARMv7+ save/restore correct by using VFP instructions rather than old
co-processor ones.
Fixes PR20529.
llvm-svn: 217585
2014-09-11 12:57:02 +00:00
Jonathan Roelofs
7decae153b
Implement post-review comments for r216730
...
Feedback was 'this could use better comments'.
llvm-svn: 217459
2014-09-09 20:20:52 +00:00
Alexander Potapenko
ed92fb9322
Remove an unused typedef from __class_type_info::search_below_dst
...
to fix the -Wunused-local-typedef warning.
llvm-svn: 217367
2014-09-08 13:56:36 +00:00
Renato Golin
88d5d9c2da
Use correct __ARM_ARCH macro
...
llvm-svn: 217341
2014-09-07 18:39:44 +00:00
Jonathan Roelofs
3b7f085db1
s/LIBCXXABI_SINGLE_THREADED/LIBCXXABI_HAS_NO_THREADS/ for consistency with libcxx
...
Also remove the audotedection part so that if you're crazy enough to want a
single-threaded abi library, you'll say so explicitly in the build.
llvm-svn: 217262
2014-09-05 17:46:40 +00:00
Jonathan Roelofs
10e25f4a0c
Allow LIBCXXABI_SINGLE_THREADED to be defined by build scripts
...
llvm-svn: 216952
2014-09-02 21:23:49 +00:00
Dan Albert
e5f15210fb
Add missing include to a test case.
...
Some platforms get size_t defined transitively by another include, but
Android does not.
llvm-svn: 216738
2014-08-29 16:09:32 +00:00
Dan Albert
2c012d495d
Make _Unwind_Backtrace() work on ARM.
...
Summary: Since the personality functions do the actual unwinding on ARM,
and will also stop unwinding when they encounter a handler, we invoke
_Unwind_VRS_Interpret() directly form _Unwind_Backtrace().
To simplify, the logic for decoding an EHT is moved out of
unwindOneFrame() and into its own function, decode_eht_entry(). Unlike
unwindOneFrame(), which could only handle ARM's compact personality
function entries (section 6.3) decode_eht_entry() can handle the generic
entries (section 6.2).
Reviewers: jroelofs
Reviewed By: jroelofs
Subscribers: piman, aemerson, cfe-commits
Differential Revision: http://reviews.llvm.org/D5112
llvm-svn: 216730
2014-08-29 15:26:06 +00:00
Dan Albert
6bd6b1c177
Remove strict dependency on llvm-config.
...
Depending on llvm-config allows for a few nice things (auto-detecting
LLVM source tree, version numbers, etc), but it's makes bootstrapping a
pain. Keep the llvm-config features around, but also fall back to being
able to configure based on -DLLVM_PATH=path/to/llvm.
Reviewers: jroelofs, loladiro
Reviewed By: loladiro
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5016
llvm-svn: 216482
2014-08-26 20:50:07 +00:00
Jonathan Roelofs
f0a3281c5f
Add baremetal ARM support to libcxxabi/libunwind
...
http://reviews.llvm.org/D4993
llvm-svn: 216202
2014-08-21 18:42:36 +00:00
Dan Albert
07a78740ae
Improve logging of aborts for Android.
...
In Android, stderr only goes to the console, and as such will only ever
be seen by adb shell users. Since very few developers will ever actually
see that, also send the abort message to logcat and the tombstone.
llvm-svn: 215983
2014-08-19 16:30:07 +00:00
Jonathan Roelofs
79b57011da
libcxxabi must link to dl if using bundled unwind
...
Patch by Ismail Donmez
http://reviews.llvm.org/D4953
llvm-svn: 215950
2014-08-18 23:43:43 +00:00
Hans Wennborg
d57db6e877
Fix the CMake build on Mac when setting MACOSX_DEPLOYMENT_TARGET=10.6
...
The build file was trying to use LIBCXXABI_VERSION, which isn't set
anywhere.
llvm-svn: 215465
2014-08-12 18:18:07 +00:00
Jonathan Roelofs
9245e6be86
Update CREDITS.txt with the list of folks who worked on ARM EHABI support
...
llvm-svn: 214877
2014-08-05 15:56:07 +00:00
Jonathan Roelofs
2745d4f0a1
Fix a copy-pasta in r214573
...
llvm-svn: 214873
2014-08-05 15:31:16 +00:00
Jonathan Roelofs
d9dbecd74d
[unwinder] Tell the assembler that functions are functions so that the linker knows how to link them.
...
This fixes an interworking problem when the unwinder/libcxxabi is built for
Thumb. When unw_getcontext is not marked as a function, 'bl' is used for the
branch instead of 'bx'.
llvm-svn: 214573
2014-08-01 22:02:21 +00:00
Nico Weber
3c2b2ae7a7
libcxxabi cmake: Use HandleLLVMOptions.cmake, don't manually add -std=c++11.
...
No intended behavior change on Linux and Mac OS X. On Windows, having libcxxabi
in one's checkout should now no longer break running cmake. (cl.exe supports
c++11, but doesn't understand a -std= flag.)
llvm-svn: 213214
2014-07-16 23:53:37 +00:00
Dan Albert
d321747153
Fix for libc++abi when using -Wl,--as-needed.
...
The cmake files for libc++abi and the unwinder weren't linking against
libpthread or an unwind library. If the tests were linked with
-Wl,--as-needed, these libraries wouldn't be linked, causing them to
fail.
Patch contributed by İsmail Dönmez.
llvm-svn: 212958
2014-07-14 17:00:29 +00:00
Dan Albert
923121e85b
Support LLVM_LIBDIR_SUFFIX.
...
This is useful for distros installing under /usr/lib64.
Patch from İsmail Dönmez.
llvm-svn: 212826
2014-07-11 15:52:58 +00:00
Dan Albert
7c06819ecd
Add support for building and testing the unwinder.
...
Note: The unwinder currently only works on Darwin and on ARM Linux.
Non-ARM Linux support is not yet implemented, and will fail to build.
llvm-svn: 212824
2014-07-11 15:36:02 +00:00
Dan Albert
3c4780e8c3
Make cmake cxxflags match those in lib/buildit.
...
llvm-svn: 212768
2014-07-10 22:23:03 +00:00
Dan Albert
a770f9d66b
Add lit configs for libcxxabi tests.
...
This makes running libcxxabi tests on Linux _much_ easier.
Adds a check-libcxxabi target to cmake.
Also defaults to building a dynamic libc++abi. This is so that the
default options still test the libc++abi that is being built. There are
two problems with testing a static libc++abi. In the case of a
standalone build, the tests will link the system's libc++, which might
not have been built against our libc++abi. In the case of an in tree
build, libc++ will prefer a dynamic libc++abi from the system over a
static libc++abi from the output directory.
llvm-svn: 212672
2014-07-10 02:20:11 +00:00
Dan Albert
0ed2e2f6ec
Add a cmake build system.
...
Will add support for tests with lit in a later patch.
This does not yet support building the unwinder in src/Unwind.
llvm-svn: 212286
2014-07-03 19:35:48 +00:00
Dan Albert
c67aa5403c
Fix a warning about undeclared call to abort().
...
llvm-svn: 212232
2014-07-02 22:44:35 +00:00
Logan Chien
93a68fb0c7
Revert the LSDA change to scan_eh_tab.
...
This commit reverts the LSDA-related change in r211745.
The r211745 adds a new argument to scan_eh_tab(), i.e. lsda.
However, IMO, calling _Unwind_GetLanguageSpecificData() directly in
scan_eh_tab() was more intuitive and reduces several function call
to _Unwind_GetLanguageSpecificData() in __cxx_personality_v0().
llvm-svn: 212037
2014-06-30 12:35:29 +00:00
Logan Chien
05d761cf24
Silence the implicit signed/unsigned conversion warning.
...
llvm-svn: 211912
2014-06-27 17:17:44 +00:00
Logan Chien
92a4d51fa6
Silence unused variable and parameter warnings.
...
llvm-svn: 211790
2014-06-26 16:58:38 +00:00
Logan Chien
37be06a0c6
Fix linux build.
...
* Replace strlcpy with snprintf since strlcpy is not available
in glibc.
* Replace __LINUX__ with __linux__.
llvm-svn: 211784
2014-06-26 13:56:23 +00:00
Logan Chien
6d3dae07ca
Add missing header for _LIBUNWIND_LOG().
...
llvm-svn: 211775
2014-06-26 12:22:38 +00:00
Nick Kledzik
0f0cd46201
Fix building for iOS
...
llvm-svn: 211751
2014-06-26 00:25:33 +00:00
Nico Weber
49f09fd88a
Minor libc++abi changes to make things build better with gcc.
...
llvm-svn: 211748
2014-06-25 23:55:37 +00:00
Nico Weber
ae5438701e
Update libc++abi to use the ARM EHABI unwinder from its libunwind.
...
llvm-svn: 211745
2014-06-25 23:52:07 +00:00
Nico Weber
97080e0c5e
Land support for ARM EHABI unwinding for libunwind.
...
This was written by:
Albert Wong <ajwong@chromium.org>
Antoine Labour <piman@chromium.org>
Dana Jansen <danakj@chromium.org
Jonathan Roelofs <jonathan@codesourcery.com>
Nico Weber <thakis@chromium.org>
llvm-svn: 211743
2014-06-25 23:39:00 +00:00
Nico Weber
af5ca95730
Start landing support for ARM EHABI unwinding.
...
The new code will be behind a LIBCXXABI_ARM_EHABI define (so that platforms
that don't want it can continue using e.g. SJLJ). This commit mostly just
adds the LIBCXXABI_ARM_EHABI define.
llvm-svn: 211739
2014-06-25 22:49:13 +00:00
Marshall Clow
fa9fd4a09b
Add a FAQ section, with a question about why the std::exception class destructors live in libc++abi
...
llvm-svn: 210661
2014-06-11 16:54:09 +00:00
Jonathan Roelofs
72a15cda3f
Add test case for inherited exceptions
...
Test case written by Dana Jansens.
llvm-svn: 210129
2014-06-03 21:50:11 +00:00
Jonathan Roelofs
20f6f45c5b
Add EH test case checking that handlers in noexcept functions can still unwind
...
llvm-svn: 209944
2014-05-31 00:25:59 +00:00
Jonathan Roelofs
75fd1b5f51
Add EH test cases corresponding to C++ ABI # 15.3.3
...
llvm-svn: 209943
2014-05-31 00:24:58 +00:00
Nico Weber
897f23dda8
Let libc++abi compile with gcc.
...
There was a single problem in cxa_demangle.cpp, where gcc would complain
`error: changes meaning of 'String'` about the line `typedef String String;`.
According to 3.3.7p2, this diagnostic is allowed (but not required, so clang
does not have to report this).
As a fix, make string_pair a template and pass String as template parameter.
This fixes the error with gcc and also removes some repetition from the code.
No behavior change.
llvm-svn: 209909
2014-05-30 17:27:21 +00:00
Logan Chien
63488f0e4e
Fix typo in comment.
...
llvm-svn: 208795
2014-05-14 17:16:57 +00:00
Richard Smith
bd32a449e6
PR19091: Track whether we're demangling a function template specialization to
...
determine whether we get a mangling for a return type, rather than trying to
figure it out based on whether the mangled name ended with a '>'.
llvm-svn: 208611
2014-05-12 18:44:13 +00:00
Logan Chien
dc65ab4cef
Implement ARM EHABI exception handling.
...
This commit implements the ARM zero-cost exception handling
support for libc++abi.
llvm-svn: 208466
2014-05-10 00:42:10 +00:00
Logan Chien
cc24fc546b
Check exception specification with __cplusplus.
...
To allow the compilation with gcc, we can't use the
__has_feature(cxx_noexcept) to detect the default destructor
exception specification, which is noexcept(true) by default
in C++11. We should use __cplusplus >= 201103L instead.
llvm-svn: 208465
2014-05-10 00:40:54 +00:00
Jonathan Roelofs
6bfee10279
Fixes more incorrect #ifs for SJ/LJ exceptions
...
Replaces several `#if __arm__` with `#if __USING_SJLJ_EXCEPTIONS__`.
llvm-svn: 208352
2014-05-08 19:13:16 +00:00
Jonathan Roelofs
bce1e4d60e
Fix broken build from r208135
...
llvm-svn: 208350
2014-05-08 18:48:43 +00:00
Marshall Clow
1f6f59ac37
Make libc++abi use the implementation of __numstr from libc++. No functionality change, just removal of duplicated code.
...
llvm-svn: 208246
2014-05-07 20:17:41 +00:00
Jonathan Roelofs
40e9842854
On single threaded systems, turn mutexes into nops
...
http://reviews.llvm.org/D3386
llvm-svn: 208135
2014-05-06 21:30:56 +00:00
Joerg Sonnenberger
c72473d87b
Try harder to get the compiler to use float registers in different
...
places to increase the chance of messing up any preserved registers.
llvm-svn: 207938
2014-05-04 16:31:33 +00:00
Joerg Sonnenberger
e9a72d54c7
Don't use bash features.
...
llvm-svn: 207907
2014-05-03 12:09:55 +00:00
Nick Kledzik
326254f422
Add unwind test case that checks restoring of float registers (such as on AArch64)
...
llvm-svn: 207481
2014-04-29 01:08:23 +00:00
Nick Kledzik
d7339b48f7
Fix cast warning
...
llvm-svn: 207469
2014-04-28 23:49:49 +00:00
Nick Kledzik
0c790015df
Use return address register from CIE. Move DwarfInstructions::lastRestoreReg() to Register::lastDwarfRegNum().
...
llvm-svn: 207467
2014-04-28 23:43:21 +00:00
Nick Kledzik
4141a3bca8
No need to specialize DwarfInstructions::getCFA(). It is the same for all archs
...
llvm-svn: 207463
2014-04-28 23:12:37 +00:00
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
Jean-Daniel Dupas
8d362a999e
Change the two last remaining _LIBCPP_CANTTHROW to _NOEXCEPT
...
llvm-svn: 189603
2013-08-29 19:19:27 +00:00
Howard Hinnant
59a5a956f5
Propagate the removal of _LIBCPP_CANTTHROW (r189046) to libcxxabi. This fixes http://llvm.org/bugs/show_bug.cgi?id=16996 .
...
llvm-svn: 189194
2013-08-25 17:00:57 +00:00
Howard Hinnant
b162939c1a
tip-of-trunk clang has corrected some access checks for special members in a virtual inheritance hierarchy. Change a few private inheritances to protected. This change will not impact what the test was testing. This fixes http://llvm.org/bugs/show_bug.cgi?id=16753 .
...
llvm-svn: 187429
2013-07-30 19:00:45 +00:00
Howard Hinnant
04c4cffbe1
I had a buffer mismanagement bug in the demangler.
...
llvm-svn: 187255
2013-07-26 22:14:53 +00:00
Howard Hinnant
ef93bc1c8a
Updated CREDITS.TXT
...
llvm-svn: 185464
2013-07-02 19:01:59 +00:00
Howard Hinnant
60c16eb7f5
I'd no sooner made the last commit when Matthew Dempsky sent me another test case that led me to yet another closely related test case that the current design could not handle. I've now changed the way forward references are handled completely. It wasn't that much code to change. The demangler, when confronted with a forward reference to a template parameter, now parses things twice. During the second parse, all forward references are remembered from the first parse. Test suite updated with new case.
...
llvm-svn: 184672
2013-06-23 19:52:45 +00:00
Howard Hinnant
cde9e006d8
After a private conversation with Arthur O'Dwyer, and a good night's sleep, I believe this fix is a better fix than what I committed in r184656 yesterday. I've basically moved the checking for '`' from the start of the demangling process to the end of it. In the process I discovered that one of the test cases no longer demangled to the expected string. After further investigation I believe this case to not be a valid mangled string, and so I moved the test case to the 'invalid cases'. The reason I believe it is invalid is that it should use T_ instead of T0_ to index the template parameter.
...
llvm-svn: 184668
2013-06-23 17:14:35 +00:00
Howard Hinnant
ae10f9d45e
Filter out '`' in mangled strings and reject them as invalid if found.
...
llvm-svn: 184656
2013-06-23 03:36:38 +00:00
Howard Hinnant
72a54eab35
I created a random mangled name generator and have thrown about 200 million random strings at the demangler. I succeeded in crashing it twice more and those crashers have been fixed and the test suite updated with the crash cases.
...
llvm-svn: 184562
2013-06-21 17:04:24 +00:00
Howard Hinnant
8935442538
Another demangler crasher. Updated test suite to prevent regression.
...
llvm-svn: 184477
2013-06-20 21:49:34 +00:00
Howard Hinnant
763e591461
Protect against invalid mangled names. Add test suite for invalid mangled names.
...
llvm-svn: 184394
2013-06-20 01:55:07 +00:00
Howard Hinnant
b076753454
Demangle objc mangling implemented in r184250
...
llvm-svn: 184301
2013-06-19 13:43:18 +00:00
Howard Hinnant
80fe668394
Tweaks/cleanups provided by Matthew Dempsky
...
llvm-svn: 184118
2013-06-17 20:25:21 +00:00
Howard Hinnant
862c4a06ee
Demangler update: This now demangles many more (all?) C++11 symbols. Demangler tests updated.
...
llvm-svn: 184097
2013-06-17 18:10:34 +00:00
Howard Hinnant
f2ca35cd79
Add capability to demangle invocation functions for ObjC blocks.
...
llvm-svn: 179208
2013-04-10 19:44:03 +00:00
Howard Hinnant
be2eced483
Bruce Mitchener: Typo fixes.
...
llvm-svn: 175275
2013-02-15 15:48:49 +00:00
Howard Hinnant
2b853bf65f
Partially revert r152770. That commit moved the default handlers to their own file. But it also did some refactoring. It is the latter that is being reverted. The refactoring had accidentally removed the required effect that the default unexpected_handler calls std::terminate(), which is a visible effect.
...
llvm-svn: 174532
2013-02-06 19:29:55 +00:00
NAKAMURA Takumi
43632a26a5
Update the copyright coredits -- Happy new year 2013!
...
llvm-svn: 171342
2013-01-01 10:00:19 +00:00
Daniel Malea
f32048d26b
Rename class __lambda_node to ___lambda_node to fix compile failure with gcc 4.6 and 4.7
...
- using "__lambda_node" causes internal compiler error in newer GCC versions
llvm-svn: 169402
2012-12-05 18:55:49 +00:00
Howard Hinnant
c1c87c15f2
__list::ends_with_template was giving the wrong answer for empty lists. And __parse_unnamed_type_name wasn't properly handling the list of paramters and was not safe against incorrectly mangled lambdas (running past last).
...
llvm-svn: 169022
2012-11-30 18:43:50 +00:00
Howard Hinnant
7166bff4ff
Remove aborts under __dynamic_cast which were under _LIBCXX_DYNAMIC_FALLBACK. Change all type_info comparisons to use an inlined is_equal helper. However no change in functionality for this latter change at this time. This is just to encapsulate the comparison and make it a little easier to switch back and forth for testing/debugging.
...
llvm-svn: 168052
2012-11-15 18:00:42 +00:00
Howard Hinnant
fe4d464f52
Update CREDIT.TXT
...
llvm-svn: 167847
2012-11-13 15:57:18 +00:00
Howard Hinnant
70abebed37
Wen-Han Gu: Fix for http://llvm.org/bugs/show_bug.cgi?id=14312 Exception Table out-of-range but still keep walking.
...
llvm-svn: 167733
2012-11-12 18:19:15 +00:00
Howard Hinnant
c33e98ca05
Make the type_info for __shim_type_info visible. This should address some failing dynamic_casts that a few applications are doing on the type_info hierarchy.
...
llvm-svn: 165883
2012-10-13 18:45:59 +00:00
Micah Villmow
fb89f27a8f
Move TargetData to DataLayout.
...
llvm-svn: 165397
2012-10-08 16:29:26 +00:00
Howard Hinnant
538fe8f35b
Set up code under _LIBCXX_DYNAMIC_FALLBACK which is off by default. For a full description of _LIBCXX_DYNAMIC_FALLBACK, see src/private_typeinfo.cpp.
...
llvm-svn: 164863
2012-09-28 22:43:50 +00:00
Howard Hinnant
785a8721d2
Improve the diagnostic messages on dynamic_cast.
...
llvm-svn: 164833
2012-09-28 17:58:48 +00:00
Howard Hinnant
2d0352cbf8
Two changes: 1) I still didn't have the ABI correct to match the gcc-4.2 std::string under the exception classes. I think the changes to stdexcept.cpp have got that down now. 2) On Apple platforms I'm seeing visibility bugs in applications with respect to type_info's being hidden. This is causing dynamic_cast to malfunction because there are multiple type_info's running around for one type within an application, making dynamic_cast believe that one type is actually multiple types. As a stop gap measure I'm trying to detect this error, print out an error message, but continue with the most likely desired result. This is all under __APPLE__. This behavior can be expanded to other platforms if desired.
...
llvm-svn: 164809
2012-09-28 00:05:34 +00:00
Marshall Clow
8493cad160
Updating email address
...
llvm-svn: 164490
2012-09-24 14:27:24 +00:00
Howard Hinnant
128ec49e29
Rename class __lambda to __lambda_node to avoid clash with gcc. This fixes http://llvm.org/bugs/show_bug.cgi?id=13889
...
llvm-svn: 164405
2012-09-21 19:21:37 +00:00
Howard Hinnant
ed3d690f68
Tweak use of dlopen to be a little more correct and higher performing.
...
llvm-svn: 164404
2012-09-21 19:12:56 +00:00
Howard Hinnant
e115af2777
I've added Apple-only behavior that looks for libstdc++ in the same process and if found, checks the string stored in <stdexcept> exception objects to see if it is the gcc empty string singleton before manipulating the reference count. This is done so that if such an exception is created with a zero-length string in libstdc++, libc++abi won't try to delete the memory. This is part of a ongoing process to make libc++ exceptions ABI-compatible with libstdc++-4.2 exceptions, to the point that each library can catch exceptions thrown by the other. If other parties would also like this behavior, the #if __APPLE__ can be broadened.
...
llvm-svn: 164170
2012-09-18 21:34:12 +00:00
Howard Hinnant
6aa048efc9
Specifically disallow primary-expressions of the form LT_... on the basis of this decition: http://sourcerytools.com/pipermail/cxx-abi-dev/2011-August/002422.html . Failure to disallow this was causing infinite recursion in the demangler when these symbols show up due to mangling bugs. This patch causes the demangler to return an invalid mangled name result rather than crash in infinite recursion.
...
llvm-svn: 163859
2012-09-13 23:49:59 +00:00
Howard Hinnant
2c2b55f27f
Change size of reference count field in __libcpp_nmstr from 32 bits to 64 bits for 64 bit targets. This is controls the data layout of all exceptions defined in <stdexcept>. This aligns the ABI with that of gcc-4.2.
...
llvm-svn: 161496
2012-08-08 16:15:16 +00:00
Howard Hinnant
757640b156
Fixes apple: #12020687 . This was a problem in the demangler with template
...
substitution forward references. That is, sometimes a mangled name refers to
a substitution that hasn't yet been defined. The demangler was derferencing a
null pointer in this case because it wasn't properly guarded against a
forward reference. Test case added to catch this problem.
llvm-svn: 161267
2012-08-03 22:02:07 +00:00
Howard Hinnant
3a86b142a1
Update status.
...
llvm-svn: 161221
2012-08-02 22:06:41 +00:00
Howard Hinnant
fdfcfcf670
Update CREDITS.TXT
...
llvm-svn: 161129
2012-08-01 19:24:04 +00:00
Howard Hinnant
b2a9cee678
Erik Olofsson: This patch adds support for lambda demangling. I fixed this because it crashed lldb when it tried to demangle the added test.
...
Not sure how it should identify the lambda so that might need changing from the current 'lambdax':: Howard: Please patch CREDITS.TXT.
llvm-svn: 161125
2012-08-01 18:56:46 +00:00
Howard Hinnant
a8c5d770f9
Andrew Morrow: Mainline clang seems to have recently become more strict about the
...
consistent application of visibility attributes, which causes some new
breakage in libcxxabi:
In file included from src/libcxxabi/src/cxa_default_handlers.cpp:19:
src/libcxxabi/src/private_typeinfo.h:123:23: error: visibility does
not match previous declaration
class __attribute__ ((__visibility__(default))) __class_type_info
^
src/libcxxabi/src/private_typeinfo.h:19:13: note: previous attribute is here
#pragma GCC visibility push(hidden)
^
1 error generated.
The forward declaration of __class_type_info is picking up hidden
visibility from the #pragma, which conflicts with the default
visibility applied when the class is later fully declared. I'm
assuming that the full declaration has it right (and that the
diagnostic is correct), so the attached patch applies the default
visibility attribute to the forward declaration.
llvm-svn: 160933
2012-07-29 20:41:19 +00:00
Howard Hinnant
95d917f8ee
Andrew Morrow: The variable 't1' on line 10188 of cxa_demangle.cpp is uninitialized
...
which generates -Wsometimes-uninitialized. Howard: The only thing this patch is missing is an update to CREDITS.TXT.
llvm-svn: 160932
2012-07-29 16:14:52 +00:00
Sylvestre Ledru
0527b8f942
add a link to the libc++ website
...
llvm-svn: 160553
2012-07-20 17:21:42 +00:00
Richard Smith
4c50ea27bf
Add missing #include <stdlib.h> into test which uses ::exit.
...
llvm-svn: 160039
2012-07-11 09:37:56 +00:00
Howard Hinnant
7f53a5da57
Don't dereference root in __parse_ctor_dtor_name unless it is known to not be null.
...
llvm-svn: 158556
2012-06-15 21:57:51 +00:00
Howard Hinnant
ba2e8aeda5
Fix bug in cxa_demangle involving template substitution.
...
llvm-svn: 155994
2012-05-02 15:38:11 +00:00
Howard Hinnant
9de0b35648
Make __cxa_new_handler un-mangled
...
llvm-svn: 155763
2012-04-28 16:46:04 +00:00
Howard Hinnant
2a9c509c7e
Changed 'cause' from 'terminate' to 'uncaught' in default_terminate_handler
...
llvm-svn: 155452
2012-04-24 17:41:51 +00:00
Howard Hinnant
b54f86aa9d
Richard Smith: __int128 is a GNU keyword which clang 3.1 supports. This usage of it as an identifier will need to be renamed.
...
llvm-svn: 155044
2012-04-18 20:55:06 +00:00
Howard Hinnant
e59dbd7b82
I would really like to write the handlers in terms of C++11 atomics. This would give us the best performance, portablity, and safety tradeoff. Unfortunately I can not yet do that. So I've put the desired code in comments, and reverted the handler getters to the slower but safer legacy atomic intrinsics.
...
llvm-svn: 153041
2012-03-19 16:56:51 +00:00
Howard Hinnant
4ac72dd982
I've moved __cxa_terminate_handler, __cxa_unexpected_handler and __cxa_new_handler from the public header cxxabi.h into the private header cxa_handlers.hpp. During this move I've also moved them from namespace __cxxabiapple into the global namespace. They are, and have always been extern C and so the namespace (or lack of it) does not affect their ABI. In general external clients should not reference these symbols. They are atomic variables and will be changing into C++11 atomic variables in the future. However for those few clients who really need access to them, their name, mangling, size, alignment and layout will remain stable. You just may need your own declaration of them. Include guards have been added to the private header cxa_exception.hpp. The private header cxa_default_handlers.hpp has been removed and the default handlers are now file-static. Include guards have been added to the private header cxa_handlers.hpp.
...
llvm-svn: 153039
2012-03-19 16:20:34 +00:00
Howard Hinnant
0f73197364
Arm fixes in cxa_personality.cpp and a little refactoring.
...
llvm-svn: 152966
2012-03-17 00:10:52 +00:00
Dave Zarzycki
d6533ccd48
Less lame "concurrency" support
...
These APIs aren't thread safe, but they're pretending to be. Let's at
least make the getter as fast as they can be. The setters are a lost
cause unless the API can be fixed.
llvm-svn: 152786
2012-03-15 08:58:08 +00:00
Dave Zarzycki
13e35c086c
Be friendly to when dead_strip doesn't work
...
Apple Radar: 11053417
llvm-svn: 152785
2012-03-15 08:58:06 +00:00
Nick Kledzik
778324abe4
move default handlers to their own file so they can be overridden at build time (dyld)
...
llvm-svn: 152770
2012-03-15 01:52:12 +00:00
Howard Hinnant
ffa26667d9
Missed an underscore on the last commit.
...
llvm-svn: 152736
2012-03-14 19:39:50 +00:00
Howard Hinnant
baae2be624
Enable __arm__ on apple
...
llvm-svn: 152735
2012-03-14 19:30:00 +00:00
Nick Kledzik
37cb6555f0
fix crash log magic
...
llvm-svn: 152693
2012-03-14 01:16:14 +00:00
Howard Hinnant
3bfc622bdb
Enable / silence -Wunused-parameter.
...
llvm-svn: 152415
2012-03-09 18:01:37 +00:00
Howard Hinnant
e6de8df54e
Enable -Wstrict-aliasing=2 -Wstrict-overflow=4.
...
llvm-svn: 152338
2012-03-08 20:55:13 +00:00
Howard Hinnant
8292678017
Enable/silence -Wsign-compare.
...
llvm-svn: 152336
2012-03-08 20:51:01 +00:00
Howard Hinnant
71c4857a07
Enable/silence -Wsign-compare.
...
llvm-svn: 152335
2012-03-08 20:50:28 +00:00
Howard Hinnant
37c247c13c
Enable/silence -Wmissing-field-initializers.
...
llvm-svn: 152334
2012-03-08 20:32:50 +00:00
Howard Hinnant
7cafb87441
Enable/silence -Wunused-variable.
...
llvm-svn: 152329
2012-03-08 20:23:24 +00:00
Howard Hinnant
d121eb2c24
Enable/silence -Wconversion.
...
llvm-svn: 152328
2012-03-08 20:16:45 +00:00
Howard Hinnant
11dd38dab0
Enable/silence -Wshadow.
...
llvm-svn: 152325
2012-03-08 19:34:58 +00:00
Howard Hinnant
41bcf33c63
Enable/silence -Wsign-conversion.
...
llvm-svn: 152323
2012-03-08 18:45:24 +00:00
Howard Hinnant
20d6c14c88
First attempt at arm support.
...
llvm-svn: 151765
2012-02-29 22:14:19 +00:00
Howard Hinnant
fdad25a40a
Insert a couple of dummy virtual functions to ease low level binary compatibility with other low level tools.
...
llvm-svn: 151282
2012-02-23 21:09:29 +00:00
Howard Hinnant
2d809ac734
And the handlers should be extern C.
...
llvm-svn: 151261
2012-02-23 17:25:34 +00:00
Howard Hinnant
49f28b5a47
I had originally made the handler function pointers a static internal detail, not accessible to the outside world. I did this because they must be accessed in a thread-safe manner, and the library provides thread-safe getters and setters for these. However I am at least temporarily making them public and giving them the Apple-extension names. In the future these may disappear again, and I think that would probably be a good idea.
...
llvm-svn: 151256
2012-02-23 15:32:07 +00:00
Dave Zarzycki
3cd25390e5
Pedantic fix: missing newline at EOF
...
llvm-svn: 151132
2012-02-22 05:25:00 +00:00
Howard Hinnant
3e7d155768
Move typeinfos for exceptions in <stdexcept> to the abi
...
llvm-svn: 150834
2012-02-17 19:23:47 +00:00
Howard Hinnant
995fcc0d49
Add (reluctantly) a namespace alias for __cxxabiv1.
...
llvm-svn: 150828
2012-02-17 18:45:44 +00:00
Howard Hinnant
d901bb4de4
Remove outdated information from comment.
...
llvm-svn: 150827
2012-02-17 18:45:04 +00:00
Howard Hinnant
71cf5ab0d3
__gxx_personality_v0 and __cxa_call_unexpected are complete on darwin and I *think* linux (not positive), but still unimplemented on arm.
...
llvm-svn: 149711
2012-02-03 20:53:52 +00:00
Howard Hinnant
92afda06d7
Pushed optimization back up. Crash disappeared with compiler upgrade. Assumed to be due to compiler bug.
...
llvm-svn: 149702
2012-02-03 18:36:36 +00:00
Howard Hinnant
31dea02601
corrected namespace in test
...
llvm-svn: 149635
2012-02-02 22:00:52 +00:00
Howard Hinnant
eaa65afc7b
Work on restricting symbol visibility.
...
llvm-svn: 149633
2012-02-02 20:47:28 +00:00
Howard Hinnant
90ef25c05e
Add version number to this library so we can recognize when we're using it.
...
llvm-svn: 149632
2012-02-02 20:47:05 +00:00
Howard Hinnant
67e5863cd9
There's a crasher I need to track down, occurring at -O0.
...
llvm-svn: 149631
2012-02-02 20:42:31 +00:00
Marshall Clow
a27b0cd8ee
added const nullptr tests
...
llvm-svn: 149552
2012-02-01 22:27:24 +00:00
Marshall Clow
e71ddf2fcb
removed duplicated tests - Howard was quicker than me.
...
llvm-svn: 149545
2012-02-01 21:49:28 +00:00
Marshall Clow
62e0f4abf6
Added tests for catching const/non-const nullptr
...
llvm-svn: 149542
2012-02-01 21:37:24 +00:00
Howard Hinnant
60eaa49036
Add test for pointer qualification conversion.
...
llvm-svn: 149541
2012-02-01 21:25:40 +00:00
Howard Hinnant
30025116de
Changed a TODO to a 'maybe some time in the future'.
...
llvm-svn: 149539
2012-02-01 21:12:07 +00:00
Howard Hinnant
8030b7f751
Removed DEBUG statements.
...
llvm-svn: 149538
2012-02-01 21:08:30 +00:00
Howard Hinnant
089123e65f
Remove a TODO regarding where some can_catch are implemented. I opted to make can_catch pure virtual in the top __shim_type_info, and have each sub-class implement its own. There are some repeated definitions, but they are trivial.
...
llvm-svn: 149537
2012-02-01 21:06:46 +00:00
Howard Hinnant
c325fa7705
Add some tests to test catching nullptr with pointers and member pointers. Tests are only activated if #if __has_feature(cxx_nullptr).
...
llvm-svn: 149536
2012-02-01 21:01:52 +00:00
Howard Hinnant
2d6810fbd6
Quash a TODO related to catching pointer-to-member. These tests fail on my copy of gcc-4.2. But I believe the tests to be correct (and they pass for libc++abi). I've enquired on the C++ standards mailing list for a clarification in case I'm wrong. So far I've gotten one response that agrees with me.
...
llvm-svn: 149534
2012-02-01 20:53:21 +00:00
Howard Hinnant
a21f8c2acf
Quash TODO regarding catch by function type. Add tests to back it up.
...
llvm-svn: 149530
2012-02-01 19:42:45 +00:00
Howard Hinnant
26ffb64177
Quash TODO regarding catch by array type. Add tests to back it up.
...
llvm-svn: 149527
2012-02-01 19:21:28 +00:00
Howard Hinnant
69a10f466b
Removing a TODO: can_catch is fundamentally different than search_above_dst. can_catch is looking for an unamiguous public base class of a specific type, but at any address. search_above_dst is looking for an unambiguous public base class of a specific type, *and* at a specific address. Additionally can_catch is run for all types. search_above_dst is only run on class types. So these are only superficially similar. Not similar enough for resuse, at least without making the code unreadable.
...
llvm-svn: 149522
2012-02-01 18:52:35 +00:00
Howard Hinnant
d0bfbb336f
Teach exception_cleanup_func about dependent exceptions.
...
llvm-svn: 149520
2012-02-01 18:44:21 +00:00
Howard Hinnant
8aa78517ab
Treat all exceptions except that the ones that this library throws as foreign. Even other C++ exceptions.
...
llvm-svn: 149518
2012-02-01 18:15:15 +00:00
Howard Hinnant
62efe0b062
Nothing but polishing comments.
...
llvm-svn: 149515
2012-02-01 16:56:40 +00:00
Howard Hinnant
4ca103d14c
Move an error detector to a better place.
...
llvm-svn: 149513
2012-02-01 16:16:11 +00:00
Howard Hinnant
3b22c6c395
Here's a test for catching pointers.
...
llvm-svn: 149459
2012-02-01 00:22:38 +00:00
Howard Hinnant
372e2f4bd4
More test cases concentrating on catching class types.
...
llvm-svn: 149453
2012-01-31 23:52:20 +00:00
Howard Hinnant
eedecf51bb
Some unwinding test cases
...
llvm-svn: 149436
2012-01-31 21:58:58 +00:00
Howard Hinnant
310fcc749d
Back the optimization down from -O3 to -Os. I'm getting an unexplained crasher on -O3. I've looked for a libc++abi bug and can't find one. I'm suspecting clang optimizer bug. But I don't have a good test case at the moment. Deferring investigation on this for now as I will soon be developing more and smaller tests.
...
llvm-svn: 149414
2012-01-31 20:22:59 +00:00
Howard Hinnant
3d97931a86
Drop the stress a notch on dynamic_cast_stress.cpp. Otherwise it occasionally causes clang to crash. Put a noexcept(false) on a throwing destructor in test_vector1.cpp. The test now passes for both C++03 and C++11 modes. Add testit script. All tests are now PASSING :-)
...
llvm-svn: 149413
2012-01-31 20:10:33 +00:00
Howard Hinnant
f8d292eb08
Correct test bug.
...
llvm-svn: 149412
2012-01-31 20:01:06 +00:00
Howard Hinnant
fe2052d635
Have the default unexpected/terminate handler output *demangled* names for the type of exception instead of the mangled name.
...
llvm-svn: 149409
2012-01-31 19:48:06 +00:00
Howard Hinnant
43f5fecdb5
Fix type-o in the comment of the last commit
...
llvm-svn: 149403
2012-01-31 19:05:08 +00:00
Howard Hinnant
6351792447
Found and fixed a bug in __cxa_call_unexpected. If the unexpected_handler rethrows the same exception then needed information gets overwritten in the original exception header. Therefore save it locally before executing the unexpected_handler.
...
llvm-svn: 149400
2012-01-31 18:57:20 +00:00
Howard Hinnant
d96cac1282
Found and fixed bug in personality function: Don't dive into the action table if the action entry is zero.
...
llvm-svn: 149389
2012-01-31 17:15:14 +00:00
Howard Hinnant
d6d4c25ef0
Minor bug fix in __cxa_call_unexpected. Changed std::terminate to detect a caught-but-unhandled exception, and choose the handler out of that if found.
...
llvm-svn: 149329
2012-01-31 01:51:15 +00:00
Howard Hinnant
c9204f6bed
Refactored personality function. Found one bug in scanning exception spec lists.
...
llvm-svn: 149272
2012-01-30 20:16:21 +00:00
Howard Hinnant
2c50972c32
Removed debugging print statements
...
llvm-svn: 149271
2012-01-30 20:13:37 +00:00
Howard Hinnant
47cb854818
Add a descriptive name for a constant. Also I'm at least temporarily waging war on throw specs, both old and new style. Except where we have already publicly exposed the throw spec, I'm getting rid of them. They may come back later. But they seem somewhat prone to cyclic dependencies here. The throw spec implies compiler generated code that this library has to jump to during stack unwinding. I'd like to minimize the possiblity that the code used to properly make that jump is itself creating such jumps.
...
llvm-svn: 149251
2012-01-30 16:07:00 +00:00
Howard Hinnant
3f0d2384aa
Add -fstrict-aliasing -Wstrict-aliasing and change optimization from -Os to -O3
...
llvm-svn: 149250
2012-01-30 16:03:23 +00:00
Howard Hinnant
5bbc597f1e
Put throw() clauses back on these functions in cxxabi.h. This header must be C++03 compatible and these throw specs are consistent with the current cxxabi.h that Apple ships.
...
llvm-svn: 149249
2012-01-30 16:02:11 +00:00
Howard Hinnant
9aa4684fbb
Minor updates to a couple of comments.
...
llvm-svn: 149158
2012-01-28 00:34:46 +00:00
Howard Hinnant
ece71ead6d
Add a little paranoia for testing purposes.
...
llvm-svn: 149157
2012-01-28 00:32:31 +00:00
Howard Hinnant
805036cc83
Minor header fixups for test.
...
llvm-svn: 149156
2012-01-28 00:30:38 +00:00
Howard Hinnant
44e3703639
Silence a warning.
...
llvm-svn: 149155
2012-01-28 00:29:27 +00:00
Howard Hinnant
ad048719a7
Sometimes it takes all day to write a decent comment. This is one of those times, and I'm still not quite sure I have them correct.
...
llvm-svn: 149154
2012-01-28 00:28:31 +00:00
Howard Hinnant
113cf60e0b
These commits are intended to be temporary in nature and are to facilitate the testing of libc++abi.dylib at this point in time.
...
llvm-svn: 148967
2012-01-25 19:27:42 +00:00
Howard Hinnant
db97064263
Add comment documenting extension behavior of __cxa_get_globals_fast().
...
llvm-svn: 148966
2012-01-25 19:19:13 +00:00
Howard Hinnant
5d6b9d28f7
cxa_guard.cpp didn't quite make it on the last commit: Restricted headers to cxa_guard.cpp and abort_messsage.h, and added a comment regarding reentrancy brought up by John McCall. Thanks John.
...
llvm-svn: 148965
2012-01-25 19:02:40 +00:00
Howard Hinnant
2449538500
Restricted headers to cxa_guard.cpp and abort_messsage.h, and added a comment regarding reentrancy brought up by John McCall. Thanks John.
...
llvm-svn: 148963
2012-01-25 18:50:55 +00:00
Howard Hinnant
abc770690a
By changing all of the throw() specs to noexcept I've been able to compile and link all of the source files into a dylib. Prior to this substitution the changed functions were calling __cxa_call_unexpected which isn't implemented yet. However in none of these cases do we actaully want __cxa_call_unexpected to be called. Primative buildit script added.
...
llvm-svn: 148880
2012-01-24 23:42:30 +00:00
Howard Hinnant
7fdfd5d269
Add some needed symbols in exception.cpp and eliminate dependence upon uncaught_exception() from cxa_vector.cpp. libc++abi is very nearly a self-contained (though not complete) library now.
...
llvm-svn: 148866
2012-01-24 21:48:10 +00:00
Howard Hinnant
73ab1864ef
Marshall Clow reminded me that fallback_malloc.cpp was broken out for testing purposes. We've agreed to simply rename fallback_malloc.cpp to fallback_malloc.ipp. Thanks Marshall.
...
llvm-svn: 148863
2012-01-24 21:41:27 +00:00
Howard Hinnant
421bbe5cc5
Add some needed symbols to cxa_new_delete.cpp and put the display() stuff under #DEBUG (again).
...
llvm-svn: 148860
2012-01-24 21:35:18 +00:00
Howard Hinnant
378a59f15c
Got fooled by fallback_malloc.cpp source file: it is really a private header. I've manually included it into the only place it is used: cxa_exception.cpp.
...
llvm-svn: 148854
2012-01-24 21:02:21 +00:00
Howard Hinnant
8b26c3713b
Add new file for public type_info-related signatures
...
llvm-svn: 148853
2012-01-24 21:01:01 +00:00
Howard Hinnant
0d517a4278
CrashReporterClient.h is back, but this time protected with __has_include. Thanks for the suggestion Doug. The use is consistent with how the same header is used in llvm/lib/Support/PrettyStackTrace.cpp (though there autoconfig is used instead of __has_include).
...
llvm-svn: 148851
2012-01-24 19:58:25 +00:00
Howard Hinnant
a9d8ec45f6
Remove dependence upon std::exception_ptr from the default_terminate_handler. Recovered the equivalent functionality at a lower level.
...
llvm-svn: 148830
2012-01-24 18:26:29 +00:00
Howard Hinnant
9e5d74b239
Forgot to include this file in the last commit: Move kOurExceptionClass and kOurDependentExceptionClass from source to header so that they can be used in multiple sources. This is a private header, these constants are not publicly exposed.
...
llvm-svn: 148829
2012-01-24 18:17:40 +00:00
Howard Hinnant
6830b2a493
Move kOurExceptionClass and kOurDependentExceptionClass from source to header so that they can be used in multiple sources. This is a private header, these constants are not publicly exposed.
...
llvm-svn: 148827
2012-01-24 18:15:20 +00:00
Howard Hinnant
82a39907f1
Removed reference to internal header
...
llvm-svn: 148763
2012-01-24 00:52:33 +00:00
Howard Hinnant
e33b2f5c97
Changed my mind about __cxa_uncaught_exception and added it.
...
llvm-svn: 148754
2012-01-24 00:01:31 +00:00
Howard Hinnant
bfbf700151
I renamed abort_message to be a C++ file to simplify my simplistic build script which I'm still working on. I also added a struct for the crash reporter on __APPLE__.
...
llvm-svn: 148752
2012-01-23 23:58:26 +00:00
Howard Hinnant
fad744dd50
A lot of the code in cxa_exception.cpp depends on __cxa_get_globals_fast() returning null if __cxa_get_globals() hasn't been called yet. However it doesn't reliably do that, at least on OS X if __cxa_get_globals_fast() is called prior to pthread_key_create() running. Our choice is to either limit our use of __cxa_get_globals_fast() more than we have, or to have __cxa_get_globals_fast() initialize with pthread_key_create() if necessary. I chose the latter, and replaced pthread_once with a C++11 local static (which should do the same thing).
...
llvm-svn: 148750
2012-01-23 23:55:58 +00:00
Howard Hinnant
671caae892
Added missing #include
...
llvm-svn: 148749
2012-01-23 23:51:56 +00:00
Howard Hinnant
53418916fc
I'm beginning to be able to throw/catch a wide variety of objects.
...
llvm-svn: 148713
2012-01-23 18:39:47 +00:00
Howard Hinnant
699692a04c
Getting started on matching a thrown exception to a catch clause, and setting the adjusted pointer to the caught object appearing in the catch clause.
...
llvm-svn: 148666
2012-01-22 21:47:40 +00:00
Howard Hinnant
afcf7ac5f6
I kept getting confused among the __cxa_exception*, the _Unwind_Exception* and the void* to the thrown object. So I've gone through these two files and attempted to institute a consistent variable naming scheme, and in a few instances, turned void* into a concrete* to have the type system help me out. No change in functionality for this commit is intended.
...
llvm-svn: 148663
2012-01-22 19:14:27 +00:00
Howard Hinnant
1a56ee3798
Add __shim_type_info which fits below std::type_info and above all of the other type_info-derived classes. This is where all of the virtual functions that serve as details of the inner-workings of type_info will live (safely hidden from public view). All type_info objects will be safely down-castable to __shim_type_info, so as to access implementation detail virtual functions. Also temporarily add some print/display statements to each type_info-derived class. This is in support of the continuing development on the personality function.
...
llvm-svn: 148647
2012-01-22 01:23:02 +00:00
Howard Hinnant
242566e552
Change header to generic, instead of implementation specific
...
llvm-svn: 148646
2012-01-22 01:19:20 +00:00
Howard Hinnant
b24c9441d1
One more small optimization: Where possible, for loops that do a search and then try to break out of the loop early, eliminate the attempt to break out of the loop after the last search. And with that, I'm declaring __dynamic_cast done. Though if anyone sees any problems, has suggestions for improvements, or wants to contribute some test cases, that is certainly welcome feedback.
...
llvm-svn: 148246
2012-01-16 18:21:05 +00:00
Howard Hinnant
44a2895a03
Comment smithing. Changed some casts from C-style to C++. And added timings to all of the tests.
...
llvm-svn: 148241
2012-01-16 17:06:51 +00:00
Howard Hinnant
77fb8ab9f2
I think this is getting close on __dynamic_cast. There's been quite a bit of code rearrangement, renaming, and better commenting. This exercise has exposed and fixed a few more bugs. I've also added several more tests (there's definitely a need for more tests here).
...
llvm-svn: 148227
2012-01-16 00:13:46 +00:00
Howard Hinnant
f55694af01
Two bug fixes, several clarifications, and a few comment updates.
...
llvm-svn: 148180
2012-01-14 14:15:43 +00:00
Howard Hinnant
fcf732c7a6
A bug fix involving the updating of path_dst_ptr_to_static_ptr. Some minor code rearrangement optimizations (putting most likely 'if' first in an if-else series. And some major optimizations which involve stopping the search prior to an exhaustive walk over the entire tree. Some of these stops are because an ambiguity is detected earlier. And some of the short circuiting is due to the information from the bits __diamond_shaped_mask and __non_diamond_repeat_mask. The stress test checked in last night is now about 28% faster for the B<Width/2, Depth> -O3 case. I'm still playing with some more optimization possibilities but I'm not sure they will play out.
...
llvm-svn: 148153
2012-01-13 23:06:03 +00:00
Howard Hinnant
50f7eeec9d
Enclosed is a stress test for dynamic_cast. It stresses both libc++abi, and clang itself. It creates a ridiculously large class hierarchy using variadic templates. You can specify both the width and depth of the class hierarchy. And you can specify whether the cast is to the actual run time type, or to an intermediate layer in the class. About 1/3 of the time I compile this, it crashes the compiler. There seems to be an uninitialized area of memory, and I'm probably blowing past an assumption on class hierarchy size within clang (and understandably so). I can get it work most of the time with a class hierarchy width of 20 and a depth of 7. I'm making timings with both -O3 and -Os, using both cast to root and cast to intermediate, on both libc++abi, and gcc's dynamic_cast. I've put the results in a comment/table at the bottom of the test.
...
llvm-svn: 148083
2012-01-13 01:22:31 +00:00
Howard Hinnant
b1ca881191
Oops, forgot to svn add the new test.
...
llvm-svn: 148047
2012-01-12 21:08:25 +00:00