From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8238 invoked by alias); 8 Dec 2010 18:11:04 -0000 Received: (qmail 8225 invoked by uid 22791); 8 Dec 2010 18:11:02 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Dec 2010 18:10:58 +0000 Received: from wpaz5.hot.corp.google.com (wpaz5.hot.corp.google.com [172.24.198.69]) by smtp-out.google.com with ESMTP id oB8IAsvT002657 for ; Wed, 8 Dec 2010 10:10:55 -0800 Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.18.118.116]) by wpaz5.hot.corp.google.com with ESMTP id oB8IAruW029292 for ; Wed, 8 Dec 2010 10:10:54 -0800 Received: by ruffy.mtv.corp.google.com (Postfix, from userid 67641) id 9444E2461AD; Wed, 8 Dec 2010 10:10:53 -0800 (PST) To: gdb-patches@sourceware.org Subject: [commit]: dw2_expand_symtabs_with_filename: ignore type units Message-Id: <20101208181053.9444E2461AD@ruffy.mtv.corp.google.com> Date: Wed, 08 Dec 2010 18:11:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true X-IsSubscribed: yes 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: 2010-12/txt/msg00090.txt.bz2 Hi. fyi, I checked this in. A supplemental patch is to rename expand_symtabs_with_filename. expand_code_symtabs_with_filename? Let me know if you want this change too. Btw, prior to this patch "break main" on one program here expanded gdb's memory usage by 2.5G. :-) 2010-12-08 Doug Evans * symfile.h (quick_symbol_functions): Clarify usage of expand_symtabs_with_filename. * dwarf2read.c (dw2_expand_symtabs_with_filename): Only iterate over comp units, not type units. Index: symfile.h =================================================================== RCS file: /cvs/src/src/gdb/symfile.h,v retrieving revision 1.78 diff -u -p -r1.78 symfile.h --- symfile.h 24 Nov 2010 19:01:51 -0000 1.78 +++ symfile.h 8 Dec 2010 17:23:17 -0000 @@ -209,7 +209,10 @@ struct quick_symbol_functions void (*expand_all_symtabs) (struct objfile *objfile); /* Read all symbol tables associated with OBJFILE which have the - file name FILENAME. */ + file name FILENAME. + This is for the purposes of examining code only, e.g., expand_line_sal. + The routine may ignore debug info that is known to not be useful with + code, e.g., DW_TAG_type_unit for dwarf debug info. */ void (*expand_symtabs_with_filename) (struct objfile *objfile, const char *filename); Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.484 diff -u -p -r1.484 dwarf2read.c --- dwarf2read.c 8 Dec 2010 17:31:52 -0000 1.484 +++ dwarf2read.c 8 Dec 2010 17:44:00 -0000 @@ -2323,8 +2323,13 @@ dw2_expand_symtabs_with_filename (struct int i; dw2_setup (objfile); - for (i = 0; i < (dwarf2_per_objfile->n_comp_units - + dwarf2_per_objfile->n_type_comp_units); ++i) + + /* We don't need to consider type units here. + This is only called for examining code, e.g. expand_line_sal. + There can be an order of magnitude (or more) more type units + than comp units, and we avoid them if we can. */ + + for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) { int j; struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);