[Lldb-commits] [lldb] r341878 - Rollback "Fix raw address breakpoints not resolving".

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 10 16:09:10 PDT 2018


Author: davide
Date: Mon Sep 10 16:09:09 2018
New Revision: 341878

URL: http://llvm.org/viewvc/llvm-project?rev=341878&view=rev
Log:
Rollback "Fix raw address breakpoints not resolving".

It broke a bunch of bots. Ted confirmed, but can't revert for
now so I'm reverting on his behalf.

Modified:
    lldb/trunk/include/lldb/Core/Address.h
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
    lldb/trunk/source/Breakpoint/Breakpoint.cpp
    lldb/trunk/source/Core/Address.cpp

Modified: lldb/trunk/include/lldb/Core/Address.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=341878&r1=341877&r2=341878&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Mon Sep 10 16:09:09 2018
@@ -525,11 +525,11 @@ public:
   bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const;
 
   //------------------------------------------------------------------
-  // 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.
+  // 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
   //------------------------------------------------------------------
   bool SectionWasDeleted() const;
 
@@ -539,6 +539,15 @@ protected:
   //------------------------------------------------------------------
   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;
 };
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py?rev=341878&r1=341877&r2=341878&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py Mon Sep 10 16:09:09 2018
@@ -97,40 +97,3 @@ class AddressBreakpointTestCase(TestBase
 
         # The hit count for the breakpoint should now be 2.
         self.assertTrue(breakpoint.GetHitCount() == 2)
-
-
-
-    def test_address_breakpoint_set_before_launch(self):
-        """Test that an address bp set before the process is launched works correctly."""
-        self.build()
-
-        exe = self.getBuildArtifact("a.out")
-
-        # Create a target by the debugger.
-        target = self.dbg.CreateTarget(exe)
-        self.assertTrue(target, VALID_TARGET)
-
-        # get the address of the symbol "main"
-        sc_list = target.FindSymbols("main", lldb.eSymbolTypeCode)
-        symbol = sc_list.GetContextAtIndex(0).GetSymbol()
-        address = symbol.GetStartAddress().GetFileAddress()
-
-        # BreakpointCreateBySBAddress will resolve the address, causing this
-        # test to always pass, so use runCmd
-        self.runCmd("break set -a " + str(address))
-
-        # Disable ASLR.  This will allow us to actually test (on platforms that support this flag)
-        # that the breakpoint was able to track the module.
-
-        launch_info = lldb.SBLaunchInfo(None)
-        flags = launch_info.GetLaunchFlags()
-        flags &= ~lldb.eLaunchFlagDisableASLR
-        launch_info.SetLaunchFlags(flags)
-
-        error = lldb.SBError()
-
-        process = target.Launch(launch_info, error)
-        self.assertTrue(process, PROCESS_IS_VALID)
-        self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
-                    substrs=["stop reason = breakpoint 1.1"])
-

Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=341878&r1=341877&r2=341878&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Mon Sep 10 16:09:09 2018
@@ -555,7 +555,7 @@ void Breakpoint::ModulesChanged(ModuleLi
         // 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;
 

Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=341878&r1=341877&r2=341878&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Mon Sep 10 16:09:09 2018
@@ -281,7 +281,7 @@ addr_t Address::GetFileAddress() const {
     // 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 (SectionWasDeleted()) {
+  } else if (SectionWasDeletedPrivate()) {
     // 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 @@ addr_t Address::GetLoadAddress(Target *t
         return sect_load_addr + m_offset;
       }
     }
-  } else if (SectionWasDeleted()) {
+  } else if (SectionWasDeletedPrivate()) {
     // 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,6 +761,12 @@ bool Address::Dump(Stream *s, ExecutionC
 }
 
 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,




More information about the lldb-commits mailing list