From d5cd603472bb4b3c14782728aa55bbafdfe783e8 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Tue, 19 Jan 2010 09:39:12 +0000 Subject: [PATCH] Delete unused or undefined functions. * 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. * hppa-tdep.c (hppa_alignof): Delete. * mipsnbsd-tdep.c (mipsnbsd_sigtramp_offset) (mipsnbsd_core_osabi_sniffer): Delete. --- gdb/ChangeLog | 23 +++++++++++++++++++++++ gdb/ada-lang.c | 16 ---------------- gdb/breakpoint.c | 38 -------------------------------------- gdb/cp-namespace.c | 33 --------------------------------- gdb/dcache.c | 2 -- gdb/event-loop.c | 1 - gdb/hppa-tdep.c | 35 ----------------------------------- gdb/inflow.c | 4 ---- gdb/infrun.c | 28 ++++++++-------------------- gdb/linux-nat.c | 19 ------------------- gdb/mipsnbsd-tdep.c | 43 ------------------------------------------- gdb/progspace.c | 14 -------------- gdb/scm-lang.c | 2 -- gdb/target.c | 41 ----------------------------------------- gdb/tracepoint.c | 1 - gdb/xml-syscall.c | 7 ------- 16 files changed, 31 insertions(+), 276 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9382e673bf3..7aefb06c09e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,26 @@ +2010-01-19 Joel Brobecker + + Delete unused or undefined functions. + * 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. + * hppa-tdep.c (hppa_alignof): Delete. + * mipsnbsd-tdep.c (mipsnbsd_sigtramp_offset) + (mipsnbsd_core_osabi_sniffer): Delete. + 2010-01-18 Tom Tromey PR c++/9680: diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 4f77600383b..f00c06fb6a1 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -7575,22 +7575,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 058995fe70d..61c67436e14 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 f350742147f..04b665b0a6b 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 17efddbf381..e1386e0180f 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 83a45eb1db8..533eefea961 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/hppa-tdep.c b/gdb/hppa-tdep.c index 42e230d612a..a0665efdd21 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -1305,41 +1305,6 @@ hppa_write_pc (struct regcache *regcache, CORE_ADDR pc) regcache_cooked_write_unsigned (regcache, HPPA_PCOQ_TAIL_REGNUM, pc + 4); } -/* return the alignment of a type in bytes. Structures have the maximum - alignment required by their fields. */ - -static int -hppa_alignof (struct type *type) -{ - int max_align, align, i; - CHECK_TYPEDEF (type); - switch (TYPE_CODE (type)) - { - case TYPE_CODE_PTR: - case TYPE_CODE_INT: - case TYPE_CODE_FLT: - return TYPE_LENGTH (type); - case TYPE_CODE_ARRAY: - return hppa_alignof (TYPE_INDEX_TYPE (type)); - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - max_align = 1; - for (i = 0; i < TYPE_NFIELDS (type); i++) - { - /* Bit fields have no real alignment. */ - /* if (!TYPE_FIELD_BITPOS (type, i)) */ - if (!TYPE_FIELD_BITSIZE (type, i)) /* elz: this should be bitsize */ - { - align = hppa_alignof (TYPE_FIELD_TYPE (type, i)); - max_align = max (max_align, align); - } - } - return max_align; - default: - return 4; - } -} - /* For the given instruction (INST), return any adjustment it makes to the stack pointer or zero for no adjustment. diff --git a/gdb/inflow.c b/gdb/inflow.c index 599fc699753..5c9f7ac88cd 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 426b8167e65..06f3ea09dd3 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 03563cd797b..7fc95842b3a 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/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c index cbc10fae1e1..6184e586d2b 100644 --- a/gdb/mipsnbsd-tdep.c +++ b/gdb/mipsnbsd-tdep.c @@ -244,40 +244,6 @@ static const unsigned char sigtramp_retcode_mipseb[RETCODE_SIZE] = 0x00, 0x00, 0x00, 0x0c, /* syscall */ }; -static LONGEST -mipsnbsd_sigtramp_offset (struct frame_info *this_frame) -{ - CORE_ADDR pc = get_frame_pc (this_frame); - const char *retcode = gdbarch_byte_order (get_frame_arch (this_frame)) - == BFD_ENDIAN_BIG ? sigtramp_retcode_mipseb : - sigtramp_retcode_mipsel; - unsigned char ret[RETCODE_SIZE], w[4]; - LONGEST off; - int i; - - if (!safe_frame_unwind_memory (this_frame, pc, w, sizeof (w))) - return -1; - - for (i = 0; i < RETCODE_NWORDS; i++) - { - if (memcmp (w, retcode + (i * 4), 4) == 0) - break; - } - if (i == RETCODE_NWORDS) - return -1; - - off = i * 4; - pc -= off; - - if (!safe_frame_unwind_memory (this_frame, pc, ret, sizeof (ret))) - return -1; - - if (memcmp (ret, retcode, RETCODE_SIZE) == 0) - return off; - - return -1; -} - /* Figure out where the longjmp will land. We expect that we have just entered longjmp and haven't yet setup the stack frame, so the args are still in the argument regs. MIPS_A0_REGNUM points at the @@ -409,15 +375,6 @@ mipsnbsd_init_abi (struct gdbarch_info info, } -static enum gdb_osabi -mipsnbsd_core_osabi_sniffer (bfd *abfd) -{ - if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0) - return GDB_OSABI_NETBSD_ELF; - - return GDB_OSABI_UNKNOWN; -} - /* Provide a prototype to silence -Wmissing-prototypes. */ extern initialize_file_ftype _initialize_mipsnbsd_tdep; diff --git a/gdb/progspace.c b/gdb/progspace.c index 200f0b86a20..259e641d0b2 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 1d05f8a2050..5898aadad36 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 1f0a426b2b2..e6659c9aac4 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, @@ -519,49 +515,12 @@ nosymbol (char *name, CORE_ADDR *addrp) return 1; /* Symbol does not exist in target env */ } -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 6769835a7f2..73fd547d6cd 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -164,7 +164,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 d61c499e318..3f5585c65ac 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) { -- 2.30.2