[Lldb-commits] [PATCH] D51816: Fix raw address breakpoints not resolving

Ted Woodward via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 7 14:17:45 PDT 2018


ted created this revision.
ted added reviewers: jingham, LLDB.
Herald added a subscriber: lldb-commits.

An address breakpoint of the form "b 0x1000" won't resolve if it's created while the process isn't running. This patch deletes Address::SectionWasDeleted, renames Address::SectionWasDeletedPrivate to SectionWasDeleted (and makes it public), and changes the section check in Breakpoint::ModulesChanged back to its original form


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D51816

Files:
  include/lldb/Core/Address.h
  source/Breakpoint/Breakpoint.cpp
  source/Core/Address.cpp


Index: source/Core/Address.cpp
===================================================================
--- source/Core/Address.cpp
+++ source/Core/Address.cpp
@@ -281,7 +281,7 @@
     // We have a valid file range, so we can return the file based address by
     // adding the file base address to our offset
     return sect_file_addr + m_offset;
-  } else if (SectionWasDeletedPrivate()) {
+  } else if (SectionWasDeleted()) {
     // Used to have a valid section but it got deleted so the offset doesn't
     // mean anything without the section
     return LLDB_INVALID_ADDRESS;
@@ -302,7 +302,7 @@
         return sect_load_addr + m_offset;
       }
     }
-  } else if (SectionWasDeletedPrivate()) {
+  } else if (SectionWasDeleted()) {
     // Used to have a valid section but it got deleted so the offset doesn't
     // mean anything without the section
     return LLDB_INVALID_ADDRESS;
@@ -761,12 +761,6 @@
 }
 
 bool Address::SectionWasDeleted() const {
-  if (GetSection())
-    return false;
-  return SectionWasDeletedPrivate();
-}
-
-bool Address::SectionWasDeletedPrivate() const {
   lldb::SectionWP empty_section_wp;
 
   // If either call to "std::weak_ptr::owner_before(...) value returns true,
Index: source/Breakpoint/Breakpoint.cpp
===================================================================
--- source/Breakpoint/Breakpoint.cpp
+++ source/Breakpoint/Breakpoint.cpp
@@ -555,7 +555,7 @@
         // address that we haven't resolved to a section yet.  So we'll have to
         // look in all the new modules to resolve this location. Otherwise, if
         // it was set in this module, re-resolve it here.
-        if (section_sp && section_sp->GetModule() == module_sp) {
+        if (!section_sp || section_sp->GetModule() == module_sp) {
           if (!seen)
             seen = true;
 
Index: include/lldb/Core/Address.h
===================================================================
--- include/lldb/Core/Address.h
+++ include/lldb/Core/Address.h
@@ -525,11 +525,11 @@
   bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const;
 
   //------------------------------------------------------------------
-  // Returns true if the section should be valid, but isn't because the shared
-  // pointer to the section can't be reconstructed from a weak pointer that
-  // contains a valid weak reference to a section. Returns false if the section
-  // weak pointer has no reference to a section, or if the section is still
-  // valid
+  // Returns true if the m_section_wp once had a reference to a valid section
+  // shared pointer, but no longer does. This can happen if we have an address
+  // from a module that gets unloaded and deleted. This function should only be
+  // called if GetSection() returns an empty shared pointer and you want to
+  // know if this address used to have a valid section.
   //------------------------------------------------------------------
   bool SectionWasDeleted() const;
 
@@ -539,15 +539,6 @@
   //------------------------------------------------------------------
   lldb::SectionWP m_section_wp; ///< The section for the address, can be NULL.
   lldb::addr_t m_offset; ///< Offset into section if \a m_section_wp is valid...
-
-  //------------------------------------------------------------------
-  // Returns true if the m_section_wp once had a reference to a valid section
-  // shared pointer, but no longer does. This can happen if we have an address
-  // from a module that gets unloaded and deleted. This function should only be
-  // called if GetSection() returns an empty shared pointer and you want to
-  // know if this address used to have a valid section.
-  //------------------------------------------------------------------
-  bool SectionWasDeletedPrivate() const;
 };
 
 //----------------------------------------------------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51816.164515.patch
Type: text/x-patch
Size: 3859 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180907/10a099b2/attachment.bin>


More information about the lldb-commits mailing list