import gdb-1999-07-26 snapshot
authorJason Molenda <jmolenda@apple.com>
Tue, 27 Jul 1999 00:51:29 +0000 (00:51 +0000)
committerJason Molenda <jmolenda@apple.com>
Tue, 27 Jul 1999 00:51:29 +0000 (00:51 +0000)
gdb/ChangeLog
gdb/Makefile.in
gdb/remote.c
gdb/symfile.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/foll-exec.exp
gdb/testsuite/gdb.base/foll-fork.exp
gdb/testsuite/gdb.base/foll-vfork.exp

index 93a273fee59ed2c445904352e4fde47d92165296..8b16fcd6ce5d9b4b5fbe4e0ffda550645bc9081f 100644 (file)
@@ -1,3 +1,28 @@
+Mon Jul 26 17:13:39 1999  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * remote.c (enum packet_support, enum packet_detect, struct
+       packet_config): Define.
+       (set_packet_config_cmd, show_packet_config_cmd,
+       add_packet_config_cmd, init_packet_config): New functions.
+       Generic support for optional packets.
+       (remote_protocol_P): Replace stub_supports_P.
+       (set_remote_protocol_P_packet_cmd, show_remote_protocol_P_packet_cmd):
+       New functions.
+       (_initialize_remote): Add ``set remote-protocol-P-packet'' command.
+       (remote_open_1, remote_async_open_1, remote_cisco_open):
+       Initialize ``remote_protocol_P''.
+       (remote_store_registers): Re-write ``P'' probe logic.
+       (store_register_using_P): New function.
+
+       From Ian Lance Taylor <ian@airs.com>:
+       (remote_prepare_to_store): Only read registers when ``P'' packet
+       is in state unsupported or support-unknown.
+       
+1999-07-24  Fred Fish  <fnf@cygnus.com>
+
+        * symfile.c (default_symfile_offsets): Clear section_offsets
+        before filling it in.
+
 1999-07-16  Keith Seitz  <keiths@cygnus.com>
 
        * remote.c (_initialize_remote): "remotebreak" should be a var_boolean.
index 74aada1f23bfb6af78ae1fdd49219d2e3385c4d6..3703f46d846cbb453b56e1141a136eee74646901 100644 (file)
@@ -224,7 +224,7 @@ CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \
 ADD_FILES = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
 ADD_DEPS = $(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
 
-VERSION = 19990719
+VERSION = 19990726
 DIST=gdb
 
 LINT=/usr/5bin/lint
index 48edb1e726a18d105b843ba1fa77d34a88d53a3e..c697bd45501a832e7cc5a6b799dd3916afa5c474 100644 (file)
@@ -375,6 +375,35 @@ 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));
+
+static void set_packet_config_cmd PARAMS ((struct packet_config * config,
+                                             struct cmd_list_element * c));
+
+static void add_packet_config_cmd PARAMS ((struct packet_config * config,
+                                          char *name,
+                                          char *title,
+   void (*set_func) (char *args, int from_tty, struct cmd_list_element * c),
+                              void (*show_func) (char *name, int from_tty),
+                                          struct cmd_list_element **setlist,
+                                          struct cmd_list_element **showlist));
+
+static void init_packet_config PARAMS ((struct packet_config * config));
+
+static void set_remote_protocol_P_packet_cmd PARAMS ((char *args,
+                                                     int from_tty,
+                                             struct cmd_list_element * c));
+
+static void show_remote_protocol_P_packet_cmd PARAMS ((char *args,
+                                                      int from_tty));
+
+
+
+
 /* Define the target subroutine names */
 
 void open_remote_target PARAMS ((char *, int, struct target_ops *, int));
@@ -471,9 +500,163 @@ static int remote_address_size;
 
 static int remote_register_buf_size = 0;
 
