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) {


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) {
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to