#include "gdb_assert.h"
#include <ctype.h>
#include "target.h"
+#include <readline/readline.h>
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
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
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;
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;
(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");
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;
/* 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.");
}