From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id vD6vDS4TJ2jnNCUAWB0awg (envelope-from ) for ; Fri, 16 May 2025 06:27:58 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=k9VsLXmk; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 27F4F1E10E; Fri, 16 May 2025 06:27:58 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 780C71E092 for ; Fri, 16 May 2025 06:27:57 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 32E073857BAF for ; Fri, 16 May 2025 10:27:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 32E073857BAF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1747391276; bh=FCYwfgZSKouwuNJs2NhYsDqMvfYAmIJDn5i0OScJLVc=; h=To:Cc:Subject:In-Reply-To:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=k9VsLXmkxR0vz3jfG8jb3dGQckGyrm7TsyPSS5CD/HFFkdhtqr6nL+qeTndmj60jT CE0f8Mp5VsdmisJeTtccJBnHitJ0kUzFdKROzNQ6GkPOb8yXIHc6GRKSUM95MHHMXq ldJuobaXFGLaHv2Zq0be3aycsYxqezlbgmwzpE2A= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 946463858C56 for ; Fri, 16 May 2025 10:27:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 946463858C56 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 946463858C56 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747391223; cv=none; b=TrDSI+GMbauni72YPHYo5UdR0w6XzdUYp253WABihoRQZ+K9GLyMsz0d9pS6ALbS0yELpnm8QgU46Qq8vBz8zr5bWluaz4O9NT3t8ucGWu+u88yF/IEb418j9D+pRizyX18qXhRbDtfshXnBi3moPGclWaXbo86is12eoQ1/fdM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747391223; c=relaxed/simple; bh=5Y4DDNFwo97u6+qkafZ46DHsvGWf66MWMvZUZsTdLag=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vQpkjyxxUQMZW7m8Af2bisG6BnLWG4npenEan89VhE60AV7p2RnCvdHWbed1mvRWfFrkar+g8OVtVYxZntmcU+4ObD1qZbXHQKMr2p3xanQ7r5J5lR07UaGKOcJbu12PTIQrQLLge05cDoPataIiOvfMFKLDSc7BuxHwujOcI5k= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 946463858C56 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-369-YMO2UOJLNbyExZLUEqwKvQ-1; Fri, 16 May 2025 06:27:02 -0400 X-MC-Unique: YMO2UOJLNbyExZLUEqwKvQ-1 X-Mimecast-MFC-AGG-ID: YMO2UOJLNbyExZLUEqwKvQ_1747391221 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-440667e7f92so10333805e9.3 for ; Fri, 16 May 2025 03:27:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747391221; x=1747996021; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FCYwfgZSKouwuNJs2NhYsDqMvfYAmIJDn5i0OScJLVc=; b=NX6Dvk+zrfTLLj0BvqnylHwinzukNx8n6dTQm9/aechCbz8qOMz1+5KQL5mfZ0xhOd 3qOHQAVhMd+WOGzRm+vBkidRqE03BtN02J9b34uR7UPzSXekH+asTzkxfm6ZJe1f566F RW0+QBaKt+K1dzPyPrBkHT+4dmPddouqL2EfW/RSF7l0YDNTmE1iBj7PJJhOdGIrUWKR mP1Pyyrkuy1IsLUM9wbcinXykEuwM53P2f1xJeJWdmrPDqjyva7wiBNO9KnnPTjSkDLa wkUUqXM8wyS5Kiz85fEYPvMJVYMBsvGyFUOxBg2YdlbgCCXMCnRHLoQ2qYs73/b4xjBX 5miA== X-Gm-Message-State: AOJu0YwM1XRYfUBcPpUjf01KWsPrQbrJNQkgUxtyxeSDwPTRJStmQwwR aFsfS3MyXWPNE0BjkNRAICKYPPiHzehZgS7Ic+k864ckTbyBxVcRd773fbzkGahw6VcxAoP+fqo s+wIr1wenBd/xRx6FFtCI7BP0zhIAzbghMgD+Zstyx08ivtzYlKTR X-Gm-Gg: ASbGncsA0zXhjJo7M3Pb/lFlECX/POZDMcNRw9PoN/7v0SxMURTRadXxUTWQUTeHbrz kI1qIYl6SumoLK/7OetFLSXtIBL9gTVsB0Euk5Nrqxv7C14YT4BLrtafuQun/z3ILQX5QjgNvGC vAUDo3U2IbkkxYFWeRgI35y+wD13Fl7L+y3nwOw8elRAKFzDT4/+p8dE6hH1ItUY5Srpz+NmaO5 1x0xg3x4KHAKQ0ZZPZIu4gVO3vU1+68MhXLRSPHSdGb4sM6nxpszL1wPltCTtuo6eMKLv7fuyxp ZJ1zACYKmdVoQt7lgNtMUdav0v2Tle9lw/0y X-Received: by 2002:a05:600c:3c9b:b0:439:643a:c8d5 with SMTP id 5b1f17b1804b1-442fd5a1e4cmr28342495e9.0.1747391220926; Fri, 16 May 2025 03:27:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGKuV4VbtoEMVjFW6rUYNrNCU15oZdEQifl/GhHihcd1c5hIq8mloDfjOfQtEVQ00pRiNwFg== X-Received: by 2002:a05:600c:3c9b:b0:439:643a:c8d5 with SMTP id 5b1f17b1804b1-442fd5a1e4cmr28342325e9.0.1747391220539; Fri, 16 May 2025 03:27:00 -0700 (PDT) Received: from localhost (30.226.159.143.dyn.plus.net. [143.159.226.30]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a35ca8cfb8sm2328768f8f.85.2025.05.16.03.27.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 May 2025 03:27:00 -0700 (PDT) To: Max Larsson , Andreas Schwab Cc: Max Larsson via Gdb Subject: Re: Breakpoints in shared address space In-Reply-To: References: Date: Fri, 16 May 2025 11:26:59 +0100 Message-ID: <875xi0onpo.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 4hkgsuu97EAh1nQgvcmziTrjOGJBAxEDQ_AsHYIWn5U_1747391221 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrew Burgess via Gdb Reply-To: Andrew Burgess Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" Max Larsson via Gdb writes: > On Thu, 15 May 2025 at 13:46, Andreas Schwab wrote: > >> On Mai 15 2025, Max Larsson via Gdb wrote: >> >> > So if gdb file command is use to read an exe, gdb uses the address for >> the >> > exe as defined in the elf file. So if i disas the _start function >> > it show me all the assembler code starting with an address 0x010000054. >> So >> > long everything is fine. Now I tell gdb to set an break point >> > on that address and run the exe. >> >> How do you set the breakpoint exactly? >> >> > Like this "b *0x010000054" GDB doesn't adjust breakpoint placed by address when an inferior is relocated during startup. The same problems you are encountering can (and often is) hit on Linux system if the executable is compiled as PIE (position independent executable). I did, long ago, propose a patch to GDB that would specifically warn about this issue: https://inbox.sourceware.org/gdb-patches/20200202011022.11357-1-andrew.burgess@embecosm.com/ But it never got merged. If you place the breakpoint based on function name, or file/line, then GDB will update the breakpoints location. Alternatively, you could start the inferior, but halt before the first instruction using `starti`, then disassemble, at which point the addresses should be correct, you can then place a breakpoint by address. Your next question is likely to be: why don't address breakpoints get updated? The answer is that GDB doesn't want to make assumptions about what the user intends. What if they _really_ do want a b/p at that address? Given there are easy solutions (`starti`) that allow the user to place on the correct address, right now, address breakpoints just don't move. Thanks, Andrew > > KR > > Max Larsson > > BTW: Edit the subject which I forget in my initial email