Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: watashiwaher <watashiwaher@gmail.com>
To: Simon Marchi <simark@simark.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fixing get_builder() function in dwarf2/read.c
Date: Tue, 16 Jun 2020 00:06:34 +0900	[thread overview]
Message-ID: <CAFHDqJMUug5Mf8c364zACagntawcmD=O+5=oJFBthBbVw4Lyhg@mail.gmail.com> (raw)
In-Reply-To: <95d33ff4-2215-d9f1-2093-2f75bb48cd99@simark.ca>

Sure

#0  dwarf2_cu::get_builder (this=<optimized out>) at
/home/bo/binutils-gdb/gdb/dwarf2/read.c:631
#1  process_full_comp_unit (pretend_language=<optimized out>, cu=<optimized
out>) at /home/bo/binutils-gdb/gdb/dwarf2/read.c:9933
#2  process_queue (per_objfile=0x55aa54d7ae80) at
/home/bo/binutils-gdb/gdb/dwarf2/read.c:9144
#3  dw2_do_instantiate_symtab (per_cu=0x55aa54d81ff0,
per_objfile=0x55aa54d7ae80, skip_partial=<optimized out>) at
/home/bo/binutils-gdb/gdb/dwarf2/read.c:2429
#4  0x000055aa53e6d184 in dwarf2_psymtab::expand_psymtab
(this=0x55aa54fe6440, objfile=0x55aa54d635f0) at
/home/bo/binutils-gdb/gdb/dwarf2/read.c:9173
#5  0x000055aa53e4b58e in dwarf2_psymtab::read_symtab (this=0x55aa54fe6440,
objfile=0x55aa54d635f0) at /home/bo/binutils-gdb/gdb/dwarf2/read.c:9021
#6  0x000055aa53f76df6 in psymtab_to_symtab (objfile=0x55aa54d635f0,
pst=0x55aa54fe6440) at /home/bo/binutils-gdb/gdb/psympriv.h:365
#7  0x000055aa53f79621 in psym_lookup_symbol (objfile=0x55aa54d635f0,
block_index=<optimized out>, name=0x7fff6a737ef0 "main", domain=VAR_DOMAIN)
at /home/bo/binutils-gdb/gdb/psymtab.c:493
#8  0x000055aa53ff922b in lookup_symbol_via_quick_fns (domain=VAR_DOMAIN,
name=0x7fff6a737ef0 "main", block_index=GLOBAL_BLOCK,
objfile=0x55aa54d635f0) at /home/bo/binutils-gdb/gdb/symtab.c:2373
#9  lookup_symbol_in_objfile (objfile=0x55aa54d635f0,
block_index=GLOBAL_BLOCK, name=0x7fff6a737ef0 "main", domain=VAR_DOMAIN) at
/home/bo/binutils-gdb/gdb/symtab.c:2523
#10 0x000055aa53ff9474 in lookup_symbol_global_or_static_iterator_cb
(objfile=<optimized out>, cb_data=0x7fff6a737bb0) at
/home/bo/binutils-gdb/gdb/symtab.c:2596
#11 0x000055aa53fc25d4 in svr4_iterate_over_objfiles_in_search_order
(gdbarch=<optimized out>, cb=0x55aa53ff9450
<lookup_symbol_global_or_static_iterator_cb(objfile*, void*)>,
cb_data=0x7fff6a737bb0,
    current_objfile=0x0) at /home/bo/binutils-gdb/gdb/solib-svr4.c:3254
#12 0x000055aa53ff362e in lookup_global_or_static_symbol
(name=0x7fff6a737ef0 "main", block_index=GLOBAL_BLOCK, objfile=0x0,
domain=VAR_DOMAIN) at /home/bo/binutils-gdb/gdb/objfiles.h:550
#13 0x000055aa53ff8c9d in lookup_global_symbol (name=name@entry=0x7fff6a737ef0
"main", block=block@entry=0x0, domain=domain@entry=VAR_DOMAIN) at
/home/bo/binutils-gdb/gdb/symtab.c:2692
#14 0x000055aa53dfb5e8 in cp_lookup_bare_symbol
(langdef=langdef@entry=0x55aa5449ae40
<cplus_language_defn>, name=name@entry=0x7fff6a737ef0 "main",
block=block@entry=0x0,
    domain=domain@entry=VAR_DOMAIN, search=1) at
