From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by sourceware.org (Postfix) with ESMTPS id 86C0B38708D0 for ; Thu, 14 May 2020 17:48:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 86C0B38708D0 Received: by mail-lf1-x133.google.com with SMTP id 188so3361150lfa.10 for ; Thu, 14 May 2020 10:48:35 -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:cc; bh=E6gqLUhGQb/O9O1IuSLePH79VIZkRrT4rDQI5IWfRac=; b=CMPisur9gbD3J0rY/LmtlYVWo95y/adrCuTRdNMPfClTh2N12tD2pNrDcAAEu+hxe9 aEK7X1SJfAkdjiPlNoWkBxPNT1pcqvsdOBU1nVKt8jx41N79rncroW42IphqWmcyWrul na2jkOKX3m6h1vIFfXyL43T54RUu66sLtmc1ju9Sa0+5UzJA0GWClArZ94vInKGqg1hY f9zMPJ5MblLyi24d8rPFD+lms/6+oqJ0a3Ulbdb0zZWoXc1V0kIhONe3FIzqzi7GXh/J l39XWJ2+rS3eZAZwVxfRgjc3hR7BYZaEJkp2mHu0GNKYGztcImjS/KGwiS6vpnITecV5 bRMg== X-Gm-Message-State: AOAM532nFf4Gz8cyAFGPJ3DkAyGMQV3PBPIWi/NXV6aRydYb5kO2bxpT nBazAvhc5enYhLAyQTcH4QNIO7pdBbXuoTyvzjvWSzp1 X-Google-Smtp-Source: ABdhPJygvfrkjRK8+rL9yHZKS+TJZkevkkAY6Iy0GpgEmL0/ydbAijjTNqE8YfkCt96VZQNW0Km8MRdMRrqL2Y6+CUE= X-Received: by 2002:a19:651a:: with SMTP id z26mr3900356lfb.195.1589478514284; Thu, 14 May 2020 10:48:34 -0700 (PDT) MIME-Version: 1.0 References: <072e4b2b-4d71-b343-c8ef-0edbc6ab6804@simark.ca> In-Reply-To: <072e4b2b-4d71-b343-c8ef-0edbc6ab6804@simark.ca> From: mlimber Date: Thu, 14 May 2020 13:48:23 -0400 Message-ID: Subject: Re: [PATCH] [PR 25678] gdb crashes with "internal-error: sect_index_text not initialized" when .text To: Simon Marchi Cc: gdb-patches@sourceware.org X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, KAM_SHORT, 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: Thu, 14 May 2020 17:48:46 -0000 Sure. Clearer repro steps: 1. Build an application linking to an SO that has no text segment. I believe there is an SO attached to the bug ticket that will work. (My actual use case is a little complicated. I'm building a Qt 5.3 app and Qt's libs have libicu*.so.52.2 as dependencies. Thus, I am indirectly using libicudata.so.52.2, similar to what a recent commenter on the ticket reported.) 2. Execute `gdb my_exe`. 3. Type 'r' at the gdb prompt to run. 4. Output from gdb 10: Starting program: [snip] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". symfile.c:881: internal-error: sect_index_text not initialized A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) Output from gdb 8.2: Starting program: [snip] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". /build/gdb-q2KLFj/gdb-8.2/gdb/symfile.c:891: internal-error: sect_index_text not initialized A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) Is it legitimate to add binary files like an SO as part of the test, or must I build all artifacts from source? If desired, I can attach the offending SO to the ticket once my account is setup (waiting on setup email). M On Thu, May 14, 2020 at 1:32 PM Simon Marchi wrote: > On 2020-05-14 1:22 p.m., mlimber via Gdb-patches wrote: > > I have replicated this bug in gdb versions 10.0.50.20200514-git and also > > 8.2-0ubuntu1~14.04.1. I am using an executable that dynamically links an > > shared object with no text segment, viz., libicudata.so.52.2. (FWIW, > lldb-8 > > does not crash with this same executable + library.) > > > > I located a patch by Jeremie Courreges-Anglas here: > > https://marc.info/?l=openbsd-ports&m=146569238229407&w=2. I applied said > > patch, rebuilt gdb, and now I can debug the same executable with gdb. > > > > I am not an expert on the inner workings of gdb, but I assume those who > > review this code can better judge the overall soundness of this change. > > > > I did not create a new test, but I can try it if necessary. > > > > I have not previously completed an FSF copyright assignment. I have a > > "request for disclaimer" email prepared to send if so directed by the gdb > > maintainers. > > > > Cheers! > > > > M > > > > Hi, > > Thanks for the patch. For reference, could you please provide some > instructions > on how to replicate this bug? How to compile a minimal test case and the > GDB > commands to trigger the bug. It should ideally be put in the commit > message to > act as a reference, and it will be useful to write a test. > > We'll want a test for sure, so if you want to start writing one it would be > appreciated. I know that writing GDB test is not the most obvious thing to > do when you are not familiar with it, so don't hesitate to ask for help. > > Simon >