From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31013 invoked by alias); 11 Sep 2008 12:48:35 -0000 Received: (qmail 31005 invoked by uid 22791); 11 Sep 2008 12:48:35 -0000 X-Spam-Check-By: sourceware.org Received: from mail72.messagelabs.com (HELO mail72.messagelabs.com) (193.109.255.147) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 11 Sep 2008 12:47:54 +0000 X-VirusChecked: Checked X-Env-Sender: francois.rigault@amadeus.com X-Msg-Ref: server-2.tower-72.messagelabs.com!1221137268!36254200!1 X-StarScan-Version: 5.5.12.14.2; banners=-,-,- Received: (qmail 20527 invoked from network); 11 Sep 2008 12:47:49 -0000 Received: from mucsmtp2.amadeus.net (HELO mucsmtp2.amadeus.net) (193.23.186.180) by server-2.tower-72.messagelabs.com with RC4-SHA encrypted SMTP; 11 Sep 2008 12:47:49 -0000 To: gdb-patches@sourceware.org Subject: [Patch] Improve path lookup of absolute source file MIME-Version: 1.0 X-Mailer: Lotus Notes Release 6.5.5 CCH1 March 07, 2006 Message-ID: From: Francois Rigault Date: Thu, 11 Sep 2008 12:48:00 -0000 Content-Type: text/plain; charset="US-ASCII" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-09/txt/msg00233.txt.bz2 When setting breakpoints on a source file using an absolute path, lookup_symtab will try to match the target source file path with each symbol file path. For each of these paths, the realpath function is called, potentially leading to a big number of IOs. On a slow IO filesystem, like a network file system, this can slow down the performances. gdb takes here 15s to complete the setting of the first breakpoint on an absolute source file path. In order to let gdb find the files without generating IOs, a simple trick is to check that symbol source file and target source file have the same basename, as source file used at compilation time and the one used for debugging are unlikely to have different basenames. See the patch below against gdb-6.8. Regards *** gdb/symtab.c Thu Sep 11 11:10:13 2008 --- gdb/symtab.c Thu Sep 11 11:31:46 2008 *************** lookup_partial_symtab (const char *name) *** 259,264 **** --- 259,270 ---- return (pst); } + /* Skip this symbol if basenames differ. */ + if (FILENAME_CMP (lbasename(name), lbasename(pst->filename)) != 0) + { + continue; + } + /* If the user gave us an absolute path, try to find the file in this symtab and use its absolute path. */ if (full_path != NULL)