-/* Should we try the 'P' request?  If this is set to one when the stub
-   doesn't support 'P', the only consequence is some unnecessary traffic.  */
-static int stub_supports_P = 1;
+/* Generic configuration support for packets the stub optionally
+   supports. Allows the user to specify the use of the packet as well
+   as allowing GDB to auto-detect support in the remote stub. */
+
+enum packet_support
+  {
+    PACKET_SUPPORT_UNKNOWN = 0,
+    PACKET_ENABLE,
+    PACKET_DISABLE
+  };
+
+enum packet_detect
+  {
+    PACKET_AUTO_DETECT = 0,
+    PACKET_MANUAL_DETECT
+  };
+
+struct packet_config
+  {
+    char *state;
+    char *name;
+    char *title;
+    enum packet_detect detect;
+    enum packet_support support;
+  };
+
+static char packet_support_auto[] = "auto";
+static char packet_enable[] = "enable";
+static char packet_disable[] = "disable";
+static char *packet_support_enums[] =
+{
+  packet_support_auto,
+  packet_enable,
+  packet_disable,
+  0,
+};
+
+static void
+set_packet_config_cmd (config, c)
+     struct packet_config *config;
+     struct cmd_list_element *c;
+{
+  if (config->state == packet_enable)
+    {
+      config->detect = PACKET_MANUAL_DETECT;
+      config->support = PACKET_ENABLE;
+    }
+  else if (config->state == packet_disable)
+    {
+      config->detect = PACKET_MANUAL_DETECT;
+      config->support = PACKET_DISABLE;
+    }
+  else if (config->state == packet_support_auto)
+    {
+      config->detect = PACKET_AUTO_DETECT;
+      config->support = PACKET_SUPPORT_UNKNOWN;
+    }
+  else
+    fatal ("Bad enum value");
+}
+
+static void
+show_packet_config_cmd (config)
+     struct packet_config *config;
+{
+  char *support = "internal-error";
+  switch (config->support)
+    {
+    case PACKET_ENABLE:
+      support = "enabled";
+      break;
+    case PACKET_DISABLE:
+      support = "disabled";
+      break;
+    case PACKET_SUPPORT_UNKNOWN:
+      support = "unknown";
+      break;
+    }
+  switch (config->detect)
+    {
+    case PACKET_AUTO_DETECT:
+      printf_filtered ("Support for remote protocol `%s' (%s) packet is auto-detected, currently %s.\n",
+                      config->name, config->title, support);
+      break;
+    case PACKET_MANUAL_DETECT:
+      printf_filtered ("Support for remote protocol `%s' (%s) is currently %s.\n",
+                      config->name, config->title, support);
+    }
+}
+
+static void
+add_packet_config_cmd (config, name, title, set_func, show_func,
+                      setlist, showlist)
+     struct packet_config *config;
+     char *name;
+     char *title;
+     void (*set_func) PARAMS ((char *args, int from_tty,
+                              struct cmd_list_element * c));
+     void (*show_func) PARAMS ((char *name, int from_tty));
+     struct cmd_list_element **setlist;
+     struct cmd_list_element **showlist;
+{
+  struct cmd_list_element *c;
+  char *set_doc;
+  char *show_doc;
+  char *full_name;
+  config->name = name;
+  config->title = title;
+  asprintf (&set_doc, "Set use of remote protocol `%s' (%s) packet",
+           name, title);
+  asprintf (&show_doc, "Show current use of remote protocol `%s' (%s) packet",
+           name, title);
+  asprintf (&full_name, "%s-packet", name);
+  c = add_set_enum_cmd (full_name,
+                       class_obscure, packet_support_enums,
+                       (char *) &config->state,
+                       set_doc, setlist);
+  c->function.sfunc = set_func;
+  add_cmd (full_name, class_obscure, show_func, show_doc, showlist);
+}
+
+static void
+init_packet_config (config)
+     struct packet_config *config;
+{
+  switch (config->detect)
+    {
+    case PACKET_AUTO_DETECT:
+      config->support = PACKET_SUPPORT_UNKNOWN;
+      break;
+    case PACKET_MANUAL_DETECT:
+      /* let the user beware */
+      break;
+    }
+}
+
+/* Should we try the 'P' (set register) request?  */
+
+static struct packet_config remote_protocol_P;
+
+static void
+set_remote_protocol_P_packet_cmd (args, from_tty, c)
+     char *args;
+     int from_tty;
+     struct cmd_list_element *c;
+{
+  set_packet_config_cmd (&remote_protocol_P, c);
+}
+
+static void
+show_remote_protocol_P_packet_cmd (args, from_tty)
+     char *args;
+     int from_tty;
+{
+  show_packet_config_cmd (&remote_protocol_P);
+}
+
 
 /* Tokens for use by the asynchronous signal handlers for SIGINT */
 PTR sigint_remote_twice_token;
@@ -1718,11 +1901,7 @@ serial device is attached to the remote system (e.g. /dev/ttya).");
     }
   push_target (target);                /* Switch to using remote target now */
 
-  /* Start out by trying the 'P' request to set registers.  We set
-     this each time that we open a new target so that if the user
-     switches from one stub to another, we can (if the target is
-     closed and reopened) cope.  */
-  stub_supports_P = 1;
+  init_packet_config (&remote_protocol_P);
 
   general_thread = -2;
   continue_thread = -2;
