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 461083858D35 for ; Thu, 16 Mar 2023 14:45:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 461083858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.192] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id F29661E0D3; Thu, 16 Mar 2023 10:45:21 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1678977922; bh=kF7P3SfK/Tw2zDneF1EyQvh38CewIY7JPpn5aYGfCi4=; h=Date:Subject:To:References:From:In-Reply-To:From; b=mGnPuMdsuykULVtgjQ7U2mTjGl1f47evOh+GVq2mG9aQucrn+T4rq7IE1v14xIWPZ fxp0dBOG1BMDH2X2YKt+3miV/S0CCPfv2jCU+dI0D6NlorkUN14aFRPrIn/LzMbJ1g AvxawxxUuui8PvogORR9Hmrn86GqQnVQxe6bXPfE= Message-ID: <7ef34f41-d90a-8173-b0b8-08a19b0b4484@simark.ca> Date: Thu, 16 Mar 2023 10:45:21 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 2/5] Change linetables to be objfile-independent Content-Language: fr To: Tom Tromey , Simon Marchi via Gdb-patches References: <20230308-submit-constify-linetable-v1-0-ca4057478141@tromey.com> <20230308-submit-constify-linetable-v1-2-ca4057478141@tromey.com> <87jzzne1vo.fsf@tromey.com> <87fsaaejnb.fsf@tromey.com> <87y1nwiyk2.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87y1nwiyk2.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 3/16/23 10:02, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> Looks like we're trying to read from the inferior at an unrelocated > Simon> address. From some previous bug, I recall that you were using a system > Simon> with no-PIE as a default, so that could be why you don't see it. > > I tried building this executable with -fPIE and it still seems to work > for me :( Ok, I'll look into it then. I can reproduce it like hand like this: $ gcc -fno-stack-protector -c \ -o /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/disasm-optim/disasm-optim0.o \ /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/disasm-optim.S \ -fPIE $ gcc /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/disasm-optim/disasm-optim0.o \ -pie -o disasm-optim $ gdb ./gdb -nx -q --data-directory=data-directory disasm-optim Reading symbols from disasm-optim... (gdb) start This GDB supports auto-downloading debuginfo from the following URLs: Enable debuginfod for this session? (y or [n]) n Debuginfod has been disabled. To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit. Temporary breakpoint 1 at 0x1120: file disasm-optim.c, line 25. Starting program: /home/smarchi/build/binutils-gdb/gdb/disasm-optim [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1". Temporary breakpoint 1, main () at disasm-optim.c:25 25 disasm-optim.c: No such file or directory. (gdb) disassemble main Dump of assembler code for function main: => 0x0000555555555120 <+0>: mov 0x2ef2(%rip),%eax # 0x555555558018 0x0000555555555126 <+6>: test %eax,%eax 0x0000555555555128 <+8>: js 0x555555555140 0x000055555555512a <+10>: lea 0xa(%rax),%edx 0x000055555555512d <+13>: test %eax,%eax 0x000055555555512f <+15>: mov $0x1,%eax 0x0000555555555134 <+20>: cmovne %edx,%eax 0x0000555555555137 <+23>: mov %eax,0x2ed7(%rip) # 0x555555558014 0x000055555555513d <+29>: xor %eax,%eax 0x000055555555513f <+31>: ret 0x0000555555555140 <+32>: add %eax,%eax 0x0000555555555142 <+34>: jmp 0x555555555137 End of assembler dump. (gdb) disassemble /s main Dump of assembler code for function main: Cannot access memory at address 0x1120 If I link with -no-pie, then it works. Simon