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) {
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));
{
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;
(*exec_file_display_hook) (filename);
}
else if (from_tty)
- printf_filtered ("No exec file now.\n");
+ printf ("No exec file now.\n");
}
/* Set both the exec file and the symbol file, in one command.
wanna_xfer = coredata;
}
#endif /* REG_STACK_SEGMENT */
-#endif FIXME
+#endif /* FIXME */
\f
void
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"));
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\
Specify the filename of the executable file.",
exec_file_command, exec_close, /* open, close */
- child_attach, 0, 0, 0, /* attach, detach, resume, wait, */
+ find_default_attach, 0, 0, 0, /* attach, detach, resume, wait, */
0, 0, /* fetch_registers, store_registers, */
- 0, 0, 0, /* prepare_to_store, conv_to, conv_from, */
+ 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 */
- child_create_inferior,
+ find_default_create_inferior,
0, /* mourn_inferior */
+ 0, /* can_run */
+ 0, /* notice_signals */
file_stratum, 0, /* next */
0, 1, 0, 0, 0, /* all mem, mem, stack, regs, exec */
0, 0, /* section pointers */
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\