/home/bo/binutils-gdb/gdb/cp-namespace.c:205
#15 0x000055aa53dfc16b in lookup_namespace_scope
(langdef=langdef@entry=0x55aa5449ae40
<cplus_language_defn>, name=name@entry=0x7fff6a737ef0 "main",
block=block@entry=0x0,
    domain=domain@entry=VAR_DOMAIN, scope=scope@entry=0x55aa54223bda "",
scope_len=scope_len@entry=0) at /home/bo/binutils-gdb/gdb/cp-namespace.c:719
#16 0x000055aa53dfc1fa in cp_lookup_symbol_nonlocal (langdef=0x55aa5449ae40
<cplus_language_defn>, name=0x7fff6a737ef0 "main", block=0x0,
domain=VAR_DOMAIN)
    at /home/bo/binutils-gdb/gdb/cp-namespace.c:754
#17 0x000055aa53ff8901 in lookup_symbol_aux (name=0x7fff6a737ef0 "main",
match_type=match_type@entry=symbol_name_match_type::FULL,
block=block@entry=0x0,
domain=domain@entry=VAR_DOMAIN,
    language=language@entry=language_cplus,
is_a_field_of_this=is_a_field_of_this@entry=0x0) at
/home/bo/binutils-gdb/gdb/symtab.c:2089
#18 0x000055aa53ff8a64 in lookup_symbol_in_language (name=<optimized out>,
block=0x0, domain=VAR_DOMAIN, lang=language_cplus, is_a_field_of_this=0x0)
at /home/bo/binutils-gdb/gdb/symtab.c:1881
#19 0x000055aa53e00b61 in inspect_type (info=0x55aa54e8a110,
ret_comp=0x55aa54f6b1a0, finder=<optimized out>, data=<optimized out>) at
/home/bo/binutils-gdb/gdb/cp-support.c:160
#20 0x000055aa53e011f1 in replace_typedefs (info=0x55aa54e8a110,
ret_comp=0x55aa54f6b1a0, finder=0x0, data=0x0) at
/home/bo/binutils-gdb/gdb/cp-support.c:544
#21 0x000055aa53e0095d in cp_canonicalize_string_full
(string=0x55aa54f6f240 "main", finder=0x0, data=0x0) at
/home/bo/binutils-gdb/gdb/cp-support.c:595
#22 0x000055aa53e01616 in cp_canonicalize_string_no_typedefs
(string=string@entry=0x55aa54f6f240 "main") at
/home/bo/binutils-gdb/gdb/cp-support.c:619
#23 0x000055aa53ef3a92 in find_linespec_symbols (state=0x7fff6a738810,
file_symtabs=0x55aa54e8a180, lookup_name=0x55aa54f6f240 "main",
name_match_type=symbol_name_match_type::WILD,
    symbols=0x7fff6a738470, minsyms=0x7fff6a738490) at
/home/bo/binutils-gdb/gdb/linespec.c:3897
#24 0x000055aa53ef5ae6 in linespec_parse_basic (parser=0x7fff6a7387e0) at
/home/bo/binutils-gdb/gdb/linespec.c:1866
#25 parse_linespec (parser=0x7fff6a7387e0, arg=<optimized out>,
match_type=<optimized out>) at /home/bo/binutils-gdb/gdb/linespec.c:2655
#26 0x000055aa53ef68e4 in event_location_to_sals (parser=0x7fff6a7387e0,
location=0x55aa54de1c90) at /home/bo/binutils-gdb/gdb/linespec.c:3150
#27 0x000055aa53ef6edc in decode_line_full
(location=location@entry=0x55aa54de1c90,
flags=flags@entry=1, search_pspace=search_pspace@entry=0x0,
default_symtab=<optimized out>,
    default_line=<optimized out>, canonical=0x7fff6a738b20,
select_mode=0x0, filter=<optimized out>) at
/home/bo/binutils-gdb/gdb/linespec.c:3229
#28 0x000055aa53d96b4d in parse_breakpoint_sals (location=0x55aa54de1c90,
canonical=0x7fff6a738b20) at /home/bo/binutils-gdb/gdb/breakpoint.c:9027
#29 0x000055aa53d9cd82 in create_breakpoint (gdbarch=0x55aa54d67ba0,
location=0x55aa54de1c90, cond_string=0x0, thread=<optimized out>,
extra_string=0x0, parse_extra=1, tempflag=0,
    type_wanted=bp_breakpoint, ignore_count=0,
pending_break_support=AUTO_BOOLEAN_AUTO, ops=0x55aa54499960
<bkpt_breakpoint_ops>, from_tty=1, enabled=1, internal=0, flags=0)
    at /home/bo/binutils-gdb/gdb/breakpoint.c:9243
