Revert "[lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) overload"
authorMed Ismail Bennani <medismail.bennani@gmail.com>
Tue, 15 Dec 2020 05:11:35 +0000 (06:11 +0100)
committerMed Ismail Bennani <medismail.bennani@gmail.com>
Tue, 15 Dec 2020 05:18:04 +0000 (06:18 +0100)
This reverts commit 04696ff002e7d311887b7b7e6e171340a0623dd9.

Exposing the LazyBool private type in SBTarget.h breaks some tests.

lldb/bindings/interface/SBTarget.i
lldb/include/lldb/API/SBTarget.h
lldb/source/API/SBTarget.cpp
lldb/test/API/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py

index 41b9be2..57b5cce 100644 (file)
@@ -580,12 +580,6 @@ public:
                                 SBFileSpecList &module_list);
 
     lldb::SBBreakpoint
-    BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line,
-                                uint32_t column, lldb::addr_t offset,
-                                SBFileSpecList &module_list,
-                                bool move_to_nearest_code);
-
-    lldb::SBBreakpoint
     BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
 
     lldb::SBBreakpoint
index bf42372..fad842c 100644 (file)
@@ -9,8 +9,6 @@
 #ifndef LLDB_API_SBTARGET_H
 #define LLDB_API_SBTARGET_H
 
-#include "lldb/lldb-private-enumerations.h"
-
 #include "lldb/API/SBAddress.h"
 #include "lldb/API/SBAttachInfo.h"
 #include "lldb/API/SBBreakpoint.h"
@@ -562,12 +560,6 @@ public:
                              uint32_t column, lldb::addr_t offset,
                              SBFileSpecList &module_list);
 
-  lldb::SBBreakpoint
-  BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
-                             uint32_t column, lldb::addr_t offset,
-                             SBFileSpecList &module_list,
-                             bool move_to_nearest_code);
-
   lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
                                             const char *module_name = nullptr);
 
@@ -866,11 +858,6 @@ protected:
   void SetSP(const lldb::TargetSP &target_sp);
 
 private:
-  lldb::SBBreakpoint BreakpointCreateByLocationImpl(
-      const lldb::SBFileSpec &file_spec, uint32_t line, uint32_t column,
-      lldb::addr_t offset, SBFileSpecList &module_list,
-      const lldb_private::LazyBool move_to_nearest_code);
-
   lldb::TargetSP m_opaque_sp;
 };
 
index d0761d6..2a30515 100644 (file)
@@ -757,10 +757,14 @@ SBTarget::BreakpointCreateByLocation(const SBFileSpec &sb_file_spec,
                                                        offset, sb_module_list));
 }
 
