This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC/commit 1/4] Delete unused or undefined functions.


The following functions are either unused or undefined.

  - ep_parse_optional_filename: This stopped being used after support
    for catch load and unload was removed

  - linux-nat.c:init_lwp_list(): This function apparently got replaced
    by purge_lwp_list.

  - [...] After that, I stopped checking when the function stopped being
    used, because it was taking too much time.

gdb/ChangeLog:

        * breakpoint.c (ep_parse_optional_filename): Delete.
        * dcache.c (dcache_write_line): Remove declaration.
        * infrun.c (build_infrun): Remove declaration.
        * tracepoint.c (tracepoint_save_command): Remove declaration.
        * linux-nat.c (init_lwp_list): Delete. No longer used.
        * event-loop.c (check_async_signal_handlers): Delete declaration.
        * infrun.c (init_execution_control_state): Delete.
        (proceed): Update comment to avoid mentioning
        init_execution_control_state.
        * target.c (kill_or_be_killed, nosupport_runtime): Delete.
        * ada-lang.c (ada_to_static_fixed_value): Delete.
        * scm-lang.c (evaluate_subexp_scm): Delete declaration.
        * cp-namespace.c (cp_copy_usings): Delete.
        * xml-syscall.c (xml_number_of_syscalls): Delete.
        * progspace.c (find_program_space_by_num): Delete.
        * inflow.c (handle_sigio): Delete declaration.

Posting this patch as a FYI. Please let me know if there is anything
that you think should be retained because you'll need it later. I would
like to commit this patch within the next few days.

---
 gdb/ada-lang.c     |   16 ----------------
 gdb/breakpoint.c   |   38 --------------------------------------
 gdb/cp-namespace.c |   33 ---------------------------------
 gdb/dcache.c       |    2 --
 gdb/event-loop.c   |    1 -
 gdb/inflow.c       |    4 ----
 gdb/infrun.c       |   28 ++++++++--------------------
 gdb/linux-nat.c    |   19 -------------------
 gdb/progspace.c    |   14 --------------
 gdb/scm-lang.c     |    2 --
 gdb/target.c       |   41 -----------------------------------------
 gdb/tracepoint.c   |    1 -
 gdb/xml-syscall.c  |    7 -------
 13 files changed, 8 insertions(+), 198 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 8f90711..32a1afa 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -7573,22 +7573,6 @@ ada_to_fixed_value (struct value *val)
                                     value_address (val),
                                     val);
 }
-
-/* A value representing VAL, but with a standard (static-sized) type
-   chosen to approximate the real type of VAL as well as possible, but
-   without consulting any runtime values.  For Ada dynamic-sized
-   types, therefore, the type of the result is likely to be inaccurate.  */
-
-static struct value *
-ada_to_static_fixed_value (struct value *val)
-{
-  struct type *type =
-    to_static_fixed_type (static_unwrap_type (value_type (val)));
-  if (type == value_type (val))
-    return val;
-  else
-    return coerce_unspec_val_to_type (val, type);
-}
 
 
 /* Attributes */
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0dc8474..f2c9246 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -187,8 +187,6 @@ static void stopat_command (char *arg, int from_tty);
 
 static char *ep_parse_optional_if_clause (char **arg);
 
-static char *ep_parse_optional_filename (char **arg);
-
 static void catch_exception_command_1 (enum exception_event_kind ex_event, 
 				       char *arg, int tempflag, int from_tty);
 
@@ -7651,42 +7649,6 @@ ep_parse_optional_if_clause (char **arg)
   return cond_string;
 }
 
-/* This function attempts to parse an optional filename from the arg
-   string.  If one is not found, it returns NULL.
-
-   Else, it returns a pointer to the parsed filename.  (This function
-   makes no attempt to verify that a file of that name exists, or is
-   accessible.)  And, it updates arg to point to the first character
-   following the parsed filename in the arg string.
-
-   Note that clients needing to preserve the returned filename for
-   future access should copy it to their own buffers. */
-static char *
-ep_parse_optional_filename (char **arg)
-{
-  static char filename[1024];
-  char *arg_p = *arg;
-  int i;
-  char c;
-
-  if ((*arg_p == '\0') || isspace (*arg_p))
-    return NULL;
-
-  for (i = 0;; i++)
-    {
-      c = *arg_p;
-      if (isspace (c))
-	c = '\0';
-      filename[i] = c;
-      if (c == '\0')
-	break;
-      arg_p++;
-    }
-  *arg = arg_p;
-
-  return filename;
-}
-
 /* Commands to deal with catching events, such as signals, exceptions,
    process start/exit, etc.  */
 
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index f350742..04b665b 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -33,9 +33,6 @@
 #include "frame.h"
 #include "buildsym.h"
 
