diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2023-10-19 10:55:38 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2023-10-19 10:57:51 -0400 |
commit | 8971d2788e79db2ffc1205ed36935483eedf2fab (patch) | |
tree | ff5dead00b54316d0786af5c6558c41f6407c143 /gdb/solib-aix.c | |
parent | 98107b0b17acd9d2c28829cbe93a75b72677d220 (diff) | |
download | gdb-8971d2788e79db2ffc1205ed36935483eedf2fab.zip gdb-8971d2788e79db2ffc1205ed36935483eedf2fab.tar.gz gdb-8971d2788e79db2ffc1205ed36935483eedf2fab.tar.bz2 |
gdb: link so_list using intrusive_list
Replace the hand-made linked list implementation with intrusive_list,
simplying management of list items.
Change-Id: I7f55fd88325bb197cc655c9be5a2ec966d8cc48d
Approved-By: Pedro Alves <pedro@palves.net>
Reviewed-By: Reviewed-By: Lancelot Six <lancelot.six@amd.com>
Diffstat (limited to 'gdb/solib-aix.c')
-rw-r--r-- | gdb/solib-aix.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index e5e86c4..68798e8 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -445,21 +445,20 @@ solib_aix_solib_create_inferior_hook (int from_tty) /* Implement the "current_sos" target_so_ops method. */ -static struct so_list * -solib_aix_current_sos (void) +static intrusive_list<so_list> +solib_aix_current_sos () { - struct so_list *start = NULL, *last = NULL; - int ix; - gdb::optional<std::vector<lm_info_aix>> &library_list = solib_aix_get_library_list (current_inferior (), NULL); if (!library_list.has_value ()) - return NULL; + return {}; + + intrusive_list<so_list> sos; /* Build a struct so_list for each entry on the list. We skip the first entry, since this is the entry corresponding to the main executable, not a shared library. */ - for (ix = 1; ix < library_list->size (); ix++) + for (int ix = 1; ix < library_list->size (); ix++) { so_list *new_solib = new so_list; std::string so_name; @@ -488,16 +487,10 @@ solib_aix_current_sos (void) new_solib->lm_info = gdb::make_unique<lm_info_aix> (info); /* Add it to the list. */ - if (!start) - last = start = new_solib; - else - { - last->next = new_solib; - last = new_solib; - } + sos.push_back (*new_solib); } - return start; + return sos; } /* Implement the "open_symbol_file_object" target_so_ops method. */ |