@@ -1812,11 +1991,7 @@ serial device is attached to the remote system (e.g. /dev/ttya).");
 
   push_target (target);                /* Switch to using remote target now */
 
-  /* Start out by trying the 'P' request to set registers.  We set
-     this each time that we open a new target so that if the user
-     switches from one stub to another, we can (if the target is
-     closed and reopened) cope.  */
-  stub_supports_P = 1;
+  init_packet_config (&remote_protocol_P);
 
   general_thread = -2;
   continue_thread = -2;
@@ -2735,9 +2910,45 @@ static void
 remote_prepare_to_store ()
 {
   /* Make sure the entire registers array is valid.  */
-  read_register_bytes (0, (char *) NULL, REGISTER_BYTES);
+  switch (remote_protocol_P.support)
+    {
+    case PACKET_DISABLE:
+    case PACKET_SUPPORT_UNKNOWN:
+      read_register_bytes (0, (char *) NULL, REGISTER_BYTES);
+      break;
+    case PACKET_ENABLE:
+      break;
+    }
+}
+
+/* Helper: Attempt to store REGNO using the P packet.  Return fail IFF
+   packet was not recognized. */
+
+static int
+store_register_using_P (regno)
+     int regno;
+{
+  /* Try storing a single register.  */
+  char *buf = alloca (PBUFSIZ);
+  char *regp;
+  char *p;
+  int i;
+
+  sprintf (buf, "P%x=", regno);
+  p = buf + strlen (buf);
+  regp = &registers[REGISTER_BYTE (regno)];
+  for (i = 0; i < REGISTER_RAW_SIZE (regno); ++i)
+    {
+      *p++ = tohex ((regp[i] >> 4) & 0xf);
+      *p++ = tohex (regp[i] & 0xf);
+    }
+  *p = '\0';
+  remote_send (buf);
+
+  return buf[0] != '\0';
 }
 
+
 /* Store register REGNO, or all registers if REGNO == -1, from the contents
    of REGISTERS.  FIXME: ignores errors.  */
 
@@ -2751,31 +2962,33 @@ remote_store_registers (regno)
 
   set_thread (inferior_pid, 1);
 
-  if (regno >= 0 && stub_supports_P)
+  if (regno >= 0)
     {
-      /* Try storing a single register.  */
-      char *regp;
-
-      sprintf (buf, "P%x=", regno);
-      p = buf + strlen (buf);
-      regp = &registers[REGISTER_BYTE (regno)];
-      for (i = 0; i < REGISTER_RAW_SIZE (regno); ++i)
-       {
-         *p++ = tohex ((regp[i] >> 4) & 0xf);
-         *p++ = tohex (regp[i] & 0xf);
-       }
-      *p = '\0';
-      remote_send (buf);
-      if (buf[0] != '\0')
+      switch (remote_protocol_P.support)
        {
-         /* The stub understands the 'P' request.  We are done.  */
-         return;
+       case PACKET_DISABLE:
+         break;
+       case PACKET_ENABLE:
+         if (store_register_using_P (regno))
+           return;
+         else
+           error ("Protocol error: P packet not recognized by stub");
+       case PACKET_SUPPORT_UNKNOWN:
+         if (store_register_using_P (regno))
+           {
+             /* The stub recognized the 'P' packet.  Remember this.  */
+             remote_protocol_P.support = PACKET_ENABLE;
+             return;
+           }
+         else
+           {
+             /* The stub does not support the 'P' packet.  Use 'G'
+                instead, and don't try using 'P' in the future (it
+                will just waste our time).  */
+             remote_protocol_P.support = PACKET_DISABLE;
+             break;
+           }
        }
-
-      /* The stub does not support the 'P' request.  Use 'G' instead,
-         and don't try using 'P' in the future (it will just waste our
-         time).  */
-      stub_supports_P = 0;
     }
 
   buf[0] = 'G';
@@ -4409,10 +4622,7 @@ device is attached to the remote system (e.g. host:port).");
 
   push_target (&remote_cisco_ops);     /* Switch to using cisco target now */
 
-  /* Start out by trying the 'P' request to set registers.  We set this each
-     time that we open a new target so that if the user switches from one
-     stub to another, we can (if the target is closed and reopened) cope.  */
-  stub_supports_P = 1;
+  init_packet_config (&remote_protocol_P);
 
   general_thread = -2;
   continue_thread = -2;
