[Lldb-commits] [lldb] r339153 - Check result after setting PC value.

Tatyana Krasnukha via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 7 09:46:11 PDT 2018


Author: tkrasnukha
Date: Tue Aug  7 09:46:11 2018
New Revision: 339153

URL: http://llvm.org/viewvc/llvm-project?rev=339153&view=rev
Log:
Check result after setting PC value.

Modified:
    lldb/trunk/source/Commands/CommandObjectTarget.cpp

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=339153&r1=339152&r2=339153&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Aug  7 09:46:11 2018
@@ -2740,10 +2740,15 @@ protected:
                   }
                   if (set_pc) {
                     ThreadList &thread_list = process->GetThreadList();
-                    ThreadSP curr_thread(thread_list.GetSelectedThread());
                     RegisterContextSP reg_context(
-                        curr_thread->GetRegisterContext());
-                    reg_context->SetPC(file_entry.GetLoadAddress(target));
+                        thread_list.GetSelectedThread()->GetRegisterContext());
+                    addr_t file_entry_addr = file_entry.GetLoadAddress(target);
+                    if (!reg_context->SetPC(file_entry_addr)) {
+                      result.AppendErrorWithFormat("failed to set PC value to "
+                                                   "0x%" PRIx64 "\n",
+                                                   file_entry_addr);
+                      result.SetStatus(eReturnStatusFailed);
+                    }
                   }
                 }
               } else {




More information about the lldb-commits mailing list