aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-05-01 16:11:26 -0600
committerTom Tromey <tom@tromey.com>2022-05-06 12:03:35 -0600
commitfed1c982dec3baba167b3fd4df3538f09fa3d339 (patch)
tree40077feab51633a68a1cf53066f83ff7f3991b90 /gdb/breakpoint.c
parentb68f26dea78f1a390084a0e2bfa95f1bcf1942dc (diff)
downloadbinutils-fed1c982dec3baba167b3fd4df3538f09fa3d339.zip
binutils-fed1c982dec3baba167b3fd4df3538f09fa3d339.tar.gz
binutils-fed1c982dec3baba167b3fd4df3538f09fa3d339.tar.bz2
Introduce catchpoint class
This introduces a catchpoint class that is used as the base class for all catchpoints. init_catchpoint is rewritten to be a constructor instead. This changes the hierarchy a little -- some catchpoints now inherit from base_breakpoint whereas previously they did not. This isn't a problem, as long as re_set is redefined in catchpoint.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 4c7542a..9abc144 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7804,23 +7804,18 @@ disable_breakpoints_in_freed_objfile (struct objfile *objfile)
/* See breakpoint.h. */
-void
-init_catchpoint (struct breakpoint *b,
- struct gdbarch *gdbarch, bool temp,
- const char *cond_string)
+catchpoint::catchpoint (struct gdbarch *gdbarch, bool temp,
+ const char *cond_string_)
+ : base_breakpoint (gdbarch, bp_catchpoint)
{
symtab_and_line sal;
sal.pspace = current_program_space;
- /* This should already have been set in the constructor. */
- gdb_assert (b->type == bp_catchpoint);
- init_raw_breakpoint (b, sal, bp_catchpoint);
+ init_raw_breakpoint (this, sal, bp_catchpoint);
- if (cond_string == nullptr)
- b->cond_string.reset ();
- else
- b->cond_string = make_unique_xstrdup (cond_string);
- b->disposition = temp ? disp_del : disp_donttouch;
+ if (cond_string_ != nullptr)
+ cond_string = make_unique_xstrdup (cond_string_);
+ disposition = temp ? disp_del : disp_donttouch;
}
void