Cleanup bfd_close() cleanups.
[deliverable/binutils-gdb.git] / gdb / remote-array.c
index 62a15d33665fffa1847101d14f7dc18b31576ebd..5ee67c7378c180a0f4261b0cda244e66b033cace 100644 (file)
 #include "defs.h"
 #include "gdbcore.h"
 #include "target.h"
-#include "wait.h"
-#ifdef ANSI_PROTOTYPES
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
+#include "gdb_wait.h"
 #include <ctype.h>
 #include <signal.h>
 #include <sys/types.h>
@@ -42,6 +37,8 @@
 #include "serial.h"
 #include "monitor.h"
 #include "remote-utils.h"
+#include "inferior.h"
+#include "version.h"
 
 extern int baud_rate;
 
@@ -93,8 +90,6 @@ static int array_get_packet ();
 static unsigned long ascii2hexword ();
 static void hexword2ascii ();
 
-extern char *version;
-
 #define LOG_FILE "monitor.log"
 #if defined (LOG_FILE)
 FILE *log_file;
@@ -200,24 +195,13 @@ Specify the serial device it is connected to (e.g. /dev/ttya).";
  * printf_monitor -- send data to monitor.  Works just like printf.
  */
 static void
-#ifdef ANSI_PROTOTYPES
 printf_monitor (char *pattern,...)
-#else
-printf_monitor (va_alist)
-     va_dcl
-#endif
 {
   va_list args;
   char buf[PBUFSIZ];
   int i;
 
-#ifdef ANSI_PROTOTYPES
   va_start (args, pattern);
-#else
-  char *pattern;
-  va_start (args);
-  pattern = va_arg (args, char *);
-#endif
 
   vsprintf (buf, pattern, args);
 
@@ -251,12 +235,7 @@ write_monitor (data, len)
  *      to be formatted and printed. A CR is added after each string is printed.
  */
 static void
-#ifdef ANSI_PROTOTYPES
 debuglogs (int level, char *pattern,...)
-#else
-debuglogs (va_alist)
-     va_dcl
-#endif
 {
   va_list args;
   char *p;
@@ -264,15 +243,7 @@ debuglogs (va_alist)
   char newbuf[PBUFSIZ];
   int i;
 
-#ifdef ANSI_PROTOTYPES
   va_start (args, pattern);
-#else
-  char *pattern;
-  int level;
-  va_start (args);
-  level = va_arg (args, int);  /* get the debug level */
-  pattern = va_arg (args, char *);     /* get the printf style pattern */
-#endif
 
   if ((level < 0) || (level > 100))
     {
@@ -654,7 +625,7 @@ array_open (args, name, from_tty)
   log_file = fopen (LOG_FILE, "w");
   if (log_file == NULL)
     perror_with_name (LOG_FILE);
-  fprintf (log_file, "GDB %s (%s", version);
+  fprintf (log_file, "GDB %s (%s", version, host_name);
   fprintf (log_file, " --target %s)\n", array_ops.to_shortname);
   fprintf (log_file, "Remote target %s connected to %s\n\n", array_ops.to_shortname, dev_name);
 #endif
@@ -1054,7 +1025,7 @@ array_read_inferior_memory (memaddr, myaddr, len)
       /* Fetch the bytes */
       debuglogs (3, "read %d bytes from inferior address %x", len_this_pass,
                 startaddr);
-      sprintf (buf, "m%08x,%04x", startaddr, len_this_pass);
+      sprintf (buf, "m%08lx,%04x", startaddr, len_this_pass);
       make_gdb_packet (packet, buf);
       if (array_send_packet (packet) == 0)
        {
@@ -1141,7 +1112,7 @@ array_insert_breakpoint (addr, shadow)
        {
          breakaddr[i] = addr;
          if (sr_get_debug () > 4)
-           printf ("Breakpoint at %x\n", addr);
+           printf ("Breakpoint at %s\n", paddr_nz (addr));
          array_read_inferior_memory (bp_addr, shadow, bp_size);
          printf_monitor ("b 0x%x\n", addr);
          expect_prompt (1);
@@ -1176,7 +1147,8 @@ array_remove_breakpoint (addr, shadow)
          return 0;
        }
     }
-  fprintf (stderr, "Can't find breakpoint associated with 0x%x\n", addr);
+  fprintf (stderr, "Can't find breakpoint associated with 0x%s\n",
+          paddr_nz (addr));
   return 1;
 }
 
This page took 0.02474 seconds and 4 git commands to generate.