OSDN Git Service

* thread-db.c (thread_db_get_gen): There's no reason to try to
authorjimb <jimb>
Wed, 20 Oct 2004 19:22:47 +0000 (19:22 +0000)
committerjimb <jimb>
Wed, 20 Oct 2004 19:22:47 +0000 (19:22 +0000)
open a thread agent until we've at least requested values for all
the symbols we know about.

rda/unix/ChangeLog
rda/unix/thread-db.c

index 1ced402..32cfcaa 100644 (file)
@@ -1,5 +1,9 @@
 2004-10-20  Jim Blandy  <jimb@redhat.com>
 
+       * thread-db.c (thread_db_get_gen): There's no reason to try to
+       open a thread agent until we've at least requested values for all
+       the symbols we know about.
+
        * server.c (usage): Don't include the entire pathname in the usage
        message.
 
index d9000fe..e010c4f 100644 (file)
@@ -1088,10 +1088,30 @@ thread_db_get_gen (struct gdbserv *serv)
            }
        }
 
+      /* If we have no more symbols to look up, try opening a thread
+        agent.  It's possible that opening an agent could succeed
+        before we have finished looking up all the symbols, but since
+        we always loop until all the symbols we know about have been
+        requested anyway, it's unnecessary.
+
+        This ensures that ps_pglobal_lookup will always succeed in
+        the case where we can obtain the full list of symbol names
+        before opening the agent; this may be a little more robust
+        than assuming it will handle all errors gracefully.
+        
+        Otherwise, if ps_pglobal_lookup fails, it will at least add
+        the missing symbol's name to the list, and we'll request
+        their values the next time around.  */
+      symbol_query = next_undefined_symbol ();
+      if (! symbol_query)
+       {
+         thread_db_open (serv, process->pid);
+         symbol_query = next_undefined_symbol ();
+       }
+
       /* Now the reply depends on whether there is another 
         symbol in need of lookup.  */
-      thread_db_open (serv, process->pid);
-      if ((symbol_query = next_undefined_symbol ()) == NULL)
+      if (! symbol_query)
        {
          gdbserv_output_string (serv, "OK");
        }