* cli/cli-decode.h: Don't include "gdb_regex.h"; provide a forward
[deliverable/binutils-gdb.git] / gdb / cli / cli-dump.c
index 6584d5ec409926a583e511eb6eb15d0d6c1ec1d6..7a58fcbbd7ba145f731a16da16c2c3357ddc07c0 100644 (file)
@@ -31,6 +31,7 @@
 #include "gdb_assert.h"
 #include <ctype.h>
 #include "target.h"
+#include <readline/readline.h>
 
 #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
 
@@ -360,61 +361,61 @@ dump_filetype (char *cmd, char *mode, char *filetype)
 static void
 dump_srec_memory (char *args, int from_tty)
 {
-  dump_memory_to_file (args, "w", "srec");
+  dump_memory_to_file (args, FOPEN_WB, "srec");
 }
 
 static void
 dump_srec_value (char *args, int from_tty)
 {
-  dump_value_to_file (args, "w", "srec");
+  dump_value_to_file (args, FOPEN_WB, "srec");
 }
 
 static void
 dump_ihex_memory (char *args, int from_tty)
 {
-  dump_memory_to_file (args, "w", "ihex");
+  dump_memory_to_file (args, FOPEN_WB, "ihex");
 }
 
 static void
 dump_ihex_value (char *args, int from_tty)
 {
-  dump_value_to_file (args, "w", "ihex");
+  dump_value_to_file (args, FOPEN_WB, "ihex");
 }
 
 static void
 dump_tekhex_memory (char *args, int from_tty)
 {
-  dump_memory_to_file (args, "w", "tekhex");
+  dump_memory_to_file (args, FOPEN_WB, "tekhex");
 }
 
 static void
 dump_tekhex_value (char *args, int from_tty)
 {
-  dump_value_to_file (args, "w", "tekhex");
+  dump_value_to_file (args, FOPEN_WB, "tekhex");
 }
 
 static void
 dump_binary_memory (char *args, int from_tty)
 {
-  dump_memory_to_file (args, "w", "binary");
+  dump_memory_to_file (args, FOPEN_WB, "binary");
 }
 
 static void
 dump_binary_value (char *args, int from_tty)
 {
-  dump_value_to_file (args, "w", "binary");
+  dump_value_to_file (args, FOPEN_WB, "binary");
 }
 
 static void
 append_binary_memory (char *args, int from_tty)
 {
-  dump_memory_to_file (args, "a", "binary");
+  dump_memory_to_file (args, FOPEN_AB, "binary");
 }
 
 static void
 append_binary_value (char *args, int from_tty)
 {
-  dump_value_to_file (args, "a", "binary");
+  dump_value_to_file (args, FOPEN_AB, "binary");
 }
 
 struct dump_context
@@ -442,7 +443,7 @@ add_dump_command (char *name, void (*func) (char *args, char *mode),
   c->completer =  filename_completer;
   d = XMALLOC (struct dump_context);
   d->func = func;
-  d->mode = "w";
+  d->mode = FOPEN_WB;
   set_cmd_context (c, d);
   c->func = call_dump_func;
 
@@ -450,7 +451,7 @@ add_dump_command (char *name, void (*func) (char *args, char *mode),
   c->completer =  filename_completer;
   d = XMALLOC (struct dump_context);
   d->func = func;
-  d->mode = "a";
+  d->mode = FOPEN_AB;
   set_cmd_context (c, d);
   c->func = call_dump_func;
 
@@ -527,11 +528,11 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args)
                   (unsigned long) sec_end);
 
   if (data->load_offset != 0 || data->load_start != 0 || data->load_end != 0)
-    printf_filtered (" into memory (0x%lx to 0x%lx)\n", 
-                    (unsigned long) sec_start 
-                    + sec_offset + data->load_offset
-                    (unsigned long) sec_start + sec_offset 
-                      + data->load_offset + sec_load_count);
+    printf_filtered (" into memory (0x%s to 0x%s)\n", 
+                    paddr_nz ((unsigned long) sec_start 
+                              + sec_offset + data->load_offset)
+                    paddr_nz ((unsigned long) sec_start + sec_offset 
+                      + data->load_offset + sec_load_count));
   else
     puts_filtered ("\n");
 
@@ -547,7 +548,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args)
 static void
 restore_binary_file (char *filename, struct callback_data *data)
 {
-  FILE *file = fopen_with_cleanup (filename, "r");
+  FILE *file = fopen_with_cleanup (filename, FOPEN_RB);
   int status;
   char *buf;
   long len;
@@ -623,18 +624,16 @@ restore_command (char *args, int from_tty)
       /* Parse offset (optional). */
       if (args != NULL && *args != '\0')
       data.load_offset = 
-       parse_and_eval_address (scan_expression_with_cleanup (&args, 
-                                                             NULL));
+       parse_and_eval_long (scan_expression_with_cleanup (&args, NULL));
       if (args != NULL && *args != '\0')
        {
          /* Parse start address (optional). */
          data.load_start = 
-           parse_and_eval_address (scan_expression_with_cleanup (&args, 
-                                                                 NULL));
+           parse_and_eval_long (scan_expression_with_cleanup (&args, NULL));
          if (args != NULL && *args != '\0')
            {
              /* Parse end address (optional). */
-             data.load_end = parse_and_eval_address (args);
+             data.load_end = parse_and_eval_long (args);
              if (data.load_end <= data.load_start)
                error ("Start must be less than end.");
            }
This page took 0.026983 seconds and 4 git commands to generate.