From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12304 invoked by alias); 8 Aug 2013 21:10:33 -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 12279 invoked by uid 48); 8 Aug 2013 21:10:32 -0000 From: "mjw at redhat dot com" To: gdb-prs@sourceware.org Subject: [Bug breakpoints/15826] New: Slow symbol lookups during conditional breakpoints Date: Thu, 08 Aug 2013 21:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: breakpoints X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mjw at redhat 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: 2013-q3/txt/msg00195.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=15826 Bug ID: 15826 Summary: Slow symbol lookups during conditional breakpoints Product: gdb Version: unknown Status: NEW Severity: normal Priority: P2 Component: breakpoints Assignee: unassigned at sourceware dot org Reporter: mjw at redhat dot com If I have a breakpoint with a condition either a "normal" breakpoint or a -probe breakpoint it looks like gdb is doing symbol table lookups every time a condition is being checked. This makes using conditional breakpoints extremely slow. Two examples from debugging LibreOffice (some background context: http://lists.freedesktop.org/archives/libreoffice/2013-August/055022.html) With a "normal" breakpoint with expression: (gdb) info b Num Type Disp Enb Address What 4 breakpoint keep y stop only if (*ppThis)->refCount == 1 && (*ppThis)->length == 99 breakpoint already hit 5 times 4.1 y 0x00002aaaaaadc866 in rtl_string_newConcat(rtl_String**, rtl_String*, rtl_String*) at /usr/local/src/libreoffice/sal/rtl/strtmpl.cxx:1410 4.2 y 0x00002aaaaaae0b2f in rtl_uString_newConcat(rtl_uString**, rtl_uString*, rtl_uString*) at /usr/local/src/libreoffice/sal/rtl/strtmpl.cxx:1410 perf top will show: 38.48% gdb [.] lookup_symbol_aux_psymtabs 18.29% gdb [.] lookup_partial_symbol.isra.3 8.39% gdb [.] symbol_natural_name 8.21% gdb [.] lookup_symbol_aux_objfile 6.67% gdb [.] strcmp_iw_ordered Attaching another gdb will show the following backtrace: #0 0x0000000000648e62 in strcmp_iw_ordered (string1=, string2=, string2@entry=0x175aa360 "bool") at ../../gdb/utils.c:2715 #1 0x000000000055b7d6 in lookup_partial_symbol (pst=pst@entry=0xb85d0d8, name=name@entry=0x746ed9 "bool", global=global@entry=1, domain=domain@entry=VAR_DOMAIN, objfile=0xca7c840, objfile=0xca7c840) at ../../gdb/psymtab.c:696 #2 0x000000000055c7ce in lookup_symbol_aux_psymtabs (objfile=0xca7c840, block_index=0, name=0x746ed9 "bool", domain=VAR_DOMAIN) at ../../gdb/psymtab.c:501 #3 0x0000000000556bfd in lookup_symbol_aux_quick ( objfile=objfile@entry=0xca7c840, kind=kind@entry=0, name=0x746ed9 "bool", domain=VAR_DOMAIN) at ../../gdb/symtab.c:1630 #4 0x0000000000556dc0 in lookup_symbol_global_iterator_cb (objfile=0xca7c840, cb_data=0x7fffef98cc70) at ../../gdb/symtab.c:1759 #5 0x00000000005bcd11 in default_iterate_over_objfiles_in_search_order ( gdbarch=, cb=0x556d70 , cb_data=0x7fffef98cc70, current_objfile=) at ../../gdb/objfiles.c:1480 #6 0x0000000000556825 in lookup_symbol_global ( name=name@entry=0x746ed9 "bool", block=block@entry=0x0, domain=domain@entry=VAR_DOMAIN) at ../../gdb/symtab.c:1790 #7 0x0000000000657496 in lookup_symbol_file (name=name@entry=0x746ed9 "bool", block=block@entry=0x0, domain=domain@entry=VAR_DOMAIN, anonymous_namespace=anonymous_namespace@entry=0, search=1) at ../../gdb/cp-namespace.c:632 #8 0x0000000000657670 in cp_lookup_symbol_in_namespace ( namespace=namespace@entry=0x725cab "", name=name@entry=0x746ed9 "bool", block=block@entry=0x0, domain=domain@entry=VAR_DOMAIN, search=search@entry=1) at ../../gdb/cp-namespace.c:255 #9 0x0000000000657bd1 in cp_lookup_symbol_namespace (scope=0x725cab "", name=0x746ed9 "bool", block=0x0, domain=VAR_DOMAIN) at ../../gdb/cp-namespace.c:526 #10 0x0000000000556f4f in lookup_symbol_aux (is_a_field_of_this=0x0, language=, domain=VAR_DOMAIN, block=0x0, name=0x746ed9 "bool") at ../../gdb/symtab.c:1365 #11 lookup_symbol_in_language (name=, block=block@entry=0x0, domain=domain@entry=VAR_DOMAIN, lang=, is_a_field_of_this=is_a_field_of_this@entry=0x0) at ../../gdb/symtab.c:1211 #12 0x0000000000557022 in lookup_symbol (name=, block=block@entry=0x0, domain=domain@entry=VAR_DOMAIN, is_a_field_of_this=is_a_field_of_this@entry=0x0) at ../../gdb/symtab.c:1226 #13 0x00000000005b55bc in language_bool_type ( la=0x7ac860 , gdbarch=) at ../../gdb/language.c:964 #14 0x000000000053c7dd in evaluate_subexp_standard ( expect_type=expect_type@entry=0x0, exp=exp@entry=0x4c9552e0, pos=0x7fffef98d1cc, noside=noside@entry=EVAL_NORMAL) at ../../gdb/eval.c:2450 #15 0x0000000000613103 in evaluate_subexp_c (expect_type=0x0, exp=0x4c9552e0, pos=0x7fffef98d1cc, noside=EVAL_NORMAL) at ../../gdb/c-lang.c:704 #16 0x000000000053a3a2 in evaluate_subexp (noside=EVAL_NORMAL, pos=0x7fffef98d1cc, exp=0x4c9552e0, expect_type=0x0) at ../../gdb/eval.c:72 #17 evaluate_expression (exp=exp@entry=0x4c9552e0) at ../../gdb/eval.c:147 #18 0x0000000000514059 in breakpoint_cond_eval (exp=exp@entry=0x4c9552e0) at ../../gdb/breakpoint.c:4577 #19 0x0000000000586a2a in catch_errors ( func=func@entry=0x514040 , func_args=func_args@entry=0x4c9552e0, errstring=errstring@entry=0x75b4c8 "Error in testing breakpoint condition:\n", mask=mask@entry=6) at ../../gdb/exceptions.c:546 #20 0x000000000051f940 in bpstat_check_breakpoint_conditions (ptid=..., bs=0x18542b80) at ../../gdb/breakpoint.c:5113 #21 bpstat_stop_status (aspace=, bp_addr=bp_addr@entry=46912496339759, ptid=..., ws=ws@entry=0x7fffef98d8a0) at ../../gdb/breakpoint.c:5275 #22 0x0000000000577ffc in handle_inferior_event (ecs=ecs@entry=0x7fffef98d880) at ../../gdb/infrun.c:4224 #23 0x000000000057a52a in wait_for_inferior () at ../../gdb/infrun.c:2765 #24 0x000000000057aa17 in proceed (addr=addr@entry=18446744073709551615, siggnal=siggnal@entry=GDB_SIGNAL_DEFAULT, step=step@entry=0) at ../../gdb/infrun.c:2346 #25 0x000000000056f302 in continue_1 (all_threads=all_threads@entry=0) at ../../gdb/infcmd.c:736 #26 0x000000000056f451 in continue_command (args=0x0, from_tty=1) at ../../gdb/infcmd.c:828 #27 0x00000000006442ea in execute_command (p=0x2cb1221 "", p@entry=0x2cb1220 "c", from_tty=1) at ../../gdb/top.c:487 #28 0x000000000058fd41 in command_handler (command=0x2cb1220 "c") at ../../gdb/event-top.c:436 #29 0x00000000005901cc in command_line_handler (rl=) at ../../gdb/event-top.c:634 #30 0x00000036fa62a7ee in rl_callback_read_char () at ../callback.c:220 #31 0x000000000058fda9 in rl_callback_read_char_wrapper ( client_data=) at ../../gdb/event-top.c:164 #32 0x000000000058ea84 in process_event () at ../../gdb/event-loop.c:342 #33 0x000000000058edd7 in gdb_do_one_event () at ../../gdb/event-loop.c:406 #34 0x000000000058eff7 in start_event_loop () at ../../gdb/event-loop.c:431 #35 0x0000000000588213 in captured_command_loop (data=data@entry=0x0) at ../../gdb/main.c:259 #36 0x0000000000586a2a in catch_errors ( func=func@entry=0x588200 , func_args=func_args@entry=0x0, errstring=errstring@entry=0x725cab "", mask=mask@entry=6) at ../../gdb/exceptions.c:546 #37 0x0000000000588e16 in captured_main (data=data@entry=0x7fffef98dd80) at ../../gdb/main.c:1134 #38 0x0000000000586a2a in catch_errors ( func=func@entry=0x588590 , func_args=func_args@entry=0x7fffef98dd80, errstring=errstring@entry=0x725cab "", mask=mask@entry=6) at ../../gdb/exceptions.c:546 #39 0x0000000000589a34 in gdb_main (args=args@entry=0x7fffef98dd80) at ../../gdb/main.c:1144 #40 0x00000000004546ce in main (argc=, argv=) at ../../gdb/gdb.c:34 With a probe breakpoint: (gdb) break -probe new_string_16 (gdb) condition 5 $_probe_arg1 == 999 (gdb) info b Num Type Disp Enb Address What 5 breakpoint keep y stop only if $_probe_arg1 == 999 5.1 y 0x00002aaaaaadec18 -probe new_string_16 5.2 y 0x00002aaaaaadec38 -probe new_string_16 5.3 y 0x00002aaaaaadec73 -probe new_string_16 5.4 y 0x00002aaaaaadecc7 -probe new_string_16 5.5 y 0x00002aaaaaaded2e -probe new_string_16 5.6 y 0x00002aaaaaadf185 -probe new_string_16 5.7 y 0x00002aaaaaae0403 -probe new_string_16 5.8 y 0x00002aaaaaae0566 -probe new_string_16 5.9 y 0x00002aaaaaae0775 -probe new_string_16 5.10 y 0x00002aaaaaae0813 -probe new_string_16 5.11 y 0x00002aaaaaae0885 -probe new_string_16 5.12 y 0x00002aaaaaae0945 -probe new_string_16 5.13 y 0x00002aaaaaae0b2f -probe new_string_16 5.14 y 0x00002aaaaaae0b9b -probe new_string_16 5.15 y 0x00002aaaaaae0cde -probe new_string_16 5.16 y 0x00002aaaaaae0e08 -probe new_string_16 5.17 y 0x00002aaaaaae0f2e -probe new_string_16 5.18 y 0x00002aaaaaae105e -probe new_string_16 5.19 y 0x00002aaaaaae119d -probe new_string_16 5.20 y 0x00002aaaaaae19a9 -probe new_string_16 5.21 y 0x00002aaaaaae1a79 -probe new_string_16 perf top output: 35.18% gdb [.] lookup_symbol_aux_psymtabs 16.84% gdb [.] lookup_partial_symbol.isra.3 7.84% gdb [.] symbol_natural_name 7.82% gdb [.] lookup_symbol_aux_objfile 6.11% gdb [.] strcmp_iw_ordered attaching another gdb: #0 0x0000000000556aa4 in lookup_symbol_aux_objfile ( objfile=objfile@entry=0x19e12430, block_index=block_index@entry=0, name=0x746ed9 "bool", domain=VAR_DOMAIN) at ../../gdb/symtab.c:1539 #1 0x0000000000556d90 in lookup_symbol_global_iterator_cb ( objfile=0x19e12430, cb_data=0x7fffef98cc70) at ../../gdb/symtab.c:1756 #2 0x00000000005bcd11 in default_iterate_over_objfiles_in_search_order ( gdbarch=, cb=0x556d70 , cb_data=0x7fffef98cc70, current_objfile=) at ../../gdb/objfiles.c:1480 #3 0x0000000000556825 in lookup_symbol_global ( name=name@entry=0x746ed9 "bool", block=block@entry=0x0, domain=domain@entry=VAR_DOMAIN) at ../../gdb/symtab.c:1790 #4 0x0000000000657496 in lookup_symbol_file (name=name@entry=0x746ed9 "bool", block=block@entry=0x0, domain=domain@entry=VAR_DOMAIN, anonymous_namespace=anonymous_namespace@entry=0, search=1) at ../../gdb/cp-namespace.c:632 #5 0x0000000000657670 in cp_lookup_symbol_in_namespace ( namespace=namespace@entry=0x725cab "", name=name@entry=0x746ed9 "bool", block=block@entry=0x0, domain=domain@entry=VAR_DOMAIN, search=search@entry=1) at ../../gdb/cp-namespace.c:255 #6 0x0000000000657bd1 in cp_lookup_symbol_namespace (scope=0x725cab "", name=0x746ed9 "bool", block=0x0, domain=VAR_DOMAIN) at ../../gdb/cp-namespace.c:526 #7 0x0000000000556f4f in lookup_symbol_aux (is_a_field_of_this=0x0, language=, domain=VAR_DOMAIN, block=0x0, name=0x746ed9 "bool") at ../../gdb/symtab.c:1365 #8 lookup_symbol_in_language (name=, block=block@entry=0x0, domain=domain@entry=VAR_DOMAIN, lang=, is_a_field_of_this=is_a_field_of_this@entry=0x0) at ../../gdb/symtab.c:1211 #9 0x0000000000557022 in lookup_symbol (name=, block=block@entry=0x0, domain=domain@entry=VAR_DOMAIN, is_a_field_of_this=is_a_field_of_this@entry=0x0) at ../../gdb/symtab.c:1226 #10 0x00000000005b55bc in language_bool_type ( la=0x7ac860 , gdbarch=) at ../../gdb/language.c:964 #11 0x000000000053eac4 in evaluate_subexp_standard ( expect_type=expect_type@entry=0x0, exp=exp@entry=0x10a6ef40, pos=0x7fffef98d1cc, noside=noside@entry=EVAL_NORMAL) at ../../gdb/eval.c:2495 #12 0x0000000000613103 in evaluate_subexp_c (expect_type=0x0, exp=0x10a6ef40, pos=0x7fffef98d1cc, noside=EVAL_NORMAL) at ../../gdb/c-lang.c:704 #13 0x000000000053a3a2 in evaluate_subexp (noside=EVAL_NORMAL, pos=0x7fffef98d1cc, exp=0x10a6ef40, expect_type=0x0) at ../../gdb/eval.c:72 #14 evaluate_expression (exp=exp@entry=0x10a6ef40) at ../../gdb/eval.c:147 #15 0x0000000000514059 in breakpoint_cond_eval (exp=exp@entry=0x10a6ef40) at ../../gdb/breakpoint.c:4577 #16 0x0000000000586a2a in catch_errors ( func=func@entry=0x514040 , func_args=func_args@entry=0x10a6ef40, errstring=errstring@entry=0x75b4c8 "Error in testing breakpoint condition:\n", mask=mask@entry=6) at ../../gdb/exceptions.c:546 #17 0x000000000051f940 in bpstat_check_breakpoint_conditions (ptid=..., bs=0x12929160) at ../../gdb/breakpoint.c:5113 #18 bpstat_stop_status (aspace=, bp_addr=bp_addr@entry=46912496339269, ptid=..., ws=ws@entry=0x7fffef98d8a0) at ../../gdb/breakpoint.c:5275 #19 0x0000000000577ffc in handle_inferior_event (ecs=ecs@entry=0x7fffef98d880) at ../../gdb/infrun.c:4224 #20 0x000000000057a52a in wait_for_inferior () at ../../gdb/infrun.c:2765 #21 0x000000000057aa17 in proceed (addr=addr@entry=18446744073709551615, siggnal=siggnal@entry=GDB_SIGNAL_DEFAULT, step=step@entry=0) at ../../gdb/infrun.c:2346 #22 0x000000000056f302 in continue_1 (all_threads=all_threads@entry=0) at ../../gdb/infcmd.c:736 #23 0x000000000056f451 in continue_command (args=0x0, from_tty=1) at ../../gdb/infcmd.c:828 #24 0x00000000006442ea in execute_command (p=0x2cb1221 "", p@entry=0x2cb1220 "c", from_tty=1) at ../../gdb/top.c:487 #25 0x000000000058fd41 in command_handler (command=0x2cb1220 "c") at ../../gdb/event-top.c:436 #26 0x00000000005901cc in command_line_handler (rl=) at ../../gdb/event-top.c:634 #27 0x00000036fa62a7ee in rl_callback_read_char () at ../callback.c:220 #28 0x000000000058fda9 in rl_callback_read_char_wrapper ( client_data=) at ../../gdb/event-top.c:164 #29 0x000000000058ea84 in process_event () at ../../gdb/event-loop.c:342 #30 0x000000000058edd7 in gdb_do_one_event () at ../../gdb/event-loop.c:406 #31 0x000000000058eff7 in start_event_loop () at ../../gdb/event-loop.c:431 #32 0x0000000000588213 in captured_command_loop (data=data@entry=0x0) at ../../gdb/main.c:259 #33 0x0000000000586a2a in catch_errors ( func=func@entry=0x588200 , func_args=func_args@entry=0x0, errstring=errstring@entry=0x725cab "", mask=mask@entry=6) at ../../gdb/exceptions.c:546 #34 0x0000000000588e16 in captured_main (data=data@entry=0x7fffef98dd80) at ../../gdb/main.c:1134 #35 0x0000000000586a2a in catch_errors ( func=func@entry=0x588590 , func_args=func_args@entry=0x7fffef98dd80, errstring=errstring@entry=0x725cab "", mask=mask@entry=6) at ../../gdb/exceptions.c:546 #36 0x0000000000589a34 in gdb_main (args=args@entry=0x7fffef98dd80) at ../../gdb/main.c:1144 #37 0x00000000004546ce in main (argc=, argv=) at ../../gdb/gdb.c:34 -- You are receiving this mail because: You are on the CC list for the bug.