public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "xdje42 at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/17687] New: linear search in cp_add_using_directive
Date: Sun, 07 Dec 2014 22:29:00 -0000	[thread overview]
Message-ID: <bug-17687-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=17687

            Bug ID: 17687
           Summary: linear search in cp_add_using_directive
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: xdje42 at gmail dot com

Filing this to remember a potential perf issue.

I noticed this while debugging another issue.
I had set a breakpoint on cp_add_using_directive and saw it being called once
for each symbol thusly:

(top-gdb) c
Continuing.

Breakpoint 3, cp_add_using_directive (dest=0x7ffff0659462 "std",
    src=0x866f92 "", alias=0x0, declaration=0x7ffff05f5eb1 "clearerr",
    excludes=0x0, copy_names=0, obstack=0x16285f0)
    at ../../anon-ns-16874/gdb/cp-namespace.c:139
(top-gdb) 
Continuing.

Breakpoint 3, cp_add_using_directive (dest=0x7ffff0659462 "std",
    src=0x866f92 "", alias=0x0, declaration=0x7ffff05f71ce "fclose",
    excludes=0x0, copy_names=0, obstack=0x16285f0)
    at ../../anon-ns-16874/gdb/cp-namespace.c:139
(top-gdb) 
Continuing.

Breakpoint 3, cp_add_using_directive (dest=0x7ffff0659462 "std",
    src=0x866f92 "", alias=0x0, declaration=0x7ffff05f97dd "feof",
    excludes=0x0, copy_names=0, obstack=0x16285f0)
    at ../../anon-ns-16874/gdb/cp-namespace.c:139
(top-gdb) 
Continuing.

Breakpoint 3, cp_add_using_directive (dest=0x7ffff0659462 "std",
    src=0x866f92 "", alias=0x0, declaration=0x7ffff05f8356 "ferror",
    excludes=0x0, copy_names=0, obstack=0x16285f0)
    at ../../anon-ns-16874/gdb/cp-namespace.c:139
(top-gdb) 
Continuing.

Breakpoint 3, cp_add_using_directive (dest=0x7ffff0659462 "std",
    src=0x866f92 "", alias=0x0, declaration=0x7ffff05fb494 "fflush",
    excludes=0x0, copy_names=0, obstack=0x16285f0)
    at ../../anon-ns-16874/gdb/cp-namespace.c:139
(top-gdb) 

Is this a potential perf issue?
[both when reading debug info and later when doing lookups]


(top-gdb) bt
#0  cp_add_using_directive (dest=0x7ffff0659462 "std", src=0x866f92 "",
    alias=0x0, declaration=0x7ffff06562d6 "mbstate_t", excludes=0x0,
    copy_names=0, obstack=0x16285f0)
    at ../../anon-ns-16874/gdb/cp-namespace.c:139
#1  0x000000000062e254 in read_import_statement (die=0x1798f70, cu=0x16af3e0)
    at ../../anon-ns-16874/gdb/dwarf2read.c:8896
#2  0x000000000062ce73 in process_die (die=0x1798f70, cu=0x16af3e0)
    at ../../anon-ns-16874/gdb/dwarf2read.c:8234
#3  0x000000000063b3e0 in read_namespace (die=0x1798e30, cu=0x16af3e0)
    at ../../anon-ns-16874/gdb/dwarf2read.c:13898
#4  0x000000000062cd92 in process_die (die=0x1798e30, cu=0x16af3e0)
    at ../../anon-ns-16874/gdb/dwarf2read.c:8217
#5  0x000000000062e78b in read_file_scope (die=0x17d0290, cu=0x16af3e0)
    at ../../anon-ns-16874/gdb/dwarf2read.c:9057
#6  0x000000000062cc90 in process_die (die=0x17d0290, cu=0x16af3e0)
    at ../../anon-ns-16874/gdb/dwarf2read.c:8164
#7  0x000000000062c53e in process_full_comp_unit (per_cu=0x1627f40,
    pretend_language=language_minimal)
    at ../../anon-ns-16874/gdb/dwarf2read.c:7946
#8  0x000000000062b4ee in process_queue ()
    at ../../anon-ns-16874/gdb/dwarf2read.c:7484
#9  0x00000000006207cc in dw2_do_instantiate_symtab (per_cu=0x1627f40)
    at ../../anon-ns-16874/gdb/dwarf2read.c:2638
#10 0x000000000062085e in dw2_instantiate_symtab (per_cu=0x1627f40)
    at ../../anon-ns-16874/gdb/dwarf2read.c:2659
#11 0x0000000000622f9a in dw2_lookup_symbol (objfile=0x1628590, block_index=0,
name=0x1490640 "(anonymous namespace)",
    domain=VAR_DOMAIN) at ../../anon-ns-16874/gdb/dwarf2read.c:3612
#12 0x000000000059ac9c in lookup_symbol_via_quick_fns (
    objfile=objfile@entry=0x1628590, block_index=block_index@entry=0,
    name=name@entry=0x1490640 "(anonymous namespace)",
    domain=domain@entry=VAR_DOMAIN) at ../../anon-ns-16874/gdb/symtab.c:1679
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


             reply	other threads:[~2014-12-07 22:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-07 22:29 xdje42 at gmail dot com [this message]
2014-12-07 22:30 ` [Bug c++/17687] " xdje42 at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-17687-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).