#30 0x000055aa53d9d2cb in break_command_1 (arg=<optimized out>,
flag=<optimized out>, from_tty=1) at
/home/bo/binutils-gdb/gdb/breakpoint.c:9401
#31 0x000055aa53dc92ea in cmd_func (cmd=<optimized out>, args=<optimized
out>, from_tty=<optimized out>) at
/home/bo/binutils-gdb/gdb/cli/cli-decode.c:2113
#32 0x000055aa540285b3 in execute_command (p=<optimized out>,
p@entry=0x55aa54c9fb20
"b main", from_tty=1) at /home/bo/binutils-gdb/gdb/top.c:655
#33 0x000055aa53e7c9b5 in command_handler (command=0x55aa54c9fb20 "b main")
at /home/bo/binutils-gdb/gdb/event-top.c:588
#34 0x000055aa53e7d891 in command_line_handler (rl=...) at
/home/bo/binutils-gdb/gdb/event-top.c:773
#35 0x000055aa53e7d22c in gdb_rl_callback_handler (rl=0x55aa54de1c10 "b
main") at /usr/include/c++/9/bits/unique_ptr.h:153
#36 0x000055aa54090a78 in rl_callback_read_char () at
/home/bo/binutils-gdb/readline/readline/callback.c:281
#37 0x000055aa53e7c4d6 in gdb_rl_callback_read_char_wrapper_noexcept () at
/home/bo/binutils-gdb/gdb/event-top.c:177
#38 0x000055aa53e7d0e5 in gdb_rl_callback_read_char_wrapper
(client_data=<optimized out>) at /home/bo/binutils-gdb/gdb/event-top.c:193
#39 0x000055aa53e7c3f8 in stdin_event_handler (error=<optimized out>,
client_data=0x55aa54c9f890) at /home/bo/binutils-gdb/gdb/event-top.c:516
#40 0x000055aa54158326 in gdb_wait_for_event (block=block@entry=1) at
/home/bo/binutils-gdb/gdbsupport/event-loop.cc:673
#41 0x000055aa5415859b in gdb_wait_for_event (block=1) at
/home/bo/binutils-gdb/gdbsupport/event-loop.cc:569
#42 gdb_do_one_event () at
/home/bo/binutils-gdb/gdbsupport/event-loop.cc:215
#43 0x000055aa53f20605 in start_event_loop () at
/home/bo/binutils-gdb/gdb/main.c:356
#44 captured_command_loop () at /home/bo/binutils-gdb/gdb/main.c:416
#45 0x000055aa53f22555 in captured_main (data=<optimized out>) at
/home/bo/binutils-gdb/gdb/main.c:1253
#46 gdb_main (args=<optimized out>) at /home/bo/binutils-gdb/gdb/main.c:1268
#47 0x000055aa53d34b30 in main (argc=<optimized out>, argv=<optimized out>)
at /home/bo/binutils-gdb/gdb/gdb.c:32

On Mon, Jun 15, 2020 at 11:58 PM Simon Marchi <simark@simark.ca> wrote:

> On 2020-06-14 1:07 p.m., watashiwaher wrote:
> > It is a shame. But it seems I can't. Also I am not so strong in dwarf2.
> > The binary was so huge and so private, that I was so dumb to understand
> what actually inside binary got wrong :(
> > All I just noticed, it is that get_builder() calls itself recursively,
> in such manner:
> > ptr1 -> ptr2 -> ptr1 -> ptr2 -> ...
> > And tho I made a small patch that:
> > 1) eliminate recursion
> > 2) uses tortoise algorithm to break out of loop
> > All I can say, that I really had a halt in this function due to the
> recursion, because I debugged that halt in GDB...
>
> Could you at least provide a backtrace of GDB in this endless loop?  Then
> we
> can maybe understand what got it that way and build a reproducer from that.
>
> Simon
>


  reply	other threads:[~2020-06-15 15:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-14 16:49 watashiwaher
2020-06-14 16:58 ` Simon Marchi
2020-06-14 17:07   ` watashiwaher
2020-06-15 14:58     ` Simon Marchi
2020-06-15 15:06       ` watashiwaher [this message]
2020-06-15 15:13         ` watashiwaher

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='CAFHDqJMUug5Mf8c364zACagntawcmD=O+5=oJFBthBbVw4Lyhg@mail.gmail.com' \
    --to=watashiwaher@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /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