Index: source/Target/ThreadPlanCallFunction.cpp =================================================================== --- source/Target/ThreadPlanCallFunction.cpp +++ source/Target/ThreadPlanCallFunction.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/Triple.h" + #include "lldb/Target/ThreadPlanCallFunction.h" // C Includes @@ -167,6 +169,32 @@ args)) return; + /** The following code is specific to Linux x86 based architectures, + * where the register orig_eax (32 bit)/orig_rax (64 bit) is set to + * -1 to solve the bug 23659, such a setting prevents the automatic + * decrement of the instruction pointer which was causing the SIGILL + * exception. + * **/ + ProcessSP process_sp (thread.GetProcess()); + if (!process_sp) + return; + + llvm::Triple t_triple = process_sp->GetTarget().GetArchitecture().GetTriple(); + + if (t_triple.getOS() == llvm::Triple::Linux && + (t_triple.getArch() == llvm::Triple::x86 || + t_triple.getArch() == llvm::Triple::x86_64)) + { + RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); + const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName ("orig_eax"); + if (reg_info == nullptr) + reg_info = reg_ctx->GetRegisterInfoByName ("orig_rax"); + + if (reg_info != nullptr) + reg_ctx->WriteRegisterFromUnsigned(reg_info, -1); + + } + ReportRegisterState ("Function call was set up. Register state was:"); m_valid = true;