[libcxx-dev] C++ exception issue on LLVM
zhangwentao (M) via libcxx-dev
libcxx-dev at lists.llvm.org
Thu Jan 3 00:36:08 PST 2019
Hi all,
I am using LLVM C++ in my project. Everything is good except exception. (version 6.0.1 release)
Version: 6.0.1
PLATFORM: arm 32 little endian.
A normal test case for try{}.... Catch(...) test case will crash. (RTTI, STL test cases work fine.)
Compiler CLANG, with -frtti -fexpceptions options.
Crashed Information:
1. Crashed in 'scan_eh_tab' function in `src/cxa_personality.cpp `.
715 const __shim_type_info* catchType =
716 get_shim_type_info(static_cast<uint64_t>(ttypeIndex),
717 classInfo, ttypeEncoding,
718 native_exception, unwind_exception); // get catchType by calling get_shim_type_info.
......
760 printf(" => catchType->name()=%s\n", catchType->name()); // visit catchType->name(); don't crash. But the name() is empty, I wonder if there is something wrong with RTTI??
761 printf("before can catch can catch => excpType=%p, adjustedPtr=%p, catchType=%s\n", excpType, adjustedPtr, typeid(*catchType).name()); // if add a typeid(*catchType).name(), crashed here
762 if (catchType->can_catch(excpType, adjustedPtr)) /// normally crashed here.. if remove this function call, the exception test could work fine for the basic test case.
763 {
341 static const __shim_type_info*
342 get_shim_type_info(uint64_t ttypeIndex, const uint8_t* classInfo,
343 uint8_t ttypeEncoding, bool native_exception,
344 _Unwind_Exception* unwind_exception)
345 {
346 if (classInfo == 0)
347 {
348 // this should not happen. Indicates corrupted eh_table.
349 call_terminate(native_exception, unwind_exception);
350 }
351
352 assert(((ttypeEncoding == DW_EH_PE_absptr) || // LLVM or GCC 4.6
353 (ttypeEncoding == DW_EH_PE_pcrel) || // GCC 4.7 baremetal
354 (ttypeEncoding == (DW_EH_PE_pcrel | DW_EH_PE_indirect))) && // GCC 4.7 linux
355 "Unexpected TTypeEncoding");
356 (void)ttypeEncoding;
357
358 const uint8_t* ttypePtr = classInfo - ttypeIndex * sizeof(uintptr_t);
359 return reinterpret_cast<const __shim_type_info *>(
360 read_target2_value(ttypePtr));
361 }
I do not known c++ exception very well, If I am correct the function get_shim_type_info will get shim_type_info from LSDA in elf section right??
If so, I wonder where the __shim_type_info constructed ? I guess, forget me if not correct: here just covert a memory in elf to a class ptr, maybe the vtable is not created for the ptr???
Do you have any idea about my case??
Thanks a lot~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20190103/a45c5a3a/attachment.html>
More information about the libcxx-dev
mailing list