From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27990 invoked by alias); 29 May 2014 19:49:37 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 27962 invoked by uid 48); 29 May 2014 19:49:36 -0000 From: "dje at google dot com" To: gdb-prs@sourceware.org Subject: [Bug symtab/16998] New: perf improvements for searching GLOBAL_BLOCK Date: Thu, 29 May 2014 19:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dje at google dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q2/txt/msg00334.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Bug ID: 16998 Summary: perf improvements for searching GLOBAL_BLOCK Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: symtab Assignee: unassigned at sourceware dot org Reporter: dje at google dot com This pr is a corollary to pr 16994, and is for improving searching GLOBAL_BLOCK. [I'm trying to break down the entirety of gdb symbol problems into pieces - there's just so many of them it's easier for me to keep track of them this way. Still need one more bit of information to tie them together: I was thinking of adding a "gdb-performance" "keyword".] When .gdb_index was added, it was added in a way to let it easily sit along side the psymtab implementation. Which is totally reasonable as a first pass. However, there is, I think, a performance cost. The way gdb looks up global symbols (static ones too, but this bug is about global symbols), is that it first searches already expanded symtabs and only if not found there does gdb try the "quick_symbol_functions" API. E.g., static int lookup_symbol_global_iterator_cb (struct objfile *objfile, void *cb_data) { struct global_sym_lookup_data *data = (struct global_sym_lookup_data *) cb_data; gdb_assert (data->result == NULL); =>data->result = lookup_symbol_aux_objfile (objfile, GLOBAL_BLOCK, data->name, data->domain); if (data->result == NULL) data->result = lookup_symbol_aux_quick (objfile, GLOBAL_BLOCK, data->name, data->domain); /* If we found a match, tell the iterator to stop. Otherwise, keep going. */ return (data->result != NULL); } lookup_symbol_aux_objfile does this: ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s) { bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, block_index); => sym = lookup_block_symbol (block, name, domain); if (sym) { block_found = block; return fixup_symbol_section (sym, objfile); } } Over time symtabs get expanded, so the list to iterate over here grows. But .gdb_index knows exactly which symtab(s) to look in. [for global symbols there is only one, hence the "(s)" suffix is a bit of a misnomer, but I'm leaving that aside for now] So why not just always use .gdb_index for GLOBAL_BLOCK lookups? [That's an honest question, maybe I'm missing something. Still digging.] -- You are receiving this mail because: You are on the CC list for the bug.