-static struct using_direct *cp_copy_usings (struct using_direct *using,
-					    struct obstack *obstack);
-
 static struct symbol *lookup_namespace_scope (const char *name,
 					      const char *linkage_name,
 					      const struct block *block,
@@ -222,36 +219,6 @@ cp_add_using (const char *dest,
   return retval;
 }
 
-/* Make a copy of the using directives in the list pointed to by
-   USING, using OBSTACK to allocate memory.  Free all memory pointed
-   to by USING via xfree.  */
-
-static struct using_direct *
-cp_copy_usings (struct using_direct *using,
-		struct obstack *obstack)
-{
-  if (using == NULL)
-    {
-      return NULL;
-    }
-  else
-    {
-      struct using_direct *retval
-	= obstack_alloc (obstack, sizeof (struct using_direct));
-      retval->import_src = obsavestring (using->import_src, strlen (using->import_src),
-				    obstack);
-      retval->import_dest = obsavestring (using->import_dest, strlen (using->import_dest),
-				    obstack);
-      retval->next = cp_copy_usings (using->next, obstack);
-
-      xfree (using->import_src);
-      xfree (using->import_dest);
-      xfree (using);
-
-      return retval;
-    }
-}
-
 /* The C++-specific version of name lookup for static and global
    names.  This makes sure that names get looked for in all namespaces
    that are in scope.  NAME is the natural name of the symbol that
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 17efddb..e1386e0 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -117,8 +117,6 @@ typedef void (block_func) (struct dcache_block *block, void *param);
 
 static struct dcache_block *dcache_hit (DCACHE *dcache, CORE_ADDR addr);
 
-static int dcache_write_line (DCACHE *dcache, struct dcache_block *db);
-
 static int dcache_read_line (DCACHE *dcache, struct dcache_block *db);
 
 static struct dcache_block *dcache_alloc (DCACHE *dcache, CORE_ADDR addr);
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 83a45eb..533eefe 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -262,7 +262,6 @@ static void create_file_handler (int fd, int mask, handler_func *proc,
 				 gdb_client_data client_data);
 static void handle_file_event (event_data data);
 static void check_async_event_handlers (void);
-static void check_async_signal_handlers (void);
 static int gdb_wait_for_event (int);
 static void poll_timers (void);
 
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 599fc69..5c9f7ac 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -43,10 +43,6 @@
 #define O_NOCTTY 0
 #endif
 
-#if defined (SIGIO) && defined (FASYNC) && defined (FD_SET) && defined (F_SETOWN)
-static void handle_sigio (int);
-#endif
-
 extern void _initialize_inflow (void);
 
 static void pass_signal (int);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 426b816..06f3ea0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -68,8 +68,6 @@ static int hook_stop_stub (void *);
 
 static int restore_selected_frame (void *);
 
-static void build_infrun (void);
-
 static int follow_fork (void);
 
 static void set_schedlock_func (char *args, int from_tty,
@@ -1856,13 +1854,14 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
      or a return command, we often end up a few instructions forward, still 
      within the original line we started.
 
-     An attempt was made to have init_execution_control_state () refresh
-     the prev_pc value before calculating the line number.  This approach
-     did not work because on platforms that use ptrace, the pc register
-     cannot be read unless the inferior is stopped.  At that point, we
-     are not guaranteed the inferior is stopped and so the regcache_read_pc ()
-     call can fail.  Setting the prev_pc value here ensures the value is 
-     updated correctly when the inferior is stopped.  */
+     An attempt was made to refresh the prev_pc at the same time the
+     execution_control_state is initialized (for instance, just before
+     waiting for an inferior event).  But this approach did not work
+     because of platforms that use ptrace, where the pc register cannot
+     be read unless the inferior is stopped.  At that point, we are not
+     guaranteed the inferior is stopped and so the regcache_read_pc() call
+     can fail.  Setting the prev_pc value here ensures the value is updated
+     correctly when the inferior is stopped.  */
   tp->prev_pc = regcache_read_pc (get_current_regcache ());
 
   /* Fill in with reasonable starting values.  */
@@ -1999,8 +1998,6 @@ struct execution_control_state
   int wait_some_more;
 };
 
-static void init_execution_control_state (struct execution_control_state *ecs);
-
 static void handle_inferior_event (struct execution_control_state *ecs);
 
 static void handle_step_into_function (struct gdbarch *gdbarch,
@@ -2403,15 +2400,6 @@ set_step_info (struct frame_info *frame, struct symtab_and_line sal)
   tp->current_line = sal.line;
 }
 
-/* Prepare an execution control state for looping through a
-   wait_for_inferior-type loop.  */
-
-static void
-init_execution_control_state (struct execution_control_state *ecs)
-{
-  ecs->random_signal = 0;
-}
-
 /* Clear context switchable stepping state.  */
 
 void
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 48ea1bc..1bbf689 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1105,25 +1105,6 @@ status_to_str (int status)
   return buf;
 }
 
