From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 2C363385BF81 for ; Sun, 17 May 2020 14:08:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2C363385BF81 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.193] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 9EFD31E5F9; Sun, 17 May 2020 10:08:10 -0400 (EDT) Subject: Re: [PATCH] [PR 25678] gdb crashes with "internal-error: sect_index_text not initialized" when .text From: Simon Marchi To: Andreas Schwab Cc: mlimber , gdb-patches@sourceware.org References: <072e4b2b-4d71-b343-c8ef-0edbc6ab6804@simark.ca> <59eeb6ee-1ab2-e5aa-000a-2fb6d522b8d0@simark.ca> <87367zt57j.fsf@linux-m68k.org> <5241b0d8-494a-2222-95cb-eeb8d7beed9d@simark.ca> Message-ID: <0aa224d6-4f0f-b3ba-b23b-08025a8245ab@simark.ca> Date: Sun, 17 May 2020 10:08:10 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <5241b0d8-494a-2222-95cb-eeb8d7beed9d@simark.ca> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_PASS, 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 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, 17 May 2020 14:08:12 -0000 On 2020-05-17 10:01 a.m., Simon Marchi wrote: > Thanks Andreas for the tip, I didn't think of checking the distro patches. > > I was able to reproduce with this: > > $ cat allo.c > int salut; > $ gcc allo.c -fPIC -o allo.o -g3 -O0 -c > $ gcc allo.o -shared -nostdlib -nodefaultlibs -o allo.so > $ ./gdb -q -nx a.out > Reading symbols from a.out... > (gdb) start > Temporary breakpoint 1 at 0x1136: file test.c, line 1. > Starting program: /home/smarchi/build/binutils-gdb/gdb/a.out > /home/smarchi/src/binutils-gdb/gdb/objfiles.h:524: 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) > > Simon > Ah nevermind, I spoke to soon. I forgot to rebuild the main executable, to I was still running some old test case. When doing that, it doesn't hit the assert: $ cat allo.c int salut; $ gcc allo.c -fPIC -o allo.o -g3 -O0 -c $ gcc allo.o -shared -nostdlib -nodefaultlibs -o allo.so $ cat test.c int main() {} $ gcc test.c -Wl,--no-as-needed ./allo.so -g3 -O0 -o $ ./gdb --data-directory=data-directory -q -nx a.out Reading symbols from a.out... (gdb) start Temporary breakpoint 1 at 0x1136: file test.c, line 1. Starting program: /home/smarchi/build/binutils-gdb/gdb/a.out Temporary breakpoint 1, main () at test.c:1 1 int main() {} (gdb) Simon