[PATCH 03/36] Add an assertion to clone_momentary_breakpoint

Tom Tromey tom@tromey.com
Tue Jan 18 19:39:34 GMT 2022


This adds an assertion to clone_momentary_breakpoint.  This will
eventually be removed, but in the meantime is is useful for helping
convince oneself that momentary breakpoints will always use
momentary_breakpoint_ops.  This understanding will help when cleaning
up the code later.
---
 gdb/breakpoint.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index da9997f18d6..a0b8bd4e127 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7900,6 +7900,7 @@ clone_momentary_breakpoint (struct breakpoint *orig)
   if (orig == NULL)
     return NULL;
 
+  gdb_assert (orig->ops = &momentary_breakpoint_ops);
   return momentary_breakpoint_from_master (orig, orig->type, orig->ops, 0);
 }
 
-- 
2.31.1



More information about the Gdb-patches mailing list