@@ -4772,6 +4982,15 @@ Specify the serial device it is connected to (e.g. /dev/ttya).",
   extended_async_remote_ops.to_mourn_inferior = extended_remote_mourn;
 }
 
+static void
+set_remote_cmd (args, from_tty)
+     char *args;
+     int from_tty;
+{
+  
+}
+
+
 static void
 build_remote_gdbarch_data ()
 {
@@ -4781,6 +5000,9 @@ build_remote_gdbarch_data ()
 void
 _initialize_remote ()
 {
+  static struct cmd_list_element *remote_set_cmdlist;
+  static struct cmd_list_element *remote_show_cmdlist;
+
   /* architecture specific data */
   build_remote_gdbarch_data ();
   register_gdbarch_swap (&tty_input, sizeof (&tty_input), NULL);
@@ -4809,6 +5031,19 @@ _initialize_remote ()
   init_remote_threadtests ();
 #endif
 
+  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_set_cmdlist, "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 ",
+                 0/*allow-unknown*/, &showlist);
+
   add_cmd ("compare-sections", class_obscure, compare_sections_command,
           "Compare section data on target to the exec file.\n\
 Argument is a single section name (default: all loaded sections).",
@@ -4862,4 +5097,8 @@ in a memory packet.\n",
   add_info ("remote-process", remote_info_process,
            "Query the remote system for process info.");
 
+  add_packet_config_cmd (&remote_protocol_P, "P", "set-register",
+                        set_remote_protocol_P_packet_cmd,
+                        show_remote_protocol_P_packet_cmd,
+                        &remote_set_cmdlist, &remote_show_cmdlist);
 }
index 5a9bf6374a5a70935ab72c467337f53b58b0d9ee..fcf8326ee745171cc8e6d5734f27267f3539558e 100644 (file)
@@ -471,6 +471,7 @@ default_symfile_offsets (objfile, addr)
   objfile->num_sections = SECT_OFF_MAX;
   section_offsets = (struct section_offsets *)
     obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
+  memset (section_offsets, 0, SIZEOF_SECTION_OFFSETS);
 
   for (i = 0; i < SECT_OFF_MAX; i++)
     ANOFFSET (section_offsets, i) = addr;
index acf71ac92c3bae95cfa76bc3df30a776127370c6..d0c567b3754cc29aca59524c0e2b43adfff8feab 100644 (file)
@@ -1,3 +1,8 @@
+1999-07-19  Stan Shebs  <shebs@andros.cygnus.com>
+
+       * gdb.base/foll-exec.exp, gdb.base/foll-fork.exp,
+       gdb.base/foll-vfork.exp: Don't run for crosses.
+
 Tue Jul 13 23:37:18 1999  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * gdb.base/configure.in: Check for gdbvars.exp instead of
index 4342d5f2686829c729821e3aa50b95b8968ff070..260a7d8f5d7aa50714e6dde38716f49395c5e062 100644 (file)
@@ -21,6 +21,10 @@ if $tracelevel then {
        strace $tracelevel
        }
 
+if { ![isnative] } then {
+    continue
+}
+
 set prms_id 0
 set bug_id 0
 
index 23afedd863bac13ed3a1ff801314e1acb659ade4..1433d85d8a24a2c95deccfd927103d0c662857d1 100644 (file)
@@ -21,6 +21,10 @@ if $tracelevel then {
        strace $tracelevel
        }
 
+if { ![isnative] } then {
+    continue
+}
+
 set prms_id 0
 set bug_id 0
 
index 3a6f99fb030f029dc37accfaffb84fae2a5ab4a1..b25bf56e83af88fb5a1f63db54c85869d6e64a06 100644 (file)
@@ -21,14 +21,18 @@ if $tracelevel then {
        strace $tracelevel
        }
 
-if [istarget "hppa2.0w-hp-hpux*"] {
-  warning "Don't run gdb.base/foll-vfork.exp until JAGaa43495 kernel problem is fixed."
-  return 0
+if { ![isnative] } then {
+    continue
 }
 
 set prms_id 0
 set bug_id 0
 
+if [istarget "hppa2.0w-hp-hpux*"] {
+  warning "Don't run gdb.base/foll-vfork.exp until JAGaa43495 kernel problem is fixed."
+  return 0
+}
+
 set testfile "foll-vfork"
 set testfile2 "vforked-prog"
 set srcfile ${testfile}.c
This page took 0.037211 seconds and 4 git commands to generate.