[PATCH 3/3] Move decode_location to code_breakpoint

Tom Tromey tom@tromey.com
Sat May 28 02:42:31 GMT 2022


breakpoint::decode_location just asserts if called.  It turned out to
be relatively easy to remove this method from breakpoint and instead
move the base implementation to code_breakpoint.
---
 gdb/breakpoint.c |  7 -------
 gdb/breakpoint.h | 23 ++++++++++-------------
 2 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index ee34733e6cd..8c6507ae9fd 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -11474,13 +11474,6 @@ breakpoint::print_recreate (struct ui_file *fp) const
   internal_error_pure_virtual_called ();
 }
 
-std::vector<symtab_and_line>
-breakpoint::decode_location (struct event_location *location,
-			     struct program_space *search_pspace)
-{
-  internal_error_pure_virtual_called ();
-}
-
 /* Default breakpoint_ops methods.  */
 
 void
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 5ce6edf6efc..663c939c162 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -709,16 +709,6 @@ struct breakpoint
   /* Print to FP the CLI command that recreates this breakpoint.  */
   virtual void print_recreate (struct ui_file *fp) const;
 
-  /* Given the location (second parameter), this method decodes it and
-     returns the SAL locations related to it.  For ordinary
-     breakpoints, it calls `decode_line_full'.  If SEARCH_PSPACE is
-     not NULL, symbol search is restricted to just that program space.
-
-     This function is called inside `location_to_sals'.  */
-  virtual std::vector<symtab_and_line> decode_location
-    (struct event_location *location,
-     struct program_space *search_pspace);
-
   /* Return true if this breakpoint explains a signal.  See
      bpstat_explains_signal.  */
   virtual bool explains_signal (enum gdb_signal)
@@ -882,12 +872,19 @@ struct code_breakpoint : public breakpoint
 		      const address_space *aspace,
 		      CORE_ADDR bp_addr,
 		      const target_waitstatus &ws) override;
-  std::vector<symtab_and_line> decode_location
-       (struct event_location *location,
-	struct program_space *search_pspace) override;
 
 protected:
 
+  /* Given the location (second parameter), this method decodes it and
+     returns the SAL locations related to it.  For ordinary
+     breakpoints, it calls `decode_line_full'.  If SEARCH_PSPACE is
+     not NULL, symbol search is restricted to just that program space.
+
+     This function is called inside `location_to_sals'.  */
+  virtual std::vector<symtab_and_line> decode_location
+    (struct event_location *location,
+     struct program_space *search_pspace);
+
   /* Helper method that does the basic work of re_set.  */
   void re_set_default ();
 
-- 
2.34.1



More information about the Gdb-patches mailing list