diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-04-22 22:00:39 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-04-22 22:01:19 -0400 |
commit | 0406545d0668c0d2900654a8ec65bdaf23d157c9 (patch) | |
tree | 1497f66bdea1e7f786a3c12f4dcc7b637447af3e | |
parent | 19f6a43c6c17147acba638eab64f2bf8de4b1447 (diff) | |
download | gdb-0406545d0668c0d2900654a8ec65bdaf23d157c9.zip gdb-0406545d0668c0d2900654a8ec65bdaf23d157c9.tar.gz gdb-0406545d0668c0d2900654a8ec65bdaf23d157c9.tar.bz2 |
gdb: use function_view for iterate_over_bp_locations' callback
Use a function_view instead of function pointer + data. Actually,
nothing uses the data anyway, but that makes iterate_over_bp_locations
more like iterate_over_breakpoints.
gdb/ChangeLog:
* breakpoint.c (iterate_over_bp_locations): Change callback to
function view, remove data parameter.
* breakpoint.h (iterate_over_bp_locations): Likewise.
* record-full.c (record_full_sync_record_breakpoints): Remove
data parameter.
Change-Id: I66cdc94a505f67bc640bcc66865fb535ee939a57
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/breakpoint.c | 4 | ||||
-rw-r--r-- | gdb/breakpoint.h | 5 | ||||
-rw-r--r-- | gdb/record-full.c | 2 |
4 files changed, 13 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5d869db..7e4b0bd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2021-04-22 Simon Marchi <simon.marchi@polymtl.ca> + + * breakpoint.c (iterate_over_bp_locations): Change callback to + function view, remove data parameter. + * breakpoint.h (iterate_over_bp_locations): Likewise. + * record-full.c (record_full_sync_record_breakpoints): Remove + data parameter. + 2021-04-22 Tom Tromey <tom@tromey.com> * c-typeprint.c (c_type_print_base_struct_union): Use diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index c2d0ffb..a20464a 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2943,13 +2943,13 @@ insert_breakpoints (void) /* Invoke CALLBACK for each of bp_location. */ void -iterate_over_bp_locations (walk_bp_location_callback callback) +iterate_over_bp_locations (gdb::function_view<void (bp_location *)> callback) { struct bp_location *loc, **loc_tmp; ALL_BP_LOCATIONS (loc, loc_tmp) { - callback (loc, NULL); + callback (loc); } } diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index ded498f..3447e25 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1304,9 +1304,8 @@ extern void breakpoint_init_inferior (enum inf_context); extern void breakpoint_auto_delete (bpstat); -typedef void (*walk_bp_location_callback) (struct bp_location *, void *); - -extern void iterate_over_bp_locations (walk_bp_location_callback); +extern void iterate_over_bp_locations + (gdb::function_view<void (bp_location *)> callback); /* Return the chain of command lines to execute when this breakpoint is hit. */ diff --git a/gdb/record-full.c b/gdb/record-full.c index 23cbdcb..8a035b2 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -1720,7 +1720,7 @@ struct record_full_breakpoint static std::vector<record_full_breakpoint> record_full_breakpoints; static void -record_full_sync_record_breakpoints (struct bp_location *loc, void *data) +record_full_sync_record_breakpoints (struct bp_location *loc) { if (loc->loc_type != bp_loc_software_breakpoint) return; |