1999-04-16 09:35:26 +08:00
|
|
|
|
/* Work with executable files, for GDB.
|
2003-10-23 11:01:55 +08:00
|
|
|
|
|
2007-01-10 01:59:20 +08:00
|
|
|
|
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
|
|
|
|
|
1998, 1999, 2000, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
This file is part of GDB.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-12-18 06:34:03 +08:00
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
|
Boston, MA 02110-1301, USA. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "frame.h"
|
|
|
|
|
#include "inferior.h"
|
|
|
|
|
#include "target.h"
|
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
|
#include "language.h"
|
|
|
|
|
#include "symfile.h"
|
|
|
|
|
#include "objfiles.h"
|
2000-11-30 Fernando Nasser <fnasser@redhat.com>
* linespec.h: New file. Declarations for linespec.c.
* linespec.c, alpha-tdep.c, breakpoint.c, parse.c, source.c,
symtab.c, tracepoint.c: Include the above.
* completer.c: New file. Line completion stuff for GDB.
(get_gdb_completer_word_break_characters,
get_gdb_completer_quote_characters): New functions. Accessors for
useful completer internal data.
(filename_completer, line_completion_function, skip_quoted): Moved
here from top.c.
* completer.h: New file. Declarations for the above.
* linespec.c (decode_line_1): Use
get_gdb_completer_word_break_characters and
get_gdb_completer_quote_characters.
* top.c: Include completer.h.
(filename_completer, line_completion_function, skip_quoted):
Moved to completer.c.
* corefile.c, exec.c, source.c, symfile.c, linespec.c: Include
completer.h.
* Makefile.in (SFILES): Add completer.c.
(COMMON_OBS): Add completer.o.
(completer.o): New target.
(linespec.o, alpha-tdep.o, breakpoint.o, parse.o, source.o,
symtab.o, tracepoint.o): Add linespec.h to dependencies list.
(corefile.o, exec.o, source.o, symfile.o, linespec.o): Add completer.h
to dependencies list.
2000-12-01 08:43:47 +08:00
|
|
|
|
#include "completer.h"
|
2001-10-22 01:19:38 +08:00
|
|
|
|
#include "value.h"
|
2003-10-23 11:01:55 +08:00
|
|
|
|
#include "exec.h"
|
2005-03-08 12:34:45 +08:00
|
|
|
|
#include "observer.h"
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
#include <fcntl.h>
|
2004-02-28 Andrew Cagney <cagney@redhat.com>
* utils.c: Use "", instead of <>, to include readline.
tui/tui-win.c, tui/tui.c, tui/tui-hooks.c: Ditto.
* tracepoint.c, top.c, symmisc.c, symfile.c: Ditto.
* source.c, solib.c, exec.c, event-top.c: Ditto.
* corelow.c, completer.c, cli/cli-setshow.c: Ditto.
* cli/cli-dump.c, cli/cli-cmds.c: Ditto.
* Makefile.in: Update all dependencies.
(readline_tilde_h, readline_history_h): Define.
(readline_headers): Delete.
2004-02-29 02:04:37 +08:00
|
|
|
|
#include "readline/readline.h"
|
1999-04-16 09:35:26 +08:00
|
|
|
|
#include "gdb_string.h"
|
|
|
|
|
|
|
|
|
|
#include "gdbcore.h"
|
|
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include "gdb_stat.h"
|
|
|
|
|
|
|
|
|
|
#include "xcoffsolib.h"
|
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
|
struct vmap *map_vmap (bfd *, bfd *);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2004-04-21 Andrew Cagney <cagney@redhat.com>
* annotate.h (deprecated_annotate_starting_hook)
(deprecated_annotate_stopped_hook)
(deprecated_annotate_exited_hook)
(deprecated_annotate_signal_hook)
(deprecated_annotate_signalled_hook): Deprecate.
* tracepoint.h (deprecated_create_tracepoint_hook)
(deprecated_delete_tracepoint_hook)
(deprecated_modify_tracepoint_hook)
(deprecated_trace_find_hook)
(deprecated_trace_start_stop_hook): Deprecate.
* target.h (deprecated_target_new_objfile_hook): Deprecate.
* remote.h (deprecated_target_resume_hook)
(deprecated_target_wait_loop_hook): Deprecate.
* gdbcore.h (deprecated_exec_file_display_hook)
(deprecated_file_changed_hook): Deprecate.
* frame.h (deprecated_selected_frame_level_changed_hook): Deprecate.
* defs.h (deprecated_modify_breakpoint_hook)
(deprecated_command_loop_hook, deprecated_show_load_progress)
(deprecated_print_frame_info_listing_hook)
(deprecated_query_hook, deprecated_warning_hook)
(deprecated_flush_hook, deprecated_create_breakpoint_hook)
(deprecated_delete_breakpoint_hook)
(deprecated_interactive_hook, deprecated_registers_changed_hook)
(deprecated_readline_begin_hook, deprecated_readline_hook)
(deprecated_readline_end_hook, deprecated_register_changed_hook)
(deprecated_memory_changed_hook, deprecated_init_ui_hook)
(deprecated_context_hook, deprecated_target_wait_hook)
(deprecated_attach_hook, deprecated_detach_hook)
(deprecated_call_command_hook, deprecated_set_hook)
(deprecated_error_hook, deprecated_error_begin_hook)
(deprecated_ui_load_progress_hook): Deprecate.
* valops.c, uw-thread.c, utils.c, tui/tui-io.c: Update.
* tui/tui-hooks.c, tracepoint.c, top.c, thread-db.c: Update.
* target.c, symfile.c, stack.c, sol-thread.c, rs6000-nat.c: Update.
* remote.c, remote-mips.c, regcache.c, mi/mi-interp.c: Update.
* main.c, interps.c, infcmd.c, hpux-thread.c, frame.c: Update.
* exec.c, dsrec.c, d10v-tdep.c, corefile.c, complaints.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, breakpoint.c: Update.
* annotate.c, aix-thread.c: Update.
2004-04-22 07:52:21 +08:00
|
|
|
|
void (*deprecated_file_changed_hook) (char *);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
/* Prototypes for local functions */
|
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
|
static void exec_close (int);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
|
static void file_command (char *, int);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
|
static void set_section_command (char *, int);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
|
static void exec_files_info (struct target_ops *);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
|
static void init_exec_ops (void);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
|
void _initialize_exec (void);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
/* The target vector for executable files. */
|
|
|
|
|
|
|
|
|
|
struct target_ops exec_ops;
|
|
|
|
|
|
|
|
|
|
/* The Binary File Descriptor handle for the executable file. */
|
|
|
|
|
|
|
|
|
|
bfd *exec_bfd = NULL;
|
|
|
|
|
|
|
|
|
|
/* Whether to open exec and core files read-only or read-write. */
|
|
|
|
|
|
|
|
|
|
int write_files = 0;
|
2005-02-24 Andrew Cagney <cagney@gnu.org>
Add show_VARIABLE functions, update add_setshow call.
* varobj.c (_initialize_varobj, show_varobjdebug): Add and update.
* valprint.c (_initialize_valprint, show_print_max)
(show_stop_print_at_null, show_repeat_count_threshold)
(show_prettyprint_structs, show_unionprint)
(show_prettyprint_arrays, show_addressprint, show_input_radix)
(show_output_radix): Ditto.
* valops.c (_initialize_valops, show_overload_resolution): Ditto.
* utils.c (initialize_utils, show_chars_per_line)
(show_lines_per_page, show_demangle, show_pagination_enabled)
(show_sevenbit_strings, show_asm_demangle): Ditto
* tui/tui-win.c (_initialize_tui_win, show_tui_border_kind)
(show_tui_border_mode, show_tui_active_border_mode): Ditto.
* top.c (init_main, show_new_async_prompt)
(show_async_command_editing_p, show_write_history_p)
(show_history_size, show_history_filename, show_caution)
(show_annotation_level, init_main): Ditto.
* target.c (initialize_targets, show_targetdebug)
(show_trust_readonly): Ditto.
* symfile.c (_initialize_symfile, show_symbol_reloading)
(show_ext_args, show_download_write_size)
(show_debug_file_directory): Ditto.
* source.c (_initialize_source, show_lines_to_list): Ditto.
* solib.c (_initialize_solib, show_auto_solib_add)
(show_solib_search_path): Ditto.
* p-valprint.c (_initialize_pascal_valprint)
(show_pascal_static_field_print): Ditto.
* printcmd.c (_initialize_printcmd, show_max_symbolic_offset)
(show_print_symbol_filename): Add and update.
* parse.c (_initialize_parse, show_expressiondebug): Dito.
* observer.c (_initialize_observer, show_observer_debug): Dito.
* maint.c (_initialize_maint_cmds, show_watchdog)
(show_maintenance_profile_p): Dito.
* linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito.
* infrun.c (_initialize_infrun, show_debug_infrun)
(show_stop_on_solib_events, show_follow_fork_mode_string)
(show_scheduler_mode, show_step_stop_if_no_debug): Ditto.
* infcall.c (_initialize_infcall, show_coerce_float_to_double_p)
(show_unwind_on_signal_p): Ditto.
* gdbtypes.c (build_gdbtypes, show_opaque_type_resolution)
(_initialize_gdbtypes, show_overload_debug): Ditto.
* gdb-events.c, gdb-events.sh (_initialize_gdb_events)
(show_gdb_events_debug): Ditto.
* gdbarch.c, gdbarch.sh (show_gdbarch_debug)
(_initialize_gdbarch): Ditto.
* frame.c (_initialize_frame, show_backtrace_past_main)
(show_backtrace_past_entry, show_backtrace_limit)
(show_frame_debug): Ditto.
* exec.c (_initialize_exec, show_write_files): Ditto.
* dwarf2read.c (_initialize_dwarf2_read)
(show_dwarf2_max_cache_age): Ditto.
* demangle.c (_initialize_demangler)
(show_demangling_style_names): Ditto.
* dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto.
* cp-valprint.c (show_static_field_print)
(_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto.
* corefile.c (_initialize_core, show_gnutarget_string): Ditto.
* cli/cli-logging.c (_initialize_cli_logging)
(show_logging_overwrite, show_logging_redirect)
(show_logging_filename): Ditto.
* cli/cli-cmds.c (show_info_verbose, show_history_expansion_p)
(init_cli_cmds, show_baud_rate, show_remote_debug)
(show_remote_timeout, show_max_user_call_depth): Ditto.
* charset.c (show_host_charset_name, show_target_charset_name)
(initialize_charset): Ditto.
* breakpoint.c (show_can_use_hw_watchpoints)
(show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 21:51:36 +08:00
|
|
|
|
static void
|
|
|
|
|
show_write_files (struct ui_file *file, int from_tty,
|
|
|
|
|
struct cmd_list_element *c, const char *value)
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (file, _("Writing into executable and core files is %s.\n"),
|
|
|
|
|
value);
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
struct vmap *vmap;
|
|
|
|
|
|
2006-07-25 04:38:08 +08:00
|
|
|
|
static void
|
2001-01-27 08:43:26 +08:00
|
|
|
|
exec_open (char *args, int from_tty)
|
|
|
|
|
{
|
|
|
|
|
target_preopen (from_tty);
|
|
|
|
|
exec_file_attach (args, from_tty);
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
|
exec_close (int quitting)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
int need_symtab_cleanup = 0;
|
|
|
|
|
struct vmap *vp, *nxt;
|
1999-07-08 04:19:36 +08:00
|
|
|
|
|
|
|
|
|
for (nxt = vmap; nxt != NULL;)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
vp = nxt;
|
|
|
|
|
nxt = vp->nxt;
|
|
|
|
|
|
|
|
|
|
/* if there is an objfile associated with this bfd,
|
1999-07-08 04:19:36 +08:00
|
|
|
|
free_objfile() will do proper cleanup of objfile *and* bfd. */
|
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
if (vp->objfile)
|
|
|
|
|
{
|
|
|
|
|
free_objfile (vp->objfile);
|
|
|
|
|
need_symtab_cleanup = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (vp->bfd != exec_bfd)
|
|
|
|
|
/* FIXME-leak: We should be freeing vp->name too, I think. */
|
|
|
|
|
if (!bfd_close (vp->bfd))
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
|
warning (_("cannot close \"%s\": %s"),
|
1999-04-16 09:35:26 +08:00
|
|
|
|
vp->name, bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
|
|
|
|
|
/* FIXME: This routine is #if 0'd in symfile.c. What should we
|
1999-07-08 04:19:36 +08:00
|
|
|
|
be doing here? Should we just free everything in
|
|
|
|
|
vp->objfile->symtabs? Should free_objfile do that?
|
|
|
|
|
FIXME-as-well: free_objfile already free'd vp->name, so it isn't
|
|
|
|
|
valid here. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
free_named_symtabs (vp->name);
|
2000-12-15 09:01:51 +08:00
|
|
|
|
xfree (vp);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vmap = NULL;
|
|
|
|
|
|
|
|
|
|
if (exec_bfd)
|
|
|
|
|
{
|
|
|
|
|
char *name = bfd_get_filename (exec_bfd);
|
|
|
|
|
|
|
|
|
|
if (!bfd_close (exec_bfd))
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
|
warning (_("cannot close \"%s\": %s"),
|
1999-04-16 09:35:26 +08:00
|
|
|
|
name, bfd_errmsg (bfd_get_error ()));
|
2000-12-15 09:01:51 +08:00
|
|
|
|
xfree (name);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
exec_bfd = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (exec_ops.to_sections)
|
|
|
|
|
{
|
2000-12-15 09:01:51 +08:00
|
|
|
|
xfree (exec_ops.to_sections);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
exec_ops.to_sections = NULL;
|
|
|
|
|
exec_ops.to_sections_end = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-01-27 08:43:26 +08:00
|
|
|
|
void
|
|
|
|
|
exec_file_clear (int from_tty)
|
|
|
|
|
{
|
|
|
|
|
/* Remove exec file. */
|
|
|
|
|
unpush_target (&exec_ops);
|
|
|
|
|
|
|
|
|
|
if (from_tty)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 08:39:24 +08:00
|
|
|
|
printf_unfiltered (_("No executable file now.\n"));
|
2001-01-27 08:43:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
/* Process the first arg in ARGS as the new exec file.
|
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
This function is intended to be behave essentially the same
|
|
|
|
|
as exec_file_command, except that the latter will detect when
|
|
|
|
|
a target is being debugged, and will ask the user whether it
|
|
|
|
|
should be shut down first. (If the answer is "no", then the
|
|
|
|
|
new file is ignored.)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
This file is used by exec_file_command, to do the work of opening
|
|
|
|
|
and processing the exec file after any prompting has happened.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
And, it is used by child_attach, when the attach command was
|
|
|
|
|
given a pid but not a exec pathname, and the attach command could
|
|
|
|
|
figure out the pathname from the pid. (In this case, we shouldn't
|
|
|
|
|
ask the user whether the current target should be shut down --
|
2001-01-27 08:43:26 +08:00
|
|
|
|
we're supplying the exec pathname late for good reason.)
|
|
|
|
|
|
|
|
|
|
ARGS is assumed to be the filename. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
void
|
2001-01-27 08:43:26 +08:00
|
|
|
|
exec_file_attach (char *filename, int from_tty)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
/* Remove any previous exec file. */
|
|
|
|
|
unpush_target (&exec_ops);
|
|
|
|
|
|
|
|
|
|
/* Now open and digest the file the user requested, if any. */
|
|
|
|
|
|
2001-01-27 08:43:26 +08:00
|
|
|
|
if (!filename)
|
|
|
|
|
{
|
|
|
|
|
if (from_tty)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 08:39:24 +08:00
|
|
|
|
printf_unfiltered (_("No executable file now.\n"));
|
2006-11-11 03:20:37 +08:00
|
|
|
|
|
|
|
|
|
set_gdbarch_from_file (NULL);
|
2001-01-27 08:43:26 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
char *scratch_pathname;
|
|
|
|
|
int scratch_chan;
|
1999-07-08 04:19:36 +08:00
|
|
|
|
|
2004-07-31 03:17:20 +08:00
|
|
|
|
scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
|
1999-07-08 04:19:36 +08:00
|
|
|
|
write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY, 0,
|
1999-04-16 09:35:26 +08:00
|
|
|
|
&scratch_pathname);
|
2000-06-12 00:07:51 +08:00
|
|
|
|
#if defined(__GO32__) || defined(_WIN32) || defined(__CYGWIN__)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
if (scratch_chan < 0)
|
1999-07-08 04:19:36 +08:00
|
|
|
|
{
|
|
|
|
|
char *exename = alloca (strlen (filename) + 5);
|
|
|
|
|
strcat (strcpy (exename, filename), ".exe");
|
2004-07-31 03:17:20 +08:00
|
|
|
|
scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, exename,
|
|
|
|
|
write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY, 0,
|
|
|
|
|
&scratch_pathname);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
|
#endif
|
|
|
|
|
if (scratch_chan < 0)
|
|
|
|
|
perror_with_name (filename);
|
2005-06-14 02:39:11 +08:00
|
|
|
|
exec_bfd = bfd_fopen (scratch_pathname, gnutarget,
|
|
|
|
|
write_files ? FOPEN_RUB : FOPEN_RB,
|
|
|
|
|
scratch_chan);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (!exec_bfd)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
|
error (_("\"%s\": could not open as an executable file: %s"),
|
1999-04-16 09:35:26 +08:00
|
|
|
|
scratch_pathname, bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
|
|
|
|
|
/* At this point, scratch_pathname and exec_bfd->name both point to the
|
1999-07-08 04:19:36 +08:00
|
|
|
|
same malloc'd string. However exec_close() will attempt to free it
|
|
|
|
|
via the exec_bfd->name pointer, so we need to make another copy and
|
|
|
|
|
leave exec_bfd as the new owner of the original copy. */
|
1999-12-07 11:56:43 +08:00
|
|
|
|
scratch_pathname = xstrdup (scratch_pathname);
|
2000-12-15 09:01:51 +08:00
|
|
|
|
make_cleanup (xfree, scratch_pathname);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
if (!bfd_check_format (exec_bfd, bfd_object))
|
|
|
|
|
{
|
|
|
|
|
/* Make sure to close exec_bfd, or else "run" might try to use
|
|
|
|
|
it. */
|
|
|
|
|
exec_close (0);
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
|
error (_("\"%s\": not in executable format: %s"),
|
1999-04-16 09:35:26 +08:00
|
|
|
|
scratch_pathname, bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* FIXME - This should only be run for RS6000, but the ifdef is a poor
|
1999-07-08 04:19:36 +08:00
|
|
|
|
way to accomplish. */
|
2003-09-04 05:01:44 +08:00
|
|
|
|
#ifdef DEPRECATED_IBM6000_TARGET
|
1999-04-16 09:35:26 +08:00
|
|
|
|
/* Setup initial vmap. */
|
|
|
|
|
|
|
|
|
|
map_vmap (exec_bfd, 0);
|
|
|
|
|
if (vmap == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* Make sure to close exec_bfd, or else "run" might try to use
|
|
|
|
|
it. */
|
|
|
|
|
exec_close (0);
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
|
error (_("\"%s\": can't find the file sections: %s"),
|
1999-04-16 09:35:26 +08:00
|
|
|
|
scratch_pathname, bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
}
|
2003-09-04 05:01:44 +08:00
|
|
|
|
#endif /* DEPRECATED_IBM6000_TARGET */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (build_section_table (exec_bfd, &exec_ops.to_sections,
|
1999-07-08 04:19:36 +08:00
|
|
|
|
&exec_ops.to_sections_end))
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
/* Make sure to close exec_bfd, or else "run" might try to use
|
|
|
|
|
it. */
|
|
|
|
|
exec_close (0);
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
|
error (_("\"%s\": can't find the file sections: %s"),
|
1999-04-16 09:35:26 +08:00
|
|
|
|
scratch_pathname, bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
validate_files ();
|
|
|
|
|
|
|
|
|
|
set_gdbarch_from_file (exec_bfd);
|
|
|
|
|
|
|
|
|
|
push_target (&exec_ops);
|
|
|
|
|
|
|
|
|
|
/* Tell display code (if any) about the changed file name. */
|
2004-04-21 Andrew Cagney <cagney@redhat.com>
* annotate.h (deprecated_annotate_starting_hook)
(deprecated_annotate_stopped_hook)
(deprecated_annotate_exited_hook)
(deprecated_annotate_signal_hook)
(deprecated_annotate_signalled_hook): Deprecate.
* tracepoint.h (deprecated_create_tracepoint_hook)
(deprecated_delete_tracepoint_hook)
(deprecated_modify_tracepoint_hook)
(deprecated_trace_find_hook)
(deprecated_trace_start_stop_hook): Deprecate.
* target.h (deprecated_target_new_objfile_hook): Deprecate.
* remote.h (deprecated_target_resume_hook)
(deprecated_target_wait_loop_hook): Deprecate.
* gdbcore.h (deprecated_exec_file_display_hook)
(deprecated_file_changed_hook): Deprecate.
* frame.h (deprecated_selected_frame_level_changed_hook): Deprecate.
* defs.h (deprecated_modify_breakpoint_hook)
(deprecated_command_loop_hook, deprecated_show_load_progress)
(deprecated_print_frame_info_listing_hook)
(deprecated_query_hook, deprecated_warning_hook)
(deprecated_flush_hook, deprecated_create_breakpoint_hook)
(deprecated_delete_breakpoint_hook)
(deprecated_interactive_hook, deprecated_registers_changed_hook)
(deprecated_readline_begin_hook, deprecated_readline_hook)
(deprecated_readline_end_hook, deprecated_register_changed_hook)
(deprecated_memory_changed_hook, deprecated_init_ui_hook)
(deprecated_context_hook, deprecated_target_wait_hook)
(deprecated_attach_hook, deprecated_detach_hook)
(deprecated_call_command_hook, deprecated_set_hook)
(deprecated_error_hook, deprecated_error_begin_hook)
(deprecated_ui_load_progress_hook): Deprecate.
* valops.c, uw-thread.c, utils.c, tui/tui-io.c: Update.
* tui/tui-hooks.c, tracepoint.c, top.c, thread-db.c: Update.
* target.c, symfile.c, stack.c, sol-thread.c, rs6000-nat.c: Update.
* remote.c, remote-mips.c, regcache.c, mi/mi-interp.c: Update.
* main.c, interps.c, infcmd.c, hpux-thread.c, frame.c: Update.
* exec.c, dsrec.c, d10v-tdep.c, corefile.c, complaints.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, breakpoint.c: Update.
* annotate.c, aix-thread.c: Update.
2004-04-22 07:52:21 +08:00
|
|
|
|
if (deprecated_exec_file_display_hook)
|
|
|
|
|
(*deprecated_exec_file_display_hook) (filename);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
2004-07-30 20:05:45 +08:00
|
|
|
|
bfd_cache_close_all ();
|
2005-03-08 12:34:45 +08:00
|
|
|
|
observer_notify_executable_changed (NULL);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Process the first arg in ARGS as the new exec file.
|
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
Note that we have to explicitly ignore additional args, since we can
|
|
|
|
|
be called from file_command(), which also calls symbol_file_command()
|
2001-01-27 08:43:26 +08:00
|
|
|
|
which can take multiple args.
|
|
|
|
|
|
|
|
|
|
If ARGS is NULL, we just want to close the exec file. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2001-01-27 08:43:26 +08:00
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
|
exec_file_command (char *args, int from_tty)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
2001-01-27 08:43:26 +08:00
|
|
|
|
char **argv;
|
|
|
|
|
char *filename;
|
2006-07-25 04:38:08 +08:00
|
|
|
|
|
|
|
|
|
if (from_tty && target_has_execution
|
|
|
|
|
&& !query (_("A program is being debugged already.\n"
|
|
|
|
|
"Are you sure you want to change the file? ")))
|
|
|
|
|
error (_("File not changed."));
|
2001-01-27 08:43:26 +08:00
|
|
|
|
|
|
|
|
|
if (args)
|
|
|
|
|
{
|
|
|
|
|
/* Scan through the args and pick up the first non option arg
|
|
|
|
|
as the filename. */
|
|
|
|
|
|
|
|
|
|
argv = buildargv (args);
|
|
|
|
|
if (argv == NULL)
|
|
|
|
|
nomem (0);
|
|
|
|
|
|
|
|
|
|
make_cleanup_freeargv (argv);
|
|
|
|
|
|
|
|
|
|
for (; (*argv != NULL) && (**argv == '-'); argv++)
|
|
|
|
|
{;
|
|
|
|
|
}
|
|
|
|
|
if (*argv == NULL)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
|
error (_("No executable file name was specified"));
|
2001-01-27 08:43:26 +08:00
|
|
|
|
|
|
|
|
|
filename = tilde_expand (*argv);
|
|
|
|
|
make_cleanup (xfree, filename);
|
|
|
|
|
exec_file_attach (filename, from_tty);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
exec_file_attach (NULL, from_tty);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set both the exec file and the symbol file, in one command.
|
|
|
|
|
What a novelty. Why did GDB go through four major releases before this
|
|
|
|
|
command was added? */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
|
file_command (char *arg, int from_tty)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
/* FIXME, if we lose on reading the symbol file, we should revert
|
|
|
|
|
the exec file, but that's rough. */
|
|
|
|
|
exec_file_command (arg, from_tty);
|
|
|
|
|
symbol_file_command (arg, from_tty);
|
2004-04-21 Andrew Cagney <cagney@redhat.com>
* annotate.h (deprecated_annotate_starting_hook)
(deprecated_annotate_stopped_hook)
(deprecated_annotate_exited_hook)
(deprecated_annotate_signal_hook)
(deprecated_annotate_signalled_hook): Deprecate.
* tracepoint.h (deprecated_create_tracepoint_hook)
(deprecated_delete_tracepoint_hook)
(deprecated_modify_tracepoint_hook)
(deprecated_trace_find_hook)
(deprecated_trace_start_stop_hook): Deprecate.
* target.h (deprecated_target_new_objfile_hook): Deprecate.
* remote.h (deprecated_target_resume_hook)
(deprecated_target_wait_loop_hook): Deprecate.
* gdbcore.h (deprecated_exec_file_display_hook)
(deprecated_file_changed_hook): Deprecate.
* frame.h (deprecated_selected_frame_level_changed_hook): Deprecate.
* defs.h (deprecated_modify_breakpoint_hook)
(deprecated_command_loop_hook, deprecated_show_load_progress)
(deprecated_print_frame_info_listing_hook)
(deprecated_query_hook, deprecated_warning_hook)
(deprecated_flush_hook, deprecated_create_breakpoint_hook)
(deprecated_delete_breakpoint_hook)
(deprecated_interactive_hook, deprecated_registers_changed_hook)
(deprecated_readline_begin_hook, deprecated_readline_hook)
(deprecated_readline_end_hook, deprecated_register_changed_hook)
(deprecated_memory_changed_hook, deprecated_init_ui_hook)
(deprecated_context_hook, deprecated_target_wait_hook)
(deprecated_attach_hook, deprecated_detach_hook)
(deprecated_call_command_hook, deprecated_set_hook)
(deprecated_error_hook, deprecated_error_begin_hook)
(deprecated_ui_load_progress_hook): Deprecate.
* valops.c, uw-thread.c, utils.c, tui/tui-io.c: Update.
* tui/tui-hooks.c, tracepoint.c, top.c, thread-db.c: Update.
* target.c, symfile.c, stack.c, sol-thread.c, rs6000-nat.c: Update.
* remote.c, remote-mips.c, regcache.c, mi/mi-interp.c: Update.
* main.c, interps.c, infcmd.c, hpux-thread.c, frame.c: Update.
* exec.c, dsrec.c, d10v-tdep.c, corefile.c, complaints.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, breakpoint.c: Update.
* annotate.c, aix-thread.c: Update.
2004-04-22 07:52:21 +08:00
|
|
|
|
if (deprecated_file_changed_hook)
|
|
|
|
|
deprecated_file_changed_hook (arg);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
/* Locate all mappable sections of a BFD file.
|
|
|
|
|
table_pp_char is a char * to get it through bfd_map_over_sections;
|
|
|
|
|
we cast it back to its proper type. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-11-06 10:52:28 +08:00
|
|
|
|
add_to_section_table (bfd *abfd, struct bfd_section *asect,
|
|
|
|
|
void *table_pp_char)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
|
struct section_table **table_pp = (struct section_table **) table_pp_char;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
flagword aflag;
|
|
|
|
|
|
2007-02-10 04:11:47 +08:00
|
|
|
|
/* Check the section flags, but do not discard zero-length sections, since
|
|
|
|
|
some symbols may still be attached to this section. For instance, we
|
|
|
|
|
encountered on sparc-solaris 2.10 a shared library with an empty .bss
|
|
|
|
|
section to which a symbol named "_end" was attached. The address
|
|
|
|
|
of this symbol still needs to be relocated. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
aflag = bfd_get_section_flags (abfd, asect);
|
|
|
|
|
if (!(aflag & SEC_ALLOC))
|
|
|
|
|
return;
|
2007-02-10 04:11:47 +08:00
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
(*table_pp)->bfd = abfd;
|
|
|
|
|
(*table_pp)->the_bfd_section = asect;
|
|
|
|
|
(*table_pp)->addr = bfd_section_vma (abfd, asect);
|
|
|
|
|
(*table_pp)->endaddr = (*table_pp)->addr + bfd_section_size (abfd, asect);
|
|
|
|
|
(*table_pp)++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR.
|
|
|
|
|
Returns 0 if OK, 1 on error. */
|
|
|
|
|
|
|
|
|
|
int
|
2003-11-06 10:52:28 +08:00
|
|
|
|
build_section_table (struct bfd *some_bfd, struct section_table **start,
|
2000-07-30 09:48:28 +08:00
|
|
|
|
struct section_table **end)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
unsigned count;
|
|
|
|
|
|
|
|
|
|
count = bfd_count_sections (some_bfd);
|
|
|
|
|
if (*start)
|
2000-12-15 09:01:51 +08:00
|
|
|
|
xfree (* start);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
*start = (struct section_table *) xmalloc (count * sizeof (**start));
|
|
|
|
|
*end = *start;
|
1999-07-08 04:19:36 +08:00
|
|
|
|
bfd_map_over_sections (some_bfd, add_to_section_table, (char *) end);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
if (*end > *start + count)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-12 02:13:55 +08:00
|
|
|
|
internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
/* We could realloc the table, but it probably loses for most files. */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2003-11-06 10:52:28 +08:00
|
|
|
|
bfdsec_to_vmap (struct bfd *abfd, struct bfd_section *sect, void *arg3)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
struct vmap_and_bfd *vmap_bfd = (struct vmap_and_bfd *) arg3;
|
|
|
|
|
struct vmap *vp;
|
|
|
|
|
|
|
|
|
|
vp = vmap_bfd->pvmap;
|
|
|
|
|
|
|
|
|
|
if ((bfd_get_section_flags (abfd, sect) & SEC_LOAD) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2005-03-27 00:50:45 +08:00
|
|
|
|
if (strcmp (bfd_section_name (abfd, sect), ".text") == 0)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
vp->tstart = bfd_section_vma (abfd, sect);
|
|
|
|
|
vp->tend = vp->tstart + bfd_section_size (abfd, sect);
|
|
|
|
|
vp->tvma = bfd_section_vma (abfd, sect);
|
|
|
|
|
vp->toffs = sect->filepos;
|
|
|
|
|
}
|
2005-03-27 00:50:45 +08:00
|
|
|
|
else if (strcmp (bfd_section_name (abfd, sect), ".data") == 0)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
vp->dstart = bfd_section_vma (abfd, sect);
|
|
|
|
|
vp->dend = vp->dstart + bfd_section_size (abfd, sect);
|
|
|
|
|
vp->dvma = bfd_section_vma (abfd, sect);
|
|
|
|
|
}
|
|
|
|
|
/* Silently ignore other types of sections. (FIXME?) */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make a vmap for ABFD which might be a member of the archive ARCH.
|
|
|
|
|
Return the new vmap. */
|
|
|
|
|
|
|
|
|
|
struct vmap *
|
2000-07-30 09:48:28 +08:00
|
|
|
|
map_vmap (bfd *abfd, bfd *arch)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
struct vmap_and_bfd vmap_bfd;
|
|
|
|
|
struct vmap *vp, **vpp;
|
|
|
|
|
|
|
|
|
|
vp = (struct vmap *) xmalloc (sizeof (*vp));
|
|
|
|
|
memset ((char *) vp, '\0', sizeof (*vp));
|
|
|
|
|
vp->nxt = 0;
|
|
|
|
|
vp->bfd = abfd;
|
|
|
|
|
vp->name = bfd_get_filename (arch ? arch : abfd);
|
|
|
|
|
vp->member = arch ? bfd_get_filename (abfd) : "";
|
1999-07-08 04:19:36 +08:00
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
vmap_bfd.pbfd = arch;
|
|
|
|
|
vmap_bfd.pvmap = vp;
|
|
|
|
|
bfd_map_over_sections (abfd, bfdsec_to_vmap, &vmap_bfd);
|
|
|
|
|
|
|
|
|
|
/* Find the end of the list and append. */
|
|
|
|
|
for (vpp = &vmap; *vpp; vpp = &(*vpp)->nxt)
|
|
|
|
|
;
|
|
|
|
|
*vpp = vp;
|
|
|
|
|
|
|
|
|
|
return vp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read or write the exec file.
|
|
|
|
|
|
|
|
|
|
Args are address within a BFD file, address within gdb address-space,
|
|
|
|
|
length, and a flag indicating whether to read or write.
|
|
|
|
|
|
|
|
|
|
Result is a length:
|
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
0: We cannot handle this address and length.
|
|
|
|
|
> 0: We have handled N bytes starting at this address.
|
|
|
|
|
(If N == length, we did it all.) We might be able
|
|
|
|
|
to handle more bytes beyond this length, but no
|
|
|
|
|
promises.
|
|
|
|
|
< 0: We cannot handle this address, but if somebody
|
|
|
|
|
else handles (-N) bytes, we can start from there.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
The same routine is used to handle both core and exec files;
|
|
|
|
|
we just tail-call it with more arguments to select between them. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
int
|
2005-05-16 Andrew Cagney <cagney@gnu.org>
* target.h (target_read_partial, target_write_partial)
(do_xfer_memory, xfer_memory, target_read, target_write)
(get_target_memory): For buffers, change "void*" to gdb_byte.
(struct target_ops): Ditto for to_xfer_partial and
deprecated_xfer_memory.
* dcache.h (dcache_xfer_memory): Ditto.
* target.c (default_xfer_partial, target_read_partial)
(target_write_partial, target_read, target_write)
(do_xfer_memory, update_current_target, get_target_memory): Update.
(target_read_string): Change buf to a gdb_byte.
* dcache.c (dcache_xfer_memory): Update.
* exec.c (xfer_memory): Make buffer type to gdb_byte.
* mem-break.c (default_memory_insert_breakpoint): Remove cast.
* disasm.c (dis_asm_read_memory): Remove cast, use gdb_byte.
2005-05-16 12:45:43 +08:00
|
|
|
|
xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
|
|
|
|
|
struct mem_attrib *attrib, struct target_ops *target)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
2002-12-01 00:33:55 +08:00
|
|
|
|
int res;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
struct section_table *p;
|
|
|
|
|
CORE_ADDR nextsectaddr, memend;
|
2001-03-23 07:58:37 +08:00
|
|
|
|
asection *section = NULL;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (len <= 0)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-12 02:13:55 +08:00
|
|
|
|
internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (overlay_debugging)
|
|
|
|
|
{
|
|
|
|
|
section = find_pc_overlay (memaddr);
|
|
|
|
|
if (pc_in_unmapped_range (memaddr, section))
|
|
|
|
|
memaddr = overlay_mapped_address (memaddr, section);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memend = memaddr + len;
|
|
|
|
|
nextsectaddr = memend;
|
|
|
|
|
|
|
|
|
|
for (p = target->to_sections; p < target->to_sections_end; p++)
|
|
|
|
|
{
|
|
|
|
|
if (overlay_debugging && section && p->the_bfd_section &&
|
|
|
|
|
strcmp (section->name, p->the_bfd_section->name) != 0)
|
1999-07-08 04:19:36 +08:00
|
|
|
|
continue; /* not the section we need */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
if (memaddr >= p->addr)
|
2002-09-13 03:49:56 +08:00
|
|
|
|
{
|
|
|
|
|
if (memend <= p->endaddr)
|
|
|
|
|
{
|
|
|
|
|
/* Entire transfer is within this section. */
|
2003-11-03 22:44:08 +08:00
|
|
|
|
if (write)
|
|
|
|
|
res = bfd_set_section_contents (p->bfd, p->the_bfd_section,
|
|
|
|
|
myaddr, memaddr - p->addr,
|
|
|
|
|
len);
|
|
|
|
|
else
|
|
|
|
|
res = bfd_get_section_contents (p->bfd, p->the_bfd_section,
|
|
|
|
|
myaddr, memaddr - p->addr,
|
|
|
|
|
len);
|
2002-09-13 03:49:56 +08:00
|
|
|
|
return (res != 0) ? len : 0;
|
|
|
|
|
}
|
|
|
|
|
else if (memaddr >= p->endaddr)
|
|
|
|
|
{
|
|
|
|
|
/* This section ends before the transfer starts. */
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* This section overlaps the transfer. Just do half. */
|
|
|
|
|
len = p->endaddr - memaddr;
|
2003-11-03 22:44:08 +08:00
|
|
|
|
if (write)
|
|
|
|
|
res = bfd_set_section_contents (p->bfd, p->the_bfd_section,
|
|
|
|
|
myaddr, memaddr - p->addr,
|
|
|
|
|
len);
|
|
|
|
|
else
|
|
|
|
|
res = bfd_get_section_contents (p->bfd, p->the_bfd_section,
|
|
|
|
|
myaddr, memaddr - p->addr,
|
|
|
|
|
len);
|
2002-09-13 03:49:56 +08:00
|
|
|
|
return (res != 0) ? len : 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
|
else
|
|
|
|
|
nextsectaddr = min (nextsectaddr, p->addr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nextsectaddr >= memend)
|
1999-07-08 04:19:36 +08:00
|
|
|
|
return 0; /* We can't help */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
else
|
1999-07-08 04:19:36 +08:00
|
|
|
|
return -(nextsectaddr - memaddr); /* Next boundary where we can help */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
void
|
2000-07-30 09:48:28 +08:00
|
|
|
|
print_section_info (struct target_ops *t, bfd *abfd)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
struct section_table *p;
|
2004-09-11 18:24:53 +08:00
|
|
|
|
/* FIXME: 16 is not wide enough when TARGET_ADDR_BIT > 64. */
|
|
|
|
|
int wid = TARGET_ADDR_BIT <= 32 ? 8 : 16;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
printf_filtered ("\t`%s', ", bfd_get_filename (abfd));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
wrap_here (" ");
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 08:39:24 +08:00
|
|
|
|
printf_filtered (_("file type %s.\n"), bfd_get_target (abfd));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
if (abfd == exec_bfd)
|
|
|
|
|
{
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 08:39:24 +08:00
|
|
|
|
printf_filtered (_("\tEntry point: "));
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
* utils.c (paddress): New function.
* defs.h (paddress): Declare.
* printcmd.c (deprecated_print_address_numeric): Rename
print_address_numeric, call paddress.
* valprint.c, ui-out.c, tui/tui-stack.c, tracepoint.c: Update.
* symmisc.c, symfile.c stack.c, p-valprint.c, printcmd.c: Update.
* maint.c, m32r-rom.c, infcmd.c, f-valprint.c, exec.c: Update.
* dwarf2read.c, dve3900-rom.c, defs.h, c-valprint.c: Update.
* corefile.c, cli/cli-cmds.c, breakpoint.c, annotate.c: Update.
* ada-valprint.c: Update.
2005-02-14 22:37:38 +08:00
|
|
|
|
deprecated_print_address_numeric (bfd_get_start_address (abfd), 1, gdb_stdout);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
printf_filtered ("\n");
|
|
|
|
|
}
|
|
|
|
|
for (p = t->to_sections; p < t->to_sections_end; p++)
|
|
|
|
|
{
|
2004-09-11 18:24:53 +08:00
|
|
|
|
printf_filtered ("\t%s", hex_string_custom (p->addr, wid));
|
|
|
|
|
printf_filtered (" - %s", hex_string_custom (p->endaddr, wid));
|
2002-12-24 07:36:39 +08:00
|
|
|
|
|
|
|
|
|
/* FIXME: A format of "08l" is not wide enough for file offsets
|
|
|
|
|
larger than 4GB. OTOH, making it "016l" isn't desirable either
|
|
|
|
|
since most output will then be much wider than necessary. It
|
|
|
|
|
may make sense to test the size of the file and choose the
|
|
|
|
|
format string accordingly. */
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 08:39:24 +08:00
|
|
|
|
/* FIXME: i18n: Need to rewrite this sentence. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
if (info_verbose)
|
|
|
|
|
printf_filtered (" @ %s",
|
2004-09-11 18:24:53 +08:00
|
|
|
|
hex_string_custom (p->the_bfd_section->filepos, 8));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
printf_filtered (" is %s", bfd_section_name (p->bfd, p->the_bfd_section));
|
|
|
|
|
if (p->bfd != abfd)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 08:39:24 +08:00
|
|
|
|
printf_filtered (" in %s", bfd_get_filename (p->bfd));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
printf_filtered ("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
|
exec_files_info (struct target_ops *t)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
print_section_info (t, exec_bfd);
|
|
|
|
|
|
|
|
|
|
if (vmap)
|
|
|
|
|
{
|
|
|
|
|
struct vmap *vp;
|
|
|
|
|
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 08:39:24 +08:00
|
|
|
|
printf_unfiltered (_("\tMapping info for file `%s'.\n"), vmap->name);
|
1999-09-09 08:02:17 +08:00
|
|
|
|
printf_unfiltered ("\t %*s %*s %*s %*s %8.8s %s\n",
|
|
|
|
|
strlen_paddr (), "tstart",
|
|
|
|
|
strlen_paddr (), "tend",
|
|
|
|
|
strlen_paddr (), "dstart",
|
|
|
|
|
strlen_paddr (), "dend",
|
|
|
|
|
"section",
|
1999-07-08 04:19:36 +08:00
|
|
|
|
"file(member)");
|
|
|
|
|
|
|
|
|
|
for (vp = vmap; vp; vp = vp->nxt)
|
1999-09-09 08:02:17 +08:00
|
|
|
|
printf_unfiltered ("\t0x%s 0x%s 0x%s 0x%s %s%s%s%s\n",
|
|
|
|
|
paddr (vp->tstart),
|
|
|
|
|
paddr (vp->tend),
|
|
|
|
|
paddr (vp->dstart),
|
|
|
|
|
paddr (vp->dend),
|
|
|
|
|
vp->name,
|
1999-07-08 04:19:36 +08:00
|
|
|
|
*vp->member ? "(" : "", vp->member,
|
|
|
|
|
*vp->member ? ")" : "");
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-06-15 02:08:47 +08:00
|
|
|
|
/* msnyder 5/21/99:
|
|
|
|
|
exec_set_section_offsets sets the offsets of all the sections
|
|
|
|
|
in the exec objfile. */
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 09:48:28 +08:00
|
|
|
|
exec_set_section_offsets (bfd_signed_vma text_off, bfd_signed_vma data_off,
|
|
|
|
|
bfd_signed_vma bss_off)
|
1999-06-15 02:08:47 +08:00
|
|
|
|
{
|
|
|
|
|
struct section_table *sect;
|
1999-07-08 04:19:36 +08:00
|
|
|
|
|
|
|
|
|
for (sect = exec_ops.to_sections;
|
|
|
|
|
sect < exec_ops.to_sections_end;
|
1999-06-15 02:08:47 +08:00
|
|
|
|
sect++)
|
|
|
|
|
{
|
|
|
|
|
flagword flags;
|
|
|
|
|
|
|
|
|
|
flags = bfd_get_section_flags (exec_bfd, sect->the_bfd_section);
|
|
|
|
|
|
|
|
|
|
if (flags & SEC_CODE)
|
|
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
|
sect->addr += text_off;
|
1999-06-15 02:08:47 +08:00
|
|
|
|
sect->endaddr += text_off;
|
|
|
|
|
}
|
|
|
|
|
else if (flags & (SEC_DATA | SEC_LOAD))
|
|
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
|
sect->addr += data_off;
|
1999-06-15 02:08:47 +08:00
|
|
|
|
sect->endaddr += data_off;
|
|
|
|
|
}
|
|
|
|
|
else if (flags & SEC_ALLOC)
|
|
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
|
sect->addr += bss_off;
|
1999-06-15 02:08:47 +08:00
|
|
|
|
sect->endaddr += bss_off;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
|
set_section_command (char *args, int from_tty)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
struct section_table *p;
|
|
|
|
|
char *secname;
|
|
|
|
|
unsigned seclen;
|
|
|
|
|
unsigned long secaddr;
|
|
|
|
|
char secprint[100];
|
|
|
|
|
long offset;
|
|
|
|
|
|
|
|
|
|
if (args == 0)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
|
error (_("Must specify section name and its virtual address"));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
/* Parse out section name */
|
1999-07-08 04:19:36 +08:00
|
|
|
|
for (secname = args; !isspace (*args); args++);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
seclen = args - secname;
|
|
|
|
|
|
|
|
|
|
/* Parse out new virtual address */
|
|
|
|
|
secaddr = parse_and_eval_address (args);
|
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
|
|
|
|
|
{
|
|
|
|
|
if (!strncmp (secname, bfd_section_name (exec_bfd, p->the_bfd_section), seclen)
|
|
|
|
|
&& bfd_section_name (exec_bfd, p->the_bfd_section)[seclen] == '\0')
|
|
|
|
|
{
|
|
|
|
|
offset = secaddr - p->addr;
|
|
|
|
|
p->addr += offset;
|
|
|
|
|
p->endaddr += offset;
|
|
|
|
|
if (from_tty)
|
|
|
|
|
exec_files_info (&exec_ops);
|
|
|
|
|
return;
|
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
if (seclen >= sizeof (secprint))
|
|
|
|
|
seclen = sizeof (secprint) - 1;
|
|
|
|
|
strncpy (secprint, secname, seclen);
|
|
|
|
|
secprint[seclen] = '\0';
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
|
error (_("Section %s not found"), secprint);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
2005-06-14 00:15:40 +08:00
|
|
|
|
/* If we can find a section in FILENAME with BFD index INDEX, and the
|
|
|
|
|
user has not assigned an address to it yet (via "set section"), adjust it
|
|
|
|
|
to ADDRESS. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
exec_set_section_address (const char *filename, int index, CORE_ADDR address)
|
|
|
|
|
{
|
|
|
|
|
struct section_table *p;
|
|
|
|
|
|
|
|
|
|
for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp (filename, p->bfd->filename) == 0
|
|
|
|
|
&& index == p->the_bfd_section->index
|
|
|
|
|
&& p->addr == 0)
|
|
|
|
|
{
|
|
|
|
|
p->addr = address;
|
|
|
|
|
p->endaddr += address;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
/* If mourn is being called in all the right places, this could be say
|
|
|
|
|
`gdb internal error' (since generic_mourn calls
|
|
|
|
|
breakpoint_init_inferior). */
|
|
|
|
|
|
|
|
|
|
static int
|
gdb/
* breakpoint.c (deprecated_read_memory_nobpt): Update to use
shadow_len.
(insert_bp_location, reattach_breakpoints, remove_breakpoint)
(delete_breakpoint): Update calls to changed methods.
(deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint)
(single_step_breakpoints, insert_single_step_breakpoint)
(remove_single_step_breakpoints): New.
* breakpoint.h (struct bp_target_info): New.
(struct bp_location): Replace shadow_contents with
target_info and overlay_target_info.
(deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint)
(insert_single_step_breakpoint, remove_single_step_breakpoints): New
prototypes.
* gdbarch.sh: Forward declare struct bp_target_info in gdbarch.h.
(memory_insert_breakpoint, memory_remove_breakpoint): Update second
argument.
* mem-break.c (default_memory_insert_breakpoint): Update. Set
placed_address, placed_size, and shadow_len.
(default_memory_remove_breakpoint): Update. Don't use
BREAKPOINT_FROM_PC.
(memory_insert_breakpoint, memory_remove_breakpoint): Update.
* target.c (update_current_target): Update prototypes for changed
functions.
(debug_to_insert_breakpoint, debug_to_remove_breakpoint)
(debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint):
Update.
* target.h: Forward declare struct bp_target_info.
(struct target_ops): Use a bp_target_info argument for
to_insert_breakpoint, to_remove_breakpoint,
to_insert_hw_breakpoint, and to_remove_hw_breakpoint.
(target_insert_breakpoint, target_remove_breakpoint)
(target_insert_hw_breakpoint, target_remove_hw_breakpoint)
(memory_insert_breakpoint, memory_remove_breakpoint)
(default_memory_insert_breakpoint, default_memory_remove_breakpoint):
Update.
* config/i386/nm-i386.h: Forward declare struct bp_target_info.
(i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update.
(target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise.
* gdbarch.c, gdbarch.h: Regenerated.
* alpha-tdep.c (alpha_software_single_step): Use
insert_single_step_breakpoint and remove_single_step_breakpoints.
Remove unused statics.
* arm-tdep.c (arm_software_single_step): Likewise. Add a note.
* cris-tdep.c (cris_software_single_step): Likewise.
* mips-tdep.c (mips_software_single_step): Likewise.
* rs6000-tdep.c (rs6000_software_single_step): Likewise.
* sparc-tdep.c (sparc_software_single_step): Likewise.
* wince.c (struct thread_info_struct): Remove step_prev.
(undoSStep): Use remove_single_step_breakpoints.
(wince_software_single_step): Use insert_single_step_breakpoint.
* corelow.c (ignore): Remove unneeded prototype. Update arguments.
* exec.c (ignore): Likewise.
* sol-thread.c (ignore): Likewise.
* procfs.c (dbx_link_shadow_contents): Delete.
(dbx_link_bpt): New.
(procfs_mourn_inferior): Remove it if necessary.
(remove_dbx_link_breakpoint): Use it.
(insert_dbx_link_bpt_in_file): Set it.
(procfs_init_inferior): Don't update dbx_link_bpt_addr.
* rs6000-nat.c (exec_one_dummy_insn): Use
deprecated_insert_raw_breakpoint and
deprecated_remove_raw_breakpoint.
* solib-irix.c (shadow_contents, breakpoint_addr): Delete.
(base_breakpoint): New.
(disable_break): Use it.
(enable_break): Set it.
* i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint):
Update.
* ia64-tdep.c (ia64_memory_insert_breakpoint)
(ia64_memory_remove_breakpoint): Likewise.
* m32r-tdep.c (m32r_memory_insert_breakpoint)
(m32r_memory_remove_breakpoint): Likewise.
* monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint):
Likewise. Remove unnecessary prototypes. Use placed_address
and placed_size. Removed useless read from memory.
* nto-procfs.c (procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint): Update.
* ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise.
* ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise.
* ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise.
* ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise.
* remote-e7000.c (e7000_insert_breakpoint)
(e7000_remove_breakpoint): Likewise.
* remote-m32r-sdi.c (m32r_insert_breakpoint)
(m32r_remove_breakpoint): Likewise.
* remote-mips.c (mips_insert_breakpoint)
(mips_remove_breakpoint): Likewise.
* remote-rdp.c (remote_rdp_insert_breakpoint)
(remote_rdp_remove_breakpoint): Likewise.
(rdp_step): Use deprecated_insert_raw_breakpoint and
deprecated_remove_raw_breakpoint.
* remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint):
Update.
* remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint):
Delete.
(init_gdbsim_ops): Use memory_insert_breakpoint and
memory_remove_breakpoint.
* remote-st.c (st2000_insert_breakpoint)
(st2000_remove_breakpoint): Update. Remove unused
BREAKPOINT_FROM_PC.
* remote.c (remote_insert_breakpoint, remote_remove_breakpoint):
Update. Use placed_address and placed_size.
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise.
gdb/doc/
* gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert
and remove breakpoint prototypes.
(Watchpoints): Move description of target_insert_hw_breakpoint and
target_remove_hw_breakpoint ...
(Breakpoints): ... to here. Document target_insert_breakpoint and
target_remove_breakpoint.
2006-04-19 03:20:08 +08:00
|
|
|
|
ignore (struct bp_target_info *bp_tgt)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-09 08:37:02 +08:00
|
|
|
|
/* Find mapped memory. */
|
|
|
|
|
|
|
|
|
|
extern void
|
|
|
|
|
exec_set_find_memory_regions (int (*func) (int (*) (CORE_ADDR,
|
|
|
|
|
unsigned long,
|
|
|
|
|
int, int, int,
|
|
|
|
|
void *),
|
|
|
|
|
void *))
|
|
|
|
|
{
|
|
|
|
|
exec_ops.to_find_memory_regions = func;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char *exec_make_note_section (bfd *, int *);
|
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
/* Fill in the exec file target vector. Very few entries need to be
|
|
|
|
|
defined. */
|
|
|
|
|
|
2002-01-09 08:37:02 +08:00
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
|
init_exec_ops (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
exec_ops.to_shortname = "exec";
|
|
|
|
|
exec_ops.to_longname = "Local exec file";
|
|
|
|
|
exec_ops.to_doc = "Use an executable file as a target.\n\
|
|
|
|
|
Specify the filename of the executable file.";
|
2001-01-27 08:43:26 +08:00
|
|
|
|
exec_ops.to_open = exec_open;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
exec_ops.to_close = exec_close;
|
|
|
|
|
exec_ops.to_attach = find_default_attach;
|
2004-10-09 04:30:00 +08:00
|
|
|
|
exec_ops.deprecated_xfer_memory = xfer_memory;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
exec_ops.to_files_info = exec_files_info;
|
|
|
|
|
exec_ops.to_insert_breakpoint = ignore;
|
|
|
|
|
exec_ops.to_remove_breakpoint = ignore;
|
|
|
|
|
exec_ops.to_create_inferior = find_default_create_inferior;
|
|
|
|
|
exec_ops.to_stratum = file_stratum;
|
|
|
|
|
exec_ops.to_has_memory = 1;
|
2002-01-09 08:37:02 +08:00
|
|
|
|
exec_ops.to_make_corefile_notes = exec_make_note_section;
|
1999-07-08 04:19:36 +08:00
|
|
|
|
exec_ops.to_magic = OPS_MAGIC;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 09:48:28 +08:00
|
|
|
|
_initialize_exec (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
struct cmd_list_element *c;
|
|
|
|
|
|
|
|
|
|
init_exec_ops ();
|
|
|
|
|
|
|
|
|
|
if (!dbx_commands)
|
|
|
|
|
{
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-15 02:10:11 +08:00
|
|
|
|
c = add_cmd ("file", class_files, file_command, _("\
|
|
|
|
|
Use FILE as program to be debugged.\n\
|
1999-04-16 09:35:26 +08:00
|
|
|
|
It is read for its symbols, for getting the contents of pure memory,\n\
|
|
|
|
|
and it is the program executed when you use the `run' command.\n\
|
|
|
|
|
If FILE cannot be found as specified, your execution directory path\n\
|
|
|
|
|
($PATH) is searched for a command of that name.\n\
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-15 02:10:11 +08:00
|
|
|
|
No arg means to have no executable file and no symbols."), &cmdlist);
|
2002-03-06 14:28:35 +08:00
|
|
|
|
set_cmd_completer (c, filename_completer);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-15 02:10:11 +08:00
|
|
|
|
c = add_cmd ("exec-file", class_files, exec_file_command, _("\
|
|
|
|
|
Use FILE as program for getting contents of pure memory.\n\
|
1999-04-16 09:35:26 +08:00
|
|
|
|
If FILE cannot be found as specified, your execution directory path\n\
|
|
|
|
|
is searched for a command of that name.\n\
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-15 02:10:11 +08:00
|
|
|
|
No arg means have no executable file."), &cmdlist);
|
2002-03-06 14:28:35 +08:00
|
|
|
|
set_cmd_completer (c, filename_completer);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2005-02-15 Andrew Cagney <cagney@gnu.org>
Mark up add_com, add_info and add_prefix_cmd.
* breakpoint.c, cp-support.c, dcache.c, dwarf2read.c: Update.
* exec.c, f-valprint.c, frame.c, gcore.c, gnu-nat.c: Update.
* go32-nat.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* kod.c, language.c, linux-nat.c, m32r-rom.c, macrocmd.c: Update.
* maint.c, memattr.c, mips-tdep.c, nto-procfs.c, objc-lang.c: Update.
* ocd.c, pa64solib.c, printcmd.c, procfs.c, regcache.c: Update.
* remote-e7000.c, remote-m32r-sdi.c, remote-mips.c: Update.
* remote-sds.c, remote-sim.c, remote-st.c, remote-utils.c: Update.
* remote.c, rs6000-tdep.c, ser-go32.c, serial.c: Update.
* sh-tdep.c, solib.c, somsolib.c, source.c, stack.c: Update.
* symfile.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, typeprint.c, utils.c, valprint.c: Update.
* win32-nat.c, xcoffsolib.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-layout.c, tui/tui-regs.c: Update.
* tui/tui-stack.c, tui/tui-win.c: Update.
2005-02-15 23:49:28 +08:00
|
|
|
|
add_com ("section", class_files, set_section_command, _("\
|
|
|
|
|
Change the base address of section SECTION of the exec file to ADDR.\n\
|
1999-04-16 09:35:26 +08:00
|
|
|
|
This can be used if the exec file does not contain section addresses,\n\
|
|
|
|
|
(such as in the a.out format), or when the addresses specified in the\n\
|
|
|
|
|
file itself are wrong. Each section must be changed separately. The\n\
|
2005-02-15 Andrew Cagney <cagney@gnu.org>
Mark up add_com, add_info and add_prefix_cmd.
* breakpoint.c, cp-support.c, dcache.c, dwarf2read.c: Update.
* exec.c, f-valprint.c, frame.c, gcore.c, gnu-nat.c: Update.
* go32-nat.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* kod.c, language.c, linux-nat.c, m32r-rom.c, macrocmd.c: Update.
* maint.c, memattr.c, mips-tdep.c, nto-procfs.c, objc-lang.c: Update.
* ocd.c, pa64solib.c, printcmd.c, procfs.c, regcache.c: Update.
* remote-e7000.c, remote-m32r-sdi.c, remote-mips.c: Update.
* remote-sds.c, remote-sim.c, remote-st.c, remote-utils.c: Update.
* remote.c, rs6000-tdep.c, ser-go32.c, serial.c: Update.
* sh-tdep.c, solib.c, somsolib.c, source.c, stack.c: Update.
* symfile.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, typeprint.c, utils.c, valprint.c: Update.
* win32-nat.c, xcoffsolib.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-layout.c, tui/tui-regs.c: Update.
* tui/tui-stack.c, tui/tui-win.c: Update.
2005-02-15 23:49:28 +08:00
|
|
|
|
``info files'' command lists all the sections and their addresses."));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2005-02-18 Andrew Cagney <cagney@gnu.org>
Use add_setshow_boolean_command through out. Delete #ifdef 0'ed
code adding set/show boolean commands.
* cp-valprint.c, dcache.c, exec.c, gdbtypes.c, infrun.c: Update.
* monitor.c, p-valprint.c, pa64solib.c, printcmd.c: Update.
* proc-api.c, remote-mips.c, remote.c, solib.c: Update.
* somsolib.c, symfile.c, top.c, utils.c, valops.c: Update.
* valprint.c, win32-nat.c, wince.c, xcoffsolib.c: Update.
* cli/cli-cmds.c: Update.
2005-02-18 23:25:32 +08:00
|
|
|
|
add_setshow_boolean_cmd ("write", class_support, &write_files, _("\
|
|
|
|
|
Set writing into executable and core files."), _("\
|
|
|
|
|
Show writing into executable and core files."), NULL,
|
|
|
|
|
NULL,
|
2005-02-24 Andrew Cagney <cagney@gnu.org>
Add show_VARIABLE functions, update add_setshow call.
* varobj.c (_initialize_varobj, show_varobjdebug): Add and update.
* valprint.c (_initialize_valprint, show_print_max)
(show_stop_print_at_null, show_repeat_count_threshold)
(show_prettyprint_structs, show_unionprint)
(show_prettyprint_arrays, show_addressprint, show_input_radix)
(show_output_radix): Ditto.
* valops.c (_initialize_valops, show_overload_resolution): Ditto.
* utils.c (initialize_utils, show_chars_per_line)
(show_lines_per_page, show_demangle, show_pagination_enabled)
(show_sevenbit_strings, show_asm_demangle): Ditto
* tui/tui-win.c (_initialize_tui_win, show_tui_border_kind)
(show_tui_border_mode, show_tui_active_border_mode): Ditto.
* top.c (init_main, show_new_async_prompt)
(show_async_command_editing_p, show_write_history_p)
(show_history_size, show_history_filename, show_caution)
(show_annotation_level, init_main): Ditto.
* target.c (initialize_targets, show_targetdebug)
(show_trust_readonly): Ditto.
* symfile.c (_initialize_symfile, show_symbol_reloading)
(show_ext_args, show_download_write_size)
(show_debug_file_directory): Ditto.
* source.c (_initialize_source, show_lines_to_list): Ditto.
* solib.c (_initialize_solib, show_auto_solib_add)
(show_solib_search_path): Ditto.
* p-valprint.c (_initialize_pascal_valprint)
(show_pascal_static_field_print): Ditto.
* printcmd.c (_initialize_printcmd, show_max_symbolic_offset)
(show_print_symbol_filename): Add and update.
* parse.c (_initialize_parse, show_expressiondebug): Dito.
* observer.c (_initialize_observer, show_observer_debug): Dito.
* maint.c (_initialize_maint_cmds, show_watchdog)
(show_maintenance_profile_p): Dito.
* linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito.
* infrun.c (_initialize_infrun, show_debug_infrun)
(show_stop_on_solib_events, show_follow_fork_mode_string)
(show_scheduler_mode, show_step_stop_if_no_debug): Ditto.
* infcall.c (_initialize_infcall, show_coerce_float_to_double_p)
(show_unwind_on_signal_p): Ditto.
* gdbtypes.c (build_gdbtypes, show_opaque_type_resolution)
(_initialize_gdbtypes, show_overload_debug): Ditto.
* gdb-events.c, gdb-events.sh (_initialize_gdb_events)
(show_gdb_events_debug): Ditto.
* gdbarch.c, gdbarch.sh (show_gdbarch_debug)
(_initialize_gdbarch): Ditto.
* frame.c (_initialize_frame, show_backtrace_past_main)
(show_backtrace_past_entry, show_backtrace_limit)
(show_frame_debug): Ditto.
* exec.c (_initialize_exec, show_write_files): Ditto.
* dwarf2read.c (_initialize_dwarf2_read)
(show_dwarf2_max_cache_age): Ditto.
* demangle.c (_initialize_demangler)
(show_demangling_style_names): Ditto.
* dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto.
* cp-valprint.c (show_static_field_print)
(_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto.
* corefile.c (_initialize_core, show_gnutarget_string): Ditto.
* cli/cli-logging.c (_initialize_cli_logging)
(show_logging_overwrite, show_logging_redirect)
(show_logging_filename): Ditto.
* cli/cli-cmds.c (show_info_verbose, show_history_expansion_p)
(init_cli_cmds, show_baud_rate, show_remote_debug)
(show_remote_timeout, show_max_user_call_depth): Ditto.
* charset.c (show_host_charset_name, show_target_charset_name)
(initialize_charset): Ditto.
* breakpoint.c (show_can_use_hw_watchpoints)
(show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 21:51:36 +08:00
|
|
|
|
show_write_files,
|
2005-02-18 Andrew Cagney <cagney@gnu.org>
Use add_setshow_boolean_command through out. Delete #ifdef 0'ed
code adding set/show boolean commands.
* cp-valprint.c, dcache.c, exec.c, gdbtypes.c, infrun.c: Update.
* monitor.c, p-valprint.c, pa64solib.c, printcmd.c: Update.
* proc-api.c, remote-mips.c, remote.c, solib.c: Update.
* somsolib.c, symfile.c, top.c, utils.c, valops.c: Update.
* valprint.c, win32-nat.c, wince.c, xcoffsolib.c: Update.
* cli/cli-cmds.c: Update.
2005-02-18 23:25:32 +08:00
|
|
|
|
&setlist, &showlist);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
add_target (&exec_ops);
|
|
|
|
|
}
|
2002-01-09 08:37:02 +08:00
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
exec_make_note_section (bfd *obfd, int *note_size)
|
|
|
|
|
{
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
|
error (_("Can't create a corefile"));
|
2002-01-09 08:37:02 +08:00
|
|
|
|
}
|