From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id C1501385780F; Fri, 29 Apr 2022 22:23:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1501385780F Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Convert momentary breakpoints to vtable ops X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: c359fff502a91a31d7369dfab75179a8d8923fb2 X-Git-Newrev: 1fd30a473032c6fa23db9db46f4853951c5de0d6 Message-Id: <20220429222320.C1501385780F@sourceware.org> Date: Fri, 29 Apr 2022 22:23:20 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2022 22:23:20 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D1fd30a473032= c6fa23db9db46f4853951c5de0d6 commit 1fd30a473032c6fa23db9db46f4853951c5de0d6 Author: Tom Tromey Date: Sat Jan 15 15:25:15 2022 -0700 Convert momentary breakpoints to vtable ops =20 This converts momentary breakpoints to use vtable_breakpoint_ops. Diff: --- gdb/breakpoint.c | 45 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index ed012d0c9ff..1258f3d503e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -234,9 +234,6 @@ static int strace_marker_p (struct breakpoint *b); (user breakpoints, internal and momentary breakpoints, etc.). */ static struct breakpoint_ops bkpt_base_breakpoint_ops; =20 -/* Momentary breakpoints class type. */ -static struct breakpoint_ops momentary_breakpoint_ops; - /* The breakpoint_ops structure to be used in regular user created breakpoints. */ struct breakpoint_ops bkpt_breakpoint_ops; @@ -267,6 +264,10 @@ struct internal_breakpoint : public base_breakpoint /* Momentary breakpoints. */ struct momentary_breakpoint : public base_breakpoint { + void re_set () override; + void check_status (struct bpstat *bs) override; + enum print_stop_action print_it (struct bpstat *bs) override; + void print_mention () override; }; =20 /* DPrintf breakpoints. */ @@ -7351,7 +7352,7 @@ set_longjmp_breakpoint (struct thread_info *tp, struc= t frame_id frame) /* longjmp_breakpoint_ops ensures INITIATING_FRAME is cleared again after their removal. */ clone =3D momentary_breakpoint_from_master (b, type, - &momentary_breakpoint_ops, 1); + &vtable_breakpoint_ops, 1); clone->thread =3D thread; } =20 @@ -7397,7 +7398,7 @@ set_longjmp_breakpoint_for_call_dummy (void) struct breakpoint *new_b; =20 new_b =3D momentary_breakpoint_from_master (b, bp_longjmp_call_dummy, - &momentary_breakpoint_ops, + &vtable_breakpoint_ops, 1); new_b->thread =3D inferior_thread ()->global_num; =20 @@ -7529,7 +7530,7 @@ set_std_terminate_breakpoint (void) && b->type =3D=3D bp_std_terminate_master) { momentary_breakpoint_from_master (b, bp_std_terminate, - &momentary_breakpoint_ops, 1); + &vtable_breakpoint_ops, 1); } } =20 @@ -7936,7 +7937,7 @@ new_single_step_breakpoint (int thread, struct gdbarc= h *gdbarch) std::unique_ptr b (new momentary_breakpoint ()); =20 init_raw_breakpoint_without_location (b.get (), gdbarch, bp_single_step, - &momentary_breakpoint_ops); + &vtable_breakpoint_ops); =20 b->disposition =3D disp_donttouch; b->frame_id =3D null_frame_id; @@ -7961,7 +7962,7 @@ set_momentary_breakpoint (struct gdbarch *gdbarch, st= ruct symtab_and_line sal, tail-called one. */ gdb_assert (!frame_id_artificial_p (frame_id)); =20 - b =3D set_raw_breakpoint (gdbarch, sal, type, &momentary_breakpoint_ops); + b =3D set_raw_breakpoint (gdbarch, sal, type, &vtable_breakpoint_ops); b->enable_state =3D bp_enabled; b->disposition =3D disp_donttouch; b->frame_id =3D frame_id; @@ -8020,7 +8021,7 @@ clone_momentary_breakpoint (struct breakpoint *orig) if (orig =3D=3D NULL) return NULL; =20 - gdb_assert (orig->ops =3D=3D &momentary_breakpoint_ops); + gdb_assert (orig->ops =3D=3D &vtable_breakpoint_ops); return momentary_breakpoint_from_master (orig, orig->type, orig->ops, 0); } =20 @@ -10130,7 +10131,7 @@ watch_command_1 (const char *arg, int accessflag, i= nt from_tty, scope_breakpoint =3D create_internal_breakpoint (caller_arch, caller_pc, bp_watchpoint_scope, - &momentary_breakpoint_ops); + &vtable_breakpoint_ops); =20 /* create_internal_breakpoint could invalidate WP_FRAME. */ wp_frame =3D NULL; @@ -12079,8 +12080,8 @@ internal_breakpoint::print_mention () =20 /* Virtual table for momentary breakpoints */ =20 -static void -momentary_bkpt_re_set (struct breakpoint *b) +void +momentary_breakpoint::re_set () { /* Keep temporary breakpoints, which can be encountered when we step over a dlopen call and solib_add is resetting the breakpoints. @@ -12088,20 +12089,20 @@ momentary_bkpt_re_set (struct breakpoint *b) or by breakpoint_init_inferior when we rerun the executable. */ } =20 -static void -momentary_bkpt_check_status (bpstat *bs) +void +momentary_breakpoint::check_status (bpstat *bs) { /* Nothing. The point of these breakpoints is causing a stop. */ } =20 -static enum print_stop_action -momentary_bkpt_print_it (bpstat *bs) +enum print_stop_action +momentary_breakpoint::print_it (bpstat *bs) { return PRINT_UNKNOWN; } =20 -static void -momentary_bkpt_print_mention (struct breakpoint *b) +void +momentary_breakpoint::print_mention () { /* Nothing to mention. These breakpoints are internal. */ } @@ -14580,14 +14581,6 @@ initialize_breakpoint_ops (void) ops->print_mention =3D print_mention_ranged_breakpoint; ops->print_recreate =3D print_recreate_ranged_breakpoint; =20 - /* Momentary breakpoints. */ - ops =3D &momentary_breakpoint_ops; - *ops =3D bkpt_base_breakpoint_ops; - ops->re_set =3D momentary_bkpt_re_set; - ops->check_status =3D momentary_bkpt_check_status; - ops->print_it =3D momentary_bkpt_print_it; - ops->print_mention =3D momentary_bkpt_print_mention; - /* Probe breakpoints. */ ops =3D &bkpt_probe_breakpoint_ops; *ops =3D bkpt_breakpoint_ops;