[PATCH v2 1/3] Remove unused parameter in solib_add and update_solib_list

Marc-Andre Laperle
2017-02-03T17:16:55Z

The target parameter in both solib_add and update_solib_list
functions is not used anymore and as not been used for a while. This
change removes the parameter to clean up the code a little bit.

gdb/ChangeLog:

* infcmd.c (post_create_inferior): Remove unused argument in
call to solib_add.
* remote.c (remote_start_remote): Likewise.
* solib-frv.c (frv_fetch_objfile_link_map): Likewise.
* solib-svr4.c: (svr4_fetch_objfile_link_map): Likewise.
(enable_break): Likewise.
* solib.c (update_solib_list): Remove unused target argument
and its documentation.
(solib_add): Remove unused target argument. Remove unused
argument in call to update_solib_list.
(info_sharedlibrary_command): Remove unused argument in call
to update_solib_list.
(sharedlibrary_command): Remove unused argument in call to
solib_add.
(handle_solib_event): Likewise.
(reload_shared_libraries): Likewise.
* solib.h (solib_add): Remove unused target argument.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
---
gdb/infcmd.c | 2 +-
gdb/remote.c | 2 +-
gdb/solib-frv.c | 2 +-
gdb/solib-svr4.c | 6 +++---
gdb/solib.c | 28 ++++++++++------------------
gdb/solib.h | 2 +-
6 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index d836162..d41e609 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -458,7 +458,7 @@ post_create_inferior (struct target_ops *target, int from_tty)
/* If the solist is global across processes, there's no need to
refetch it here. */
if (!gdbarch_has_global_solist (target_gdbarch ()))
- solib_add (NULL, 0, target, auto_solib_add);
+ solib_add (NULL, 0, auto_solib_add);
}
}

diff --git a/gdb/remote.c b/gdb/remote.c
index 3befbd3..ebe7ee2 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4142,7 +4142,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
/* On OSs where the list of libraries is global to all
processes, we fetch them early. */
if (gdbarch_has_global_solist (target_gdbarch ()))
- solib_add (NULL, from_tty, target, auto_solib_add);
+ solib_add (NULL, from_tty, auto_solib_add);

if (target_is_non_stop_p ())
{
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 261b568..e8d5f20 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -1131,7 +1131,7 @@ frv_fetch_objfile_link_map (struct objfile *objfile)

/* Cause frv_current_sos() to be run if it hasn't been already. */
if (main_lm_addr == 0)
- solib_add (0, 0, 0, 1);
+ solib_add (0, 0, 1);

/* frv_current_sos() will set main_lm_addr for the main executable. */
if (objfile == symfile_objfile)
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 4f52251..4cb6127 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1618,7 +1618,7 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)

/* Cause svr4_current_sos() to be run if it hasn't been already. */
if (info->main_lm_addr == 0)
- solib_add (NULL, 0, &current_target, auto_solib_add);
+ solib_add (NULL, 0, auto_solib_add);

/* svr4_current_sos() will set main_lm_addr for the main executable. */
if (objfile == symfile_objfile)
@@ -2277,7 +2277,7 @@ enable_break (struct svr4_info *info, int from_tty)
mean r_brk has already been relocated. Assume the dynamic linker
is the object containing r_brk. */

- solib_add (NULL, from_tty, &current_target, auto_solib_add);
+ solib_add (NULL, from_tty, auto_solib_add);
sym_addr = 0;
if (info->debug_base && solib_svr4_r_map (info) != 0)
sym_addr = solib_svr4_r_brk (info);
@@ -2453,7 +2453,7 @@ enable_break (struct svr4_info *info, int from_tty)
info->debug_loader_name = xstrdup (interp_name);
info->debug_loader_offset_p = 1;
info->debug_loader_offset = load_addr;
- solib_add (NULL, from_tty, &current_target, auto_solib_add);
+ solib_add (NULL, from_tty, auto_solib_add);
}

/* Record the relocated start and end address of the dynamic linker
diff --git a/gdb/solib.c b/gdb/solib.c
index fc45133..38737b6 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -763,17 +763,10 @@ solib_used (const struct so_list *const known)
to the list, and leave their symbols_loaded flag clear.

If FROM_TTY is non-null, feel free to print messages about what
- we're doing.
+ we're doing. */

- If TARGET is non-null, add the sections of all new shared objects
- to TARGET's section table. Note that this doesn't remove any
- sections for shared objects that have been unloaded, and it
- doesn't check to see if the new shared objects are already present in
- the section table. But we only use this for core files and
- processes we've just attached to, so that's okay. */
-
-static void
-update_solib_list (int from_tty, struct target_ops *target)
+void
+update_solib_list (int from_tty)
{
const struct target_so_ops *ops = solib_ops (target_gdbarch ());
struct so_list *inferior = ops->current_sos();
@@ -974,11 +967,10 @@ libpthread_solib_p (struct so_list *so)
If READSYMS is 0, defer reading symbolic information until later
but still do any needed low level processing.

- FROM_TTY and TARGET are as described for update_solib_list, above. */
+ FROM_TTY is described for update_solib_list, above. */

void
-solib_add (const char *pattern, int from_tty,
- struct target_ops *target, int readsyms)
+solib_add (const char *pattern, int from_tty, int readsyms)
{
struct so_list *gdb;

@@ -1003,7 +995,7 @@ solib_add (const char *pattern, int from_tty,
error (_("Invalid regexp: %s"), re_err);
}

- update_solib_list (from_tty, target);
+ update_solib_list (from_tty);

/* Walk the list of currently loaded shared libraries, and read
symbols for any that match the pattern --- or any whose symbols
@@ -1086,7 +1078,7 @@ info_sharedlibrary_command (char *pattern, int from_tty)
/* "0x", a little whitespace, and two hex digits per byte of pointers. */
addr_width = 4 + (gdbarch_ptr_bit (gdbarch) / 4);

- update_solib_list (from_tty, 0);
+ update_solib_list (from_tty);

/* make_cleanup_ui_out_table_begin_end needs to know the number of
rows, so we need to make two passes over the libs. */
@@ -1276,7 +1268,7 @@ static void
sharedlibrary_command (char *args, int from_tty)
{
dont_repeat ();
- solib_add (args, from_tty, (struct target_ops *) 0, 1);
+ solib_add (args, from_tty, 1);
}

/* Implements the command "nosharedlibrary", which discards symbols
@@ -1323,7 +1315,7 @@ handle_solib_event (void)
be adding them automatically. Switch terminal for any messages
produced by breakpoint_re_set. */
target_terminal_ours_for_output ();
- solib_add (NULL, 0, &current_target, auto_solib_add);
+ solib_add (NULL, 0, auto_solib_add);
target_terminal_inferior ();
}

@@ -1441,7 +1433,7 @@ reload_shared_libraries (char *ignored, int from_tty,
removed. Call it only after the solib target has been initialized by
solib_create_inferior_hook. */

- solib_add (NULL, 0, NULL, auto_solib_add);
+ solib_add (NULL, 0, auto_solib_add);

breakpoint_re_set ();

diff --git a/gdb/solib.h b/gdb/solib.h
index dd07636..1b46849 100644
--- a/gdb/solib.h
+++ b/gdb/solib.h
@@ -35,7 +35,7 @@ extern void clear_solib (void);

/* Called to add symbols from a shared library to gdb's symbol table. */

-extern void solib_add (const char *, int, struct target_ops *, int);
+extern void solib_add (const char *, int, int);
extern int solib_read_symbols (struct so_list *, symfile_add_flags);

/* Function to be called when the inferior starts up, to discover the
--
2.9.3