From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10730 invoked by alias); 19 Oct 2004 22:19:44 -0000 Mailing-List: contact rda-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: rda-owner@sources.redhat.com Received: (qmail 10713 invoked from network); 19 Oct 2004 22:19:43 -0000 To: rda@sources.redhat.com Subject: RFA: try opening thread agent only when all symbols requested From: Jim Blandy Date: Tue, 19 Oct 2004 22:19:00 -0000 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-q4/txt/msg00019.txt.bz2 2004-10-19 Jim Blandy * 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. Index: rda/unix/thread-db.c =================================================================== RCS file: /cvs/src/src/rda/unix/thread-db.c,v retrieving revision 1.6 diff -c -r1.6 thread-db.c *** rda/unix/thread-db.c 19 Oct 2004 21:20:08 -0000 1.6 --- rda/unix/thread-db.c 19 Oct 2004 22:00:26 -0000 *************** *** 1088,1097 **** } } /* 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) { gdbserv_output_string (serv, "OK"); } --- 1088,1117 ---- } } + /* 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. */ ! if (! symbol_query) { gdbserv_output_string (serv, "OK"); }