-SBBreakpoint SBTarget::BreakpointCreateByLocationImpl(
-    const lldb::SBFileSpec &sb_file_spec, uint32_t line, uint32_t column,
-    lldb::addr_t offset, SBFileSpecList &sb_module_list,
-    const LazyBool move_to_nearest_code) {
+SBBreakpoint SBTarget::BreakpointCreateByLocation(
+    const SBFileSpec &sb_file_spec, uint32_t line, uint32_t column,
+    lldb::addr_t offset, SBFileSpecList &sb_module_list) {
+  LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBTarget, BreakpointCreateByLocation,
+                     (const lldb::SBFileSpec &, uint32_t, uint32_t,
+                      lldb::addr_t, lldb::SBFileSpecList &),
+                     sb_file_spec, line, column, offset, sb_module_list);
+
   SBBreakpoint sb_bp;
   TargetSP target_sp(GetSP());
   if (target_sp && line != 0) {
@@ -770,6 +774,7 @@ SBBreakpoint SBTarget::BreakpointCreateByLocationImpl(
     const LazyBool skip_prologue = eLazyBoolCalculate;
     const bool internal = false;
     const bool hardware = false;
+    const LazyBool move_to_nearest_code = eLazyBoolCalculate;
     const FileSpecList *module_list = nullptr;
     if (sb_module_list.GetSize() > 0) {
       module_list = sb_module_list.get();
@@ -779,34 +784,7 @@ SBBreakpoint SBTarget::BreakpointCreateByLocationImpl(
         skip_prologue, internal, hardware, move_to_nearest_code);
   }
 
-  return sb_bp;
-}
-
-SBBreakpoint SBTarget::BreakpointCreateByLocation(
-    const SBFileSpec &sb_file_spec, uint32_t line, uint32_t column,
-    lldb::addr_t offset, SBFileSpecList &sb_module_list) {
-  LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBTarget, BreakpointCreateByLocation,
-                     (const lldb::SBFileSpec &, uint32_t, uint32_t,
-                      lldb::addr_t, lldb::SBFileSpecList &),
-                     sb_file_spec, line, column, offset, sb_module_list);
-
-  return LLDB_RECORD_RESULT(BreakpointCreateByLocationImpl(
-      sb_file_spec, line, column, offset, sb_module_list, eLazyBoolCalculate));
-}
-
-SBBreakpoint SBTarget::BreakpointCreateByLocation(
-    const SBFileSpec &sb_file_spec, uint32_t line, uint32_t column,
-    lldb::addr_t offset, SBFileSpecList &sb_module_list,
-    bool move_to_nearest_code) {
-  LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBTarget, BreakpointCreateByLocation,
-                     (const lldb::SBFileSpec &, uint32_t, uint32_t,
-                      lldb::addr_t, lldb::SBFileSpecList &, bool),
-                     sb_file_spec, line, column, offset, sb_module_list,
-                     move_to_nearest_code);
-
-  return LLDB_RECORD_RESULT(BreakpointCreateByLocationImpl(
-      sb_file_spec, line, column, offset, sb_module_list,
-      move_to_nearest_code ? eLazyBoolYes : eLazyBoolNo));
+  return LLDB_RECORD_RESULT(sb_bp);
 }
 
 SBBreakpoint SBTarget::BreakpointCreateByName(const char *symbol_name,
@@ -2511,9 +2489,6 @@ void RegisterMethods<SBTarget>(Registry &R) {
                        BreakpointCreateByLocation,
                        (const lldb::SBFileSpec &, uint32_t, uint32_t,
                         lldb::addr_t, lldb::SBFileSpecList &));
-  LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBTarget, BreakpointCreateByLocation,
-                       (const lldb::SBFileSpec &, uint32_t, uint32_t,
-                        lldb::addr_t, lldb::SBFileSpecList &, bool));
   LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBTarget, BreakpointCreateByName,
                        (const char *, const char *));
   LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBTarget, BreakpointCreateByName,
index 1a0e9c6..a03e2ad 100644 (file)
@@ -42,30 +42,3 @@ class BreakpointByLineAndColumnTestCase(TestBase):
             self.assertEqual(b_loc.GetLine(), 11)
             in_condition |= b_loc.GetColumn() < 30
         self.assertTrue(in_condition)
-
-    ## Skip gcc version less 7.1 since it doesn't support -gcolumn-info
-    @skipIf(compiler="gcc", compiler_version=['<', '7.1'])
-    def testBreakpointByLineAndColumnNearestCode(self):
-        self.build()
-        exe = self.getBuildArtifact("a.out")
-
-        main_c = lldb.SBFileSpec("main.c")
-        line = line_number("main.c", "// Line 20.")
-        column = len("// Line 20") # should stop at the period.
-        indent = 2
-        module_list = lldb.SBFileSpecList()
-
-        # Create a target from the debugger.
-        target = self.dbg.CreateTarget(exe)
-        self.assertTrue(target, VALID_TARGET)
-
-        valid_bpt = target.BreakpointCreateByLocation(main_c, line, column,
-                                                      indent, module_list, True)
-        self.assertTrue(valid_bpt, VALID_BREAKPOINT)
-        self.assertEqual(valid_bpt.GetNumLocations(), 1)
-
-        invalid_bpt = target.BreakpointCreateByLocation(main_c, line, column,
-                                                      indent, module_list, False)
-        self.assertTrue(invalid_bpt, VALID_BREAKPOINT)
-        self.assertEqual(invalid_bpt.GetNumLocations(), 0)
-