Commit Graph

241 Commits

Author SHA1 Message Date
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