2005-05-16 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / exec.c
index 2b6b0941e7f894d951278b65251b171d21ef4cf6..938b106adefd0f4f5c60cca0e964dfe128231fa0 100644 (file)
@@ -32,6 +32,7 @@
 #include "completer.h"
 #include "value.h"
 #include "exec.h"
+#include "observer.h"
 
 #include <fcntl.h>
 #include "readline/readline.h"
@@ -61,7 +62,7 @@ static void set_section_command (char *, int);
 
 static void exec_files_info (struct target_ops *);
 
-static int ignore (CORE_ADDR, char *);
+static int ignore (CORE_ADDR, bfd_byte *);
 
 static void init_exec_ops (void);
 
@@ -78,6 +79,14 @@ bfd *exec_bfd = NULL;
 /* Whether to open exec and core files read-only or read-write.  */
 
 int write_files = 0;
+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);
+}
+
 
 struct vmap *vmap;
 
@@ -150,7 +159,7 @@ exec_file_clear (int from_tty)
   unpush_target (&exec_ops);
 
   if (from_tty)
-    printf_unfiltered ("No executable file now.\n");
+    printf_unfiltered (_("No executable file now.\n"));
 }
 
 /*  Process the first arg in ARGS as the new exec file.
@@ -183,7 +192,7 @@ exec_file_attach (char *filename, int from_tty)
   if (!filename)
     {
       if (from_tty)
-        printf_unfiltered ("No executable file now.\n");
+        printf_unfiltered (_("No executable file now.\n"));
     }
   else
     {
@@ -268,6 +277,7 @@ exec_file_attach (char *filename, int from_tty)
        (*deprecated_exec_file_display_hook) (filename);
     }
   bfd_cache_close_all ();
+  observer_notify_executable_changed (NULL);
 }
 
 /*  Process the first arg in ARGS as the new exec file.
@@ -382,14 +392,14 @@ bfdsec_to_vmap (struct bfd *abfd, struct bfd_section *sect, void *arg3)
   if ((bfd_get_section_flags (abfd, sect) & SEC_LOAD) == 0)
     return;
 
-  if (DEPRECATED_STREQ (bfd_section_name (abfd, sect), ".text"))
+  if (strcmp (bfd_section_name (abfd, sect), ".text") == 0)
     {
       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;
     }
-  else if (DEPRECATED_STREQ (bfd_section_name (abfd, sect), ".data"))
+  else if (strcmp (bfd_section_name (abfd, sect), ".data") == 0)
     {
       vp->dstart = bfd_section_vma (abfd, sect);
       vp->dend = vp->dstart + bfd_section_size (abfd, sect);
@@ -445,9 +455,8 @@ map_vmap (bfd *abfd, bfd *arch)
    we just tail-call it with more arguments to select between them.  */
 
 int
-xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-            struct mem_attrib *attrib,
-            struct target_ops *target)
+xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
+            struct mem_attrib *attrib, struct target_ops *target)
 {
   int res;
   struct section_table *p;
@@ -527,11 +536,11 @@ print_section_info (struct target_ops *t, bfd *abfd)
 
   printf_filtered ("\t`%s', ", bfd_get_filename (abfd));
   wrap_here ("        ");
-  printf_filtered ("file type %s.\n", bfd_get_target (abfd));
+  printf_filtered (_("file type %s.\n"), bfd_get_target (abfd));
   if (abfd == exec_bfd)
     {
-      printf_filtered ("\tEntry point: ");
-      print_address_numeric (bfd_get_start_address (abfd), 1, gdb_stdout);
+      printf_filtered (_("\tEntry point: "));
+      deprecated_print_address_numeric (bfd_get_start_address (abfd), 1, gdb_stdout);
       printf_filtered ("\n");
     }
   for (p = t->to_sections; p < t->to_sections_end; p++)
@@ -544,14 +553,13 @@ print_section_info (struct target_ops *t, bfd *abfd)
         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.  */
+      /* FIXME: i18n: Need to rewrite this sentence.  */
       if (info_verbose)
        printf_filtered (" @ %s",
                         hex_string_custom (p->the_bfd_section->filepos, 8));
       printf_filtered (" is %s", bfd_section_name (p->bfd, p->the_bfd_section));
       if (p->bfd != abfd)
-       {
-         printf_filtered (" in %s", bfd_get_filename (p->bfd));
-       }
+       printf_filtered (" in %s", bfd_get_filename (p->bfd));
       printf_filtered ("\n");
     }
 }
@@ -565,7 +573,7 @@ exec_files_info (struct target_ops *t)
     {
       struct vmap *vp;
 
-      printf_unfiltered ("\tMapping info for file `%s'.\n", vmap->name);
+      printf_unfiltered (_("\tMapping info for file `%s'.\n"), vmap->name);
       printf_unfiltered ("\t  %*s   %*s   %*s   %*s %8.8s %s\n",
                         strlen_paddr (), "tstart",
                         strlen_paddr (), "tend",
@@ -667,7 +675,7 @@ set_section_command (char *args, int from_tty)
    breakpoint_init_inferior).  */
 
 static int
-ignore (CORE_ADDR addr, char *contents)
+ignore (CORE_ADDR addr, bfd_byte *contents)
 {
   return 0;
 }
@@ -719,35 +727,36 @@ _initialize_exec (void)
 
   if (!dbx_commands)
     {
-      c = add_cmd ("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.", &cmdlist);
+No arg means to have no executable file and no symbols."), &cmdlist);
       set_cmd_completer (c, filename_completer);
     }
 
-  c = add_cmd ("exec-file", class_files, exec_file_command,
-              "Use FILE as program for getting contents of pure memory.\n\
+  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.", &cmdlist);
+No arg means have no executable file."), &cmdlist);
   set_cmd_completer (c, filename_completer);
 
-  add_com ("section", class_files, set_section_command,
-          "Change the base address of section SECTION of the exec file to ADDR.\n\
+  add_com ("section", class_files, set_section_command, _("\
+Change the base address of section SECTION of the exec file to ADDR.\n\
 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\
-``info files'' command lists all the sections and their addresses.");
-
-  deprecated_add_show_from_set
-    (add_set_cmd ("write", class_support, var_boolean, (char *) &write_files,
-                 "Set writing into executable and core files.",
-                 &setlist),
-     &showlist);
+``info files'' command lists all the sections and their addresses."));
+
+  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,
+                          show_write_files,
+                          &setlist, &showlist);
 
   add_target (&exec_ops);
 }
This page took 0.028539 seconds and 4 git commands to generate.