aboutsummaryrefslogtreecommitdiff
path: root/gdb/exec.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1993-09-22 15:23:53 +0000
committerStu Grossman <grossman@cygnus>1993-09-22 15:23:53 +0000
commitb1eaba9ac4cd19372b06a7abba451eb8738be0bb (patch)
treefbdd3cd19d2958a8a413833957646a7f990718ca /gdb/exec.c
parentbdb45162af47446ac76ee0d5db2ceecb1a9058a7 (diff)
downloadfsf-binutils-gdb-b1eaba9ac4cd19372b06a7abba451eb8738be0bb.zip
fsf-binutils-gdb-b1eaba9ac4cd19372b06a7abba451eb8738be0bb.tar.gz
fsf-binutils-gdb-b1eaba9ac4cd19372b06a7abba451eb8738be0bb.tar.bz2
* Makefile.in: Add i386lynx-tdep to the right places.
(TARDIRS): Add gdbserver. * exec.c (print_section_info): Print entry point. * i386lynx-nat.c (i386lynx_saved_pc_after_call): Move into i386lynx-tdep.c. Add core file support. * i386lynx-tdep.c: New module for Lynx/386 target dependant code. * maint.c: Add `maint info sections' command to print info about all sections that BFD knows about for exec and core files. * sparc-tdep.c (sparc_push_dummy_frame): Update stack pointer before putting frame on the stack. Consolidate writes to reduce traffic for remote debugging. * config/i386/i386lynx.mh (NATDEPFILES): Remove exec.o. * config/i386/i386lynx.mt (TDEPFILES): Add exec.o, i386lynx-tdep.o. * config/i386/nm-i386lynx.h: Add target_pid_to_str(). * config/i386/tm-i386lynx.h: Remove target_pid_to_str(). * sparclite/Makefile.in: Add deps to keep Sun make happy.
Diffstat (limited to 'gdb/exec.c')
-rw-r--r--gdb/exec.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/gdb/exec.c b/gdb/exec.c
index ef78097..444c89e 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -83,7 +83,9 @@ exec_close (quitting)
int quitting;
{
if (exec_bfd) {
+ char *name = bfd_get_filename (exec_bfd);
bfd_close (exec_bfd);
+ free (name);
exec_bfd = NULL;
}
if (exec_ops.to_sections) {
@@ -143,7 +145,7 @@ exec_file_command (args, from_tty)
if (scratch_chan < 0)
perror_with_name (filename);
- exec_bfd = bfd_fdopenr (scratch_pathname, NULL, scratch_chan);
+ exec_bfd = bfd_fdopenr (scratch_pathname, gnutarget, scratch_chan);
if (!exec_bfd)
error ("Could not open `%s' as an executable file: %s",
scratch_pathname, bfd_errmsg (bfd_error));
@@ -162,7 +164,7 @@ exec_file_command (args, from_tty)
{
struct section_table *p;
for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
- if (!strcmp (".text", bfd_section_name (p->bfd, p->sec_ptr)))
+ if (STREQ (".text", bfd_section_name (p->bfd, p->sec_ptr)))
{
text_start = p->addr;
text_end = p->endaddr;
@@ -341,7 +343,8 @@ print_section_info (t, abfd)
printf_filtered ("\t`%s', ", bfd_get_filename(abfd));
wrap_here (" ");
printf_filtered ("file type %s.\n", bfd_get_target(abfd));
-
+ printf_filtered ("\tEntry point: %s\n",
+ local_hex_string (bfd_get_start_address (exec_bfd)));
for (p = t->to_sections; p < t->to_sections_end; p++) {
printf_filtered ("\t%s", local_hex_string_custom (p->addr, "08"));
printf_filtered (" - %s", local_hex_string_custom (p->endaddr, "08"));
@@ -403,6 +406,17 @@ set_section_command (args, from_tty)
error ("Section %s not found", secprint);
}
+/* If mourn is being called in all the right places, this could be say
+ `gdb internal error' (since generic_mourn calls mark_breakpoints_out). */
+
+static int
+ignore (addr, contents)
+ CORE_ADDR addr;
+ char *contents;
+{
+ return 0;
+}
+
struct target_ops exec_ops = {
"exec", "Local exec file",
"Use an executable file as a target.\n\
@@ -412,7 +426,7 @@ Specify the filename of the executable file.",
0, 0, /* fetch_registers, store_registers, */
0, /* prepare_to_store, */
xfer_memory, exec_files_info,
- 0, 0, /* insert_breakpoint, remove_breakpoint, */
+ ignore, ignore, /* insert_breakpoint, remove_breakpoint, */
0, 0, 0, 0, 0, /* terminal stuff */
0, 0, /* kill, load */
0, /* lookup sym */
@@ -429,20 +443,23 @@ Specify the filename of the executable file.",
void
_initialize_exec()
{
+ struct cmd_list_element *c;
- add_com ("file", class_files, file_command,
- "Use FILE as program to be debugged.\n\
+ c = add_cmd ("file", class_files, file_command,
+ "Use FILE as program to be debugged.\n\
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\
-No arg means to have no executable file and no symbols.");
+No arg means to have no executable file and no symbols.", &cmdlist);
+ c->completer = filename_completer;
- add_com ("exec-file", class_files, exec_file_command,
+ c = add_cmd ("exec-file", class_files, exec_file_command,
"Use FILE as program for getting contents of pure memory.\n\
If FILE cannot be found as specified, your execution directory path\n\
is searched for a command of that name.\n\
-No arg means have no executable file.");
+No arg means have no executable file.", &cmdlist);
+ c->completer = filename_completer;
add_com ("section", class_files, set_section_command,
"Change the base address of section SECTION of the exec file to ADDR.\n\