]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/remote.c
import gdb-1999-09-13 snapshot
[thirdparty/binutils-gdb.git] / gdb / remote.c
index 263e20b4c51872fcb1fb219c0a3a2f2f087056f0..56ce7795a66d6459f6e1a4e5a633aff8d270e3cb 100644 (file)
@@ -100,6 +100,7 @@ static void remote_close PARAMS ((int quitting));
 static void remote_store_registers PARAMS ((int regno));
 
 static void remote_mourn PARAMS ((void));
+static void remote_async_mourn PARAMS ((void));
 
 static void extended_remote_restart PARAMS ((void));
 
@@ -195,9 +196,7 @@ void remote_console_output PARAMS ((char *));
 
 static void check_binary_download PARAMS ((CORE_ADDR addr));
 
-#if __STDC__
 struct packet_config;
-#endif
 
 static void show_packet_config_cmd PARAMS ((struct packet_config * config));
 
@@ -1500,13 +1499,8 @@ get_offsets ()
   if (symfile_objfile == NULL)
     return;
 
-  offs = alloca (sizeof (struct section_offsets)
-                + symfile_objfile->num_sections
-                * sizeof (offs->offsets));
-  memcpy (offs, symfile_objfile->section_offsets,
-         sizeof (struct section_offsets)
-         + symfile_objfile->num_sections
-         * sizeof (offs->offsets));
+  offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
+  memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
 
   ANOFFSET (offs, SECT_OFF_TEXT) = text_addr;
 
@@ -1593,8 +1587,10 @@ remote_cisco_section_offsets (text_addr, data_addr, bss_addr,
       sprintf_vma (tmp + strlen (tmp), bss_addr);
       fprintf_filtered (gdb_stdlog, tmp);
       fprintf_filtered (gdb_stdlog,
-                       "Reloc offset: text = 0x%x data = 0x%x bss = 0x%x\n",
-                   (long) *text_offs, (long) *data_offs, (long) *bss_offs);
+                       "Reloc offset: text = 0x%s data = 0x%s bss = 0x%s\n",
+                       paddr_nz (*text_offs),
+                       paddr_nz (*data_offs),
+                       paddr_nz (*bss_offs));
     }
 
   return 0;
@@ -1620,15 +1616,8 @@ remote_cisco_objfile_relocate (text_off, data_off, bss_off)
          broken for xcoff, dwarf, sdb-coff, etc.  But there is no
          simple canonical representation for this stuff.  */
 
-      offs = ((struct section_offsets *)
-             alloca (sizeof (struct section_offsets)
-                     + (symfile_objfile->num_sections
-                        * sizeof (offs->offsets))));
-
-      memcpy (offs, symfile_objfile->section_offsets,
-             (sizeof (struct section_offsets)
-              + (symfile_objfile->num_sections
-                 * sizeof (offs->offsets))));
+      offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
+      memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
 
       ANOFFSET (offs, SECT_OFF_TEXT) = text_off;
       ANOFFSET (offs, SECT_OFF_DATA) = data_off;
@@ -2390,7 +2379,7 @@ Packet: '%s'\n",
 
            if (symfile_objfile == NULL)
              {
-               warning ("Relocation packet recieved with no symbol file.  \
+               warning ("Relocation packet received with no symbol file.  \
 Packet Dropped");
                goto got_status;
              }
@@ -3454,7 +3443,7 @@ putpkt_binary (buf, cnt)
          *p = '\0';
          fprintf_unfiltered (gdb_stdlog, "Sending packet: ");
          fputstrn_unfiltered (buf2, p - buf2, 0, gdb_stdlog);
-         fprintf_unfiltered (gdb_stdlog, "...", buf2);
+         fprintf_unfiltered (gdb_stdlog, "...");
          gdb_flush (gdb_stdlog);
        }
       if (SERIAL_WRITE (remote_desc, buf2, p - buf2))
@@ -3793,6 +3782,12 @@ remote_mourn ()
   remote_mourn_1 (&remote_ops);
 }
 
+static void
+remote_async_mourn ()
+{
+  remote_mourn_1 (&remote_async_ops);
+}
+
 static void
 extended_remote_mourn ()
 {
@@ -3989,7 +3984,6 @@ remote_remove_breakpoint (addr, contents_cache)
      CORE_ADDR addr;
      char *contents_cache;
 {
-  char buf[PBUFSIZ];
   int bp_size;
 
   if ((remote_protocol_Z.support == PACKET_ENABLE)
@@ -4035,7 +4029,7 @@ remote_insert_watchpoint (addr, len, type)
   p = strchr (buf, '\0');
   addr = remote_address_masked (addr);
   p += hexnumstr (p, (ULONGEST) addr);
-  sprintf (p, ",%lx", len);
+  sprintf (p, ",%x", len);
   
   putpkt (buf);
   getpkt (buf, 0);
@@ -4058,7 +4052,7 @@ remote_remove_watchpoint (addr, len, type)
   p = strchr (buf, '\0');
   addr = remote_address_masked (addr);
   p += hexnumstr (p, (ULONGEST) addr);
-  sprintf (p, ",%lx", len);
+  sprintf (p, ",%x", len);
   putpkt (buf);
   getpkt (buf, 0);
 
@@ -4253,8 +4247,8 @@ compare_sections_command (args, from_tty)
       for (target_crc = 0, tmp = &buf[1]; *tmp; tmp++)
        target_crc = target_crc * 16 + fromhex (*tmp);
 
-      printf_filtered ("Section %s, range 0x%08x -- 0x%08x: ",
-                      sectname, lma, lma + size);
+      printf_filtered ("Section %s, range 0x%s -- 0x%s: ",
+                      sectname, paddr (lma), paddr (lma + size));
       if (host_crc == target_crc)
        printf_filtered ("matched.\n");
       else
@@ -4282,7 +4276,6 @@ remote_query (query_type, buf, outbuf, bufsiz)
   int i;
   char *buf2 = alloca (PBUFSIZ);
   char *p2 = &buf2[0];
-  char *p = buf;
 
   if (!bufsiz)
     error ("null pointer to remote bufer size specified");
@@ -4872,7 +4865,6 @@ readsocket ()
 static int
 readtty ()
 {
-  int status;
   int tty_bytecount;
 
   /* First, read a buffer full from the terminal */
@@ -5068,7 +5060,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).";
   remote_async_ops.to_remove_breakpoint = remote_remove_breakpoint;
   remote_async_ops.to_kill = remote_async_kill;
   remote_async_ops.to_load = generic_load;
-  remote_async_ops.to_mourn_inferior = remote_mourn;
+  remote_async_ops.to_mourn_inferior = remote_async_mourn;
   remote_async_ops.to_thread_alive = remote_thread_alive;
   remote_async_ops.to_find_new_threads = remote_threads_info;
   remote_async_ops.to_stop = remote_stop;
@@ -5157,13 +5149,13 @@ _initialize_remote ()
 Remote protocol specific variables\n\
 Configure various remote-protocol specific variables such as\n\
 the packets being used",
-                 &remote_set_cmdlist, "remote ",
+                 &remote_set_cmdlist, "set remote ",
                  0/*allow-unknown*/, &setlist);
   add_prefix_cmd ("remote", class_maintenance, set_remote_cmd, "\
 Remote protocol specific variables\n\
 Configure various remote-protocol specific variables such as\n\
 the packets being used",
-                 &remote_show_cmdlist, "remote ",
+                 &remote_show_cmdlist, "show remote ",
                  0/*allow-unknown*/, &showlist);
 
   add_cmd ("compare-sections", class_obscure, compare_sections_command,