Author: labath Date: Wed Mar 27 02:39:46 2019 New Revision: 357055 URL: http://llvm.org/viewvc/llvm-project?rev=357055&view=rev Log: Fix an out-of-bounds error in RegisterContextDarwin_arm64
Summary: gcc diagnoses this as "array subscript 63 is above array bounds of 'RegisterContextDarwin_arm64::VReg [32]'". The correct fix seems to be subtracting the fpu register base index, but I have no way of verifying that this actually works. Reviewers: jasonmolenda Subscribers: javed.absar, kristof.beyls, lldb-commits Differential Revision: https://reviews.llvm.org/D59495 Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp?rev=357055&r1=357054&r2=357055&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp Wed Mar 27 02:39:46 2019 @@ -429,7 +429,7 @@ bool RegisterContextDarwin_arm64::ReadRe case fpu_v29: case fpu_v30: case fpu_v31: - value.SetBytes(fpu.v[reg].bytes.buffer, reg_info->byte_size, + value.SetBytes(fpu.v[reg - fpu_v0].bytes.buffer, reg_info->byte_size, endian::InlHostByteOrder()); break; @@ -621,7 +621,8 @@ bool RegisterContextDarwin_arm64::WriteR case fpu_v29: case fpu_v30: case fpu_v31: - ::memcpy(fpu.v[reg].bytes.buffer, value.GetBytes(), value.GetByteSize()); + ::memcpy(fpu.v[reg - fpu_v0].bytes.buffer, value.GetBytes(), + value.GetByteSize()); break; case fpu_fpsr: _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits