From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by sourceware.org (Postfix) with ESMTPS id 44786383E83C for ; Sun, 14 Jun 2020 17:07:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 44786383E83C Received: by mail-pg1-x542.google.com with SMTP id t7so6559704pgt.3 for ; Sun, 14 Jun 2020 10:07:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=YghDvol4P8JJ5mSSSILLEwWCDKHYf2H/OQUmhz4YXXg=; b=BfURWQELH2hHx+hIC3g1EWKS9Zyq1OtyVdxRPF0TWOECCKyQIZzlgnpQ/VD6ECrjmB QQcZr9psSWU6ZzNZTGoGyugUqqXhffkYk1fcdbMc9UWLYTeR3k7JUiUL26B6oBiIBfy+ VuPrjGUbnqxZninHXh4+sTGD/v1x7m2OLTv9pvagmzB0CWJCoCZIqxpaYZS0EwnS73zW crhSiI90p0+Adi1Tbe3WjbxeyEXyiyAUbBlFZHJBJuaOPOL2U8nmt8DecnqhFWCz1XKe g3pimlAmMmrrqZbcMGgyrfGW1IVLWdjFnm0tXG1IZ3sABZj14HhYpJJxfS6ThnqJJaUg bjAA== X-Gm-Message-State: AOAM532MfSByee3YUHHzrdm52QnlTcKFrl77I6rtlueI+25p1T4GhkjV 13+RANHvNBUytSOV85ikDBVDFPUPwUli/v+SupOu6aON X-Google-Smtp-Source: ABdhPJzcqIeToAgtackyJ9M3haoJIq6fsm+4t7zGHHrHN0dfxDDIZEp4ysUIM6Wafx8QSeeeO3e4+kzVQjLxWw+miBs= X-Received: by 2002:a65:6715:: with SMTP id u21mr19264539pgf.365.1592154460470; Sun, 14 Jun 2020 10:07:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: watashiwaher Date: Mon, 15 Jun 2020 02:07:29 +0900 Message-ID: Subject: Re: [PATCH] Fixing get_builder() function in dwarf2/read.c To: Simon Marchi , gdb-patches@sourceware.org X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2020 17:07:42 -0000 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... On Mon, Jun 15, 2020 at 1:58 AM Simon Marchi wrote: > On 2020-06-14 12:49 p.m., watashiwaher via Gdb-patches wrote: > > Explanation > > I found that some binaries with debug symbols halt gdb. And the problem > was > > in the get_builder() function inside dwarf2/read.c file. The function > > recursively called itself until infinity. So I tried to fix this issue > by > > eliminating recursion and adding the check for cycle detection, and > > returning nullptr if cycle detected. > > > > ChangeLog > > 2020-06-15 Slava Mitin > > > > * dwarf2/read.c (get_builder): Added check for cycles > > Hi! > > Thanks for the patch. We try very hard to have a test case checked in for > each > fix like this. Would you be able to share a small reproducer (a small > program > that makes GDB crash like this) that we could turn into a test case? > > Simon >