summaryrefslogtreecommitdiffstats
path: root/libunwind/src/DwarfInstructions.hpp
Commit message (Collapse)AuthorAgeFilesLines
* [libunwind] Fix evaluating DWARF operation DW_OP_pickSteven Wu2019-12-181-1/+1
| | | | | | | | | | | | reg is unsigned type and used here for getting array element from the end by negating it. negation of unsigned can result in large number and array access with that index will result in segmentation fault. Fixes: https://bugs.llvm.org/show_bug.cgi?id=43872 Patched by: kamlesh kumar Differential Revision: https://reviews.llvm.org/D69893
* Correctly update isSignalFrame when unwinding the stack via dwarf.Sterling Augustine2019-11-071-2/+5
| | | | | | | | | | | | | | | | | | A "signal frame" is a function or block of code where execution arrives via a signal or interrupt, rather than via a normal call instruction. In fact, a particular instruction is interrupted by the signal and needs to be restarted. Therefore, when the signal handler is complete, execution needs to return to the interrupted instruction, rather than the instruction immediately following the call instruction, as in a normal call. Stack unwinders need to know this to correctly unwind signal frames. Dwarf handily provides an "S" in the CIE augmentation string to describe this case, and the libunwind API provides various functions to for unwinders to determine it,. The llvm libunwind implementation correctly sets it's internal variable "isSignalFrame" when initializing an unwind context. However, upon stepping up the stack, the current implementation correctly reads the augmentation string and sets it in the CIE info (which it then discards), libunwind doesn't update it's internal unwind context data structure. This change fixes that, and provides compatibility with both the canonical libunwind and the libgcc implementation. Reviewers: jfb Subscribers: christof, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D69677
* [PPC64][libunwind] Fix r2 not properly restoredMartin Storsjo2019-05-161-0/+25
| | | | | | | | | | | | | | | | This change makes each unwind step inspect the instruction at the return address and, if needed, read r2 from its saved location and modify the context appropriately. The unwind logic is able to handle both ELFv1 and ELFv2 stacks. Reported by Bug 41050 Patch by Leandro Lupori! Differential Revision: https://reviews.llvm.org/D59694 llvm-svn: 360861
* Add casts to avoid warnings about implicit conversions losing precisionMartin Storsjo2019-01-221-4/+3
| | | | | | | | | | | | | | | | | | | | This fixes warnings like these: DwarfInstructions.hpp:85:25: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'libunwind::DwarfInstructions<libunwind::LocalAddressSpace, libunwind::Registers_arm>::pint_t' (aka 'unsigned int') [-Wshorten-64-to-32] DwarfInstructions.hpp:88:25: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'libunwind::DwarfInstructions<libunwind::LocalAddressSpace, libunwind::Registers_arm>::pint_t' (aka 'unsigned int') [-Wshorten-64-to-32] Differential Revision: https://reviews.llvm.org/D56983 llvm-svn: 351877
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* [Sparc] Add Sparc V8 supportDaniel Cederman2019-01-141-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adds the register class implementation for Sparc. Adds support for DW_CFA_GNU_window_save. Adds save and restore context functionality. Adds getArch() function to each Registers_ class to be able to separate between DW_CFA_AARCH64_negate_ra_state and DW_CFA_GNU_window_save which are both represented by the same constant. On Sparc the return address is the address of the call instruction, so an offset needs to be added when returning to skip the call instruction and its delay slot. If the function returns a struct it is also necessary to skip one extra instruction on Sparc V8. Reviewers: jyknight, mclow.lists, mstorsjo, compnerd Reviewed By: jyknight, compnerd Subscribers: jgorbe, mgorny, christof, llvm-commits, fedor.sergeev, JDevlieghere, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D55763 llvm-svn: 351044
* Revert "[Sparc] Add Sparc V8 support"Jorge Gorbe Moya2019-01-101-8/+0
| | | | | | This reverts commit r350705. llvm-svn: 350787
* [Sparc] Add Sparc V8 supportDaniel Cederman2019-01-091-0/+8
| | | | | | | | | | | | | | | | | | | | | | Summary: Adds the register class implementation for Sparc. Adds support for DW_CFA_GNU_window_save. Adds save and restore context functionality. On Sparc the return address is the address of the call instruction, so an offset needs to be added when returning to skip the call instruction and its delay slot. If the function returns a struct it is also necessary to skip one extra instruction. Reviewers: jyknight, mclow.lists, mstorsjo, compnerd Reviewed By: compnerd Subscribers: fedor.sergeev, JDevlieghere, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D55763 llvm-svn: 350705
* [AArch64][libunwind] Unwinding support for return address signing with B KeyLuke Cheeseman2018-12-171-3/+7
| | | | | | | | | | - Support for the case where the return address has been signed with the B key - When the B key is used, a 'B' character is present in the augmentation string of CIE associated with the FDE for the function. Differential Revision: https://reviews.llvm.org/D55704 llvm-svn: 349339
* [AArch64][libunwind] Unwinding support for return address signingLuke Cheeseman2018-12-141-0/+21
| | | | | | | | | | | | | | - Follow up to revision r342895 - gcc would not build libunwind with the earlier patch as the autia1716 instruction wasn't allowed to be assembled for pre armv8.3a targets - The autia1716 instruction lives in the hint space encodings so is a valid instruction for all armv8a targets - To work around this I have swapped out the autia1716 instruction for the hint instruction Differential Revision: https://reviews.llvm.org/D55700 llvm-svn: 349140
* Reverting r342895Luke Cheeseman2018-09-241-18/+0
| | | | | | - The used builtins do not compile for pre arm v8.3a targets with gcc llvm-svn: 342901
* [AArch64] Unwinding support for return address signingLuke Cheeseman2018-09-241-0/+18
| | | | | | | | | | - When return address signing is enabled, the LR may be signed on function entry - When an exception is thrown the return address is inspected used to unwind the call stack - Before this happens, the return address must be correctly authenticated to avoid causing an abort by dereferencing the signed pointer Differential Revision: https://reviews.llvm.org/D51432 llvm-svn: 342895
* [libunwind][MIPS]: Add support for unwinding in N32 processes.John Baldwin2018-02-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: N32 uses the same register context as N64. However, N32 requires one change to properly fetch addresses from registers stored in memory. Since N32 is an ILP32 platform, getP() only fetches the first 32-bits of a stored register. For a big-endian platform this fetches the upper 32-bits which will be zero. To fix this, add a new getRegister() method to AddressSpace which is responsible for extracting the address stored in a register in memory. This matches getP() for all current ABIs except for N32 where it reads the 64-bit register and returns the low 32-bits as an address. The DwarfInstructions::getSavedRegister() method uses AddressSpace::getRegister() instead of AddressSpace::getP(). Reviewers: sdardis, compnerd Reviewed By: sdardis Differential Revision: https://reviews.llvm.org/D39074 llvm-svn: 326250
* Express Registers_*::lastDwarfReg using _LIBUNWIND_HIGHEST_DWARF_REGISTERMartin Storsjo2017-10-271-1/+1
| | | | | | | | | | | | | | This avoids having to keep the same information duplicated in multiple places. Adjust _LIBUNWIND_HIGHEST_DWARF_REGISTER to actually have the value of the highest used register and only use the value _LIBUNWIND_HIGHEST_DWARF_REGISTER + 1 (kMaxRegisterNumber + 1) for allocating the savedRegisters array. Differential Revision: https://reviews.llvm.org/D39281 llvm-svn: 316745
* Fix up the places where AddressSpace.hpp is included.Ed Schouten2017-03-091-1/+0
| | | | | | | | | | | | | | | | The AddressSpace.hpp header declares two classes: LocalAddressSpace and RemoteAddressSpace. These classes are only used in a very small number of source files, but passed in as template arguments to many other classes. Let's go ahead and only include AddressSpace.hpp in source files where at least one of these two classes is mentioned. This gets rid of a cyclic header dependency that was already present, but only caused breakage on macOS until recently. Reported by: Marshall Clow llvm-svn: 297364
* DARWF: silence some warnings about conversionsSaleem Abdulrasool2017-03-081-1/+1
| | | | | | | Add a check for an overflow and explicitly cast the value. We would have silently overflowed previously. llvm-svn: 297291
* libunwind: Use conventional DWARF capitalization in comments and errorsEd Maste2016-07-191-4/+4
| | | | llvm-svn: 275996
* Correct sense of unwind return address register range assertionEd Maste2015-08-131-1/+1
| | | | | | | I encountered this on FreeBSD/arm64, and then found the same issue was reported by Daniil Troshkov. llvm-svn: 244892
* Code cleanup: Reindent statements.Logan Chien2015-05-301-3/+3
| | | | llvm-svn: 238656
* unwind: move src/Unwind, include/, and test/ unwind contentSaleem Abdulrasool2015-04-241-0/+760
This moves the majority of the unwind sources into the new project layout for libunwind. This was previously discussed on llvmdev at [1]. This is a purely movement related change, with the build infrastructure currently still residing in the libc++abi repository. [1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-January/081507.html llvm-svn: 235758
OpenPOWER on IntegriCloud