aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2023-09-29 22:59:22 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-10-19 10:57:51 -0400
commitbb86ab837e3c4eac98dba5618bf01894dd6b502a (patch)
tree1ae7227a5e21b5adc9f67e8ae187360c2818a043 /gdb/mi
parentc1d21880e981f3f890a74cd9d133e82b26c32818 (diff)
downloadgdb-bb86ab837e3c4eac98dba5618bf01894dd6b502a.zip
gdb-bb86ab837e3c4eac98dba5618bf01894dd6b502a.tar.gz
gdb-bb86ab837e3c4eac98dba5618bf01894dd6b502a.tar.bz2
gdb: replace some so_list parameters to use references
A subsequent patch changes so_list to be linked using intrusive_list. Iterating an intrusive_list yields some references to the list elements. Convert some functions accepting so_list objects to take references, to make things easier and more natural. Add const where possible and convenient. Change-Id: Id5ab5339c3eb6432e809ad14782952d6a45806f3 Approved-By: Pedro Alves <pedro@palves.net> Reviewed-By: Reviewed-By: Lancelot Six <lancelot.six@amd.com>
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-cmd-file.c2
-rw-r--r--gdb/mi/mi-interp.c26
-rw-r--r--gdb/mi/mi-interp.h6
3 files changed, 17 insertions, 17 deletions
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c
index 688bf49..822d3df 100644
--- a/gdb/mi/mi-cmd-file.c
+++ b/gdb/mi/mi-cmd-file.c
@@ -171,6 +171,6 @@ mi_cmd_file_list_shared_libraries (const char *command,
continue;
ui_out_emit_tuple tuple_emitter (uiout, NULL);
- mi_output_solib_attribs (uiout, so);
+ mi_output_solib_attribs (uiout, *so);
}
}
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 0d3c823..0fae567 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -724,28 +724,28 @@ mi_interp::on_target_resumed (ptid_t ptid)
/* See mi-interp.h. */
void
-mi_output_solib_attribs (ui_out *uiout, struct so_list *solib)
+mi_output_solib_attribs (ui_out *uiout, const so_list &solib)
{
gdbarch *gdbarch = current_inferior ()->arch ();
- uiout->field_string ("id", solib->so_original_name);
- uiout->field_string ("target-name", solib->so_original_name);
- uiout->field_string ("host-name", solib->so_name);
- uiout->field_signed ("symbols-loaded", solib->symbols_loaded);
+ uiout->field_string ("id", solib.so_original_name);
+ uiout->field_string ("target-name", solib.so_original_name);
+ uiout->field_string ("host-name", solib.so_name);
+ uiout->field_signed ("symbols-loaded", solib.symbols_loaded);
if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
ui_out_emit_list list_emitter (uiout, "ranges");
ui_out_emit_tuple tuple_emitter (uiout, NULL);
- if (solib->addr_high != 0)
+ if (solib.addr_high != 0)
{
- uiout->field_core_addr ("from", gdbarch, solib->addr_low);
- uiout->field_core_addr ("to", gdbarch, solib->addr_high);
+ uiout->field_core_addr ("from", gdbarch, solib.addr_low);
+ uiout->field_core_addr ("to", gdbarch, solib.addr_high);
}
}
void
-mi_interp::on_solib_loaded (so_list *solib)
+mi_interp::on_solib_loaded (const so_list &solib)
{
ui_out *uiout = this->interp_ui_out ();
@@ -762,7 +762,7 @@ mi_interp::on_solib_loaded (so_list *solib)
}
void
-mi_interp::on_solib_unloaded (so_list *solib)
+mi_interp::on_solib_unloaded (const so_list &solib)
{
ui_out *uiout = this->interp_ui_out ();
@@ -773,9 +773,9 @@ mi_interp::on_solib_unloaded (so_list *solib)
ui_out_redirect_pop redir (uiout, this->event_channel);
- uiout->field_string ("id", solib->so_original_name);
- uiout->field_string ("target-name", solib->so_original_name);
- uiout->field_string ("host-name", solib->so_name);
+ uiout->field_string ("id", solib.so_original_name);
+ uiout->field_string ("target-name", solib.so_original_name);
+ uiout->field_string ("host-name", solib.so_name);
if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
diff --git a/gdb/mi/mi-interp.h b/gdb/mi/mi-interp.h
index f9af61f..781a8dc 100644
--- a/gdb/mi/mi-interp.h
+++ b/gdb/mi/mi-interp.h
@@ -60,8 +60,8 @@ public:
void on_record_changed (inferior *inf, int started, const char *method,
const char *format) override;
void on_target_resumed (ptid_t ptid) override;
- void on_solib_loaded (so_list *so) override;
- void on_solib_unloaded (so_list *so) override;
+ void on_solib_loaded (const so_list &so) override;
+ void on_solib_unloaded (const so_list &so) override;
void on_about_to_proceed () override;
void on_traceframe_changed (int tfnum, int tpnum) override;
void on_tsv_created (const trace_state_variable *tsv) override;
@@ -108,7 +108,7 @@ public:
/* Output the shared object attributes to UIOUT. */
-void mi_output_solib_attribs (ui_out *uiout, struct so_list *solib);
+void mi_output_solib_attribs (ui_out *uiout, const so_list &solib);
/* Returns the INTERP's data cast as mi_interp if INTERP is an MI, and
returns NULL otherwise. */