[Lldb-commits] [PATCH] D39969: Set error status in ObjectFile::LoadInMemory if it is not set

Tatyana Krasnukha via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 14 22:55:40 PST 2017


tatyana-krasnukha updated this revision to Diff 122967.
tatyana-krasnukha added a comment.

Removed clang-format changes.


Repository:
  rL LLVM

https://reviews.llvm.org/D39969

Files:
  source/Symbol/ObjectFile.cpp


Index: source/Symbol/ObjectFile.cpp
===================================================================
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -665,7 +665,6 @@
 }
 
 Status ObjectFile::LoadInMemory(Target &target, bool set_pc) {
-  Status error;
   ProcessSP process = target.CalculateProcess();
   if (!process)
     return Status("No Process");
@@ -675,6 +674,8 @@
   SectionList *section_list = GetSectionList();
   if (!section_list)
     return Status("No section in object file");
+
+  Status error;
   size_t section_count = section_list->GetNumSections(0);
   for (size_t i = 0; i < section_count; ++i) {
     SectionSP section_sp = section_list->GetSectionAtIndex(i);
@@ -687,8 +688,13 @@
       section_sp->GetSectionData(section_data);
       lldb::offset_t written = process->WriteMemory(
           addr, section_data.GetDataStart(), section_data.GetByteSize(), error);
-      if (written != section_data.GetByteSize())
+      if (written != section_data.GetByteSize()) {
+        if (!error.Fail())
+          error.SetErrorStringWithFormat(
+              "One or more breakpoints intersect section '%s'",
+              section_sp->GetName().AsCString());
         return error;
+      }
     }
   }
   if (set_pc) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39969.122967.patch
Type: text/x-patch
Size: 1263 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171115/6f33e3e9/attachment.bin>


More information about the lldb-commits mailing list