-/* Initialize the list of LWPs.  Note that this module, contrary to
-   what GDB's generic threads layer does for its thread list,
-   re-initializes the LWP lists whenever we mourn or detach (which
-   doesn't involve mourning) the inferior.  */
-
-static void
-init_lwp_list (void)
-{
-  struct lwp_info *lp, *lpnext;
-
-  for (lp = lwp_list; lp; lp = lpnext)
-    {
-      lpnext = lp->next;
-      xfree (lp);
-    }
-
-  lwp_list = NULL;
-}
-
 /* Remove all LWPs belong to PID from the lwp list.  */
 
 static void
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 200f0b8..259e641 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -243,20 +243,6 @@ save_current_program_space (void)
   return old_chain;
 }
 
-/* Find program space number NUM; returns NULL if not found.  */
-
-static struct program_space *
-find_program_space_by_num (int num)
-{
-  struct program_space *pspace;
-
-  ALL_PSPACES (pspace)
-    if (pspace->num == num)
-      return pspace;
-
-  return NULL;
-}
-
 /* Returns true iff there's no inferior bound to PSPACE.  */
 
 static int
diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c
index 5d2cafe..50bc096 100644
--- a/gdb/scm-lang.c
+++ b/gdb/scm-lang.c
@@ -35,8 +35,6 @@
 #include "objfiles.h"
 
 extern void _initialize_scheme_language (void);
-static struct value *evaluate_subexp_scm (struct type *, struct expression *,
-				      int *, enum noside);
 static struct value *scm_lookup_name (struct gdbarch *, char *);
 static int in_eval_c (void);
 
diff --git a/gdb/target.c b/gdb/target.c
index 25a2cd7..161bad8 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -46,8 +46,6 @@
 
 static void target_info (char *, int);
 
-static void kill_or_be_killed (int);
-
 static void default_terminal_info (char *, int);
 
 static int default_watchpoint_addr_within_range (struct target_ops *,
@@ -73,8 +71,6 @@ static void target_command (char *, int);
 
 static struct target_ops *find_default_run_target (char *);
 
-static void nosupport_runtime (void);
-
 static LONGEST default_xfer_partial (struct target_ops *ops,
 				     enum target_object object,
 				     const char *annex, gdb_byte *readbuf,
@@ -520,48 +516,11 @@ nosymbol (char *name, CORE_ADDR *addrp)
 }
 
 static void
-nosupport_runtime (void)
-{
-  if (ptid_equal (inferior_ptid, null_ptid))
-    noprocess ();
-  else
-    error (_("No run-time support for this"));
-}
-
-
-static void
 default_terminal_info (char *args, int from_tty)
 {
   printf_unfiltered (_("No saved terminal information.\n"));
 }
 
-/* This is the default target_create_inferior and target_attach function.
-   If the current target is executing, it asks whether to kill it off.
-   If this function returns without calling error(), it has killed off
-   the target, and the operation should be attempted.  */
-
-static void
-kill_or_be_killed (int from_tty)
-{
-  if (target_has_execution)
-    {
-      printf_unfiltered (_("You are already running a program:\n"));
-      target_files_info ();
-      if (query (_("Kill it? ")))
-	{
-	  target_kill ();
-	  if (target_has_execution)
-	    error (_("Killing the program did not help."));
-	  return;
-	}
-      else
-	{
-	  error (_("Program not killed."));
-	}
-    }
-  tcomplain ();
-}
-
 /* A default implementation for the to_get_ada_task_ptid target method.
 
    This function builds the PTID by using both LWP and TID as part of
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 0dfe23c..75fa60d 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -156,7 +156,6 @@ static void trace_find_tracepoint_command (char *, int);
 static void trace_find_line_command (char *, int);
 static void trace_find_range_command (char *, int);
 static void trace_find_outside_command (char *, int);
-static void tracepoint_save_command (char *, int);
 static void trace_dump_command (char *, int);
 
 /* support routines */
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
index d61c499..3f5585c 100644
--- a/gdb/xml-syscall.c
+++ b/gdb/xml-syscall.c
@@ -354,13 +354,6 @@ xml_get_syscall_name (const struct syscalls_info *sysinfo,
   return NULL;
 }
 
-static int
-xml_number_of_syscalls (const struct syscalls_info *sysinfo)
-{
-  return (sysinfo == NULL ? 0 : VEC_length (syscall_desc_p,
-                                            sysinfo->syscalls));
-}
-
 static const char **
 xml_list_of_syscalls (const struct syscalls_info *sysinfo)
 {
-- 
1.6.3.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]