From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id rcwQJYrHS2rq7CkAWB0awg (envelope-from ) for ; Mon, 06 Jul 2026 11:19:38 -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=wV8g9mmU; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 888DC1E098; Mon, 06 Jul 2026 11:19:38 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (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 755E91E024 for ; Mon, 06 Jul 2026 11:19:37 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 20BF44BA2E08 for ; Mon, 6 Jul 2026 15:19:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 20BF44BA2E08 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1783351176; bh=gT+tgGM9lRECY4NRdu68SigIq9BfTWNUwQj0wLkLkXY=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=wV8g9mmUmWLbEwXRwMIlLFiHLYFKaEPiuF8FpU6P9ky911QmHU71QLcN/vczHzHbU rYlvy8jkKdF0eEua8QnVw90gc1ElEIsJIq7dLfK3PDzg3m7eoTH3oLq7YPDtn9lHYV X5gzwoUL/TZI4UePGDEn74uqJx+KJBw+21ezVBAw= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 697DC4BA5436 for ; Mon, 6 Jul 2026 15:18:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 697DC4BA5436 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 697DC4BA5436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783351139; cv=none; b=XA6NX4u83lsWzSqxZnS1BNO7SmnHsPBmWCAJvem8QTGlB1z5Aw3cphCNvTqqzfPdEot+50I+Cw7TKS0MhMauoPQaZE8XL5zbjDznw07QcJHtW6UipAjgfUY7luH/kajZVdJ2T2KH5vfktthDI3mf4pqYMzU3D/1FTiREYtBHhic= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783351139; c=relaxed/simple; bh=jNidYG1tGscVzv/L0e32LgA9/JVv5NgrUdiDmHV1o1U=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=EIZycf3kNT+AQsLs/JR8lA5s3S/EQLcD3lSldi+gAoa1xVyyjDG46JLaXZoiNhcVdnxEeNsP9f9UhbJog4sVMebWLNBS0mcZroHJheC+yqsyPTaR/CmtYcAUr1KaiNs37S649/5y9exeqqyzEFjYoucqbzrCqdT656PJLIdzPoc= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MelbE3Nb DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 697DC4BA5436 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-76-ZkNOKT4fNbq-d87IYlKVPQ-1; Mon, 06 Jul 2026 11:18:58 -0400 X-MC-Unique: ZkNOKT4fNbq-d87IYlKVPQ-1 X-Mimecast-MFC-AGG-ID: ZkNOKT4fNbq-d87IYlKVPQ_1783351136 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-493bdaf8549so37276345e9.2 for ; Mon, 06 Jul 2026 08:18:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783351136; x=1783955936; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gT+tgGM9lRECY4NRdu68SigIq9BfTWNUwQj0wLkLkXY=; b=VH9blpfpwyK136xxdq4VygaVVRQmLIYYx4pDEwe3vh/94fG0b4E7RzBf300v86bv5Z TG0QO8mjnKcrO0eT9I7NU2Ya9iUQU03JiZ6B1hJNDV9TBnrROOmwWgBc8YkRodhMId4S W4lvden0iG7q6SESdxmNQJv/Haytogr5osI2L/e8WAblDuwxy0IEzfXmbFkA8/QGu6Gu lKmubDTYZDcghuVulQ3Tg31URYHCoflN470QW8weNxvY71P1XL4t/l4JruknE6MQuH6f jghwBT1fbeJrS2slAKm/w4nU7buNwLkCn3I6lCz/NuBqiLcyFhcrmSR/ZzmugZIGqY1D ZV2g== X-Forwarded-Encrypted: i=1; AHgh+RobKVV3AXNhvdI0EpINEnslSAgP3Fm2Y+yaOyLE9E8EgRCtBRQ2WK+DaahY7AXmEZvFkRo=@sourceware.org X-Gm-Message-State: AOJu0Yw8CVhKqlgFZWnmHbKPLVWQLaa1DQ20id+PwI+jdSSvgTEkaZ2V qdbDU9rp7pqWw5rSR2j4wQhOKIFeQeT7ERLy+HXSYuKqzbgnYJtA2zHKI7Zj7OuBZvRQ7uhV20j BpCVYfw1JilOpu31r5cFIS4N0vXzItlXGGPR79HOA3RP0Uu/TaTpo X-Gm-Gg: AfdE7cnC5OrW+PXm0+T8Sv9F30XSk1iCARcQPdsZb8qVQE2ZWVt3eO51ii7w8+yiTey Tj3LD/Ymm1ioyFyg5uDin8aEmQSb/FFGsHySjHAnN7uiylBB1fpkub3AcTyl5J+UsGmJKYIHXvD H/GejcHGBQEEWt1hcH6cu0X8q9MJf4FHhtVYCT+peKfsr7C+GL/U8ZSKHhB5yXGWVTfELj3xhwb 8mNmcSe5fG5Qu6Mfb3s/0Kf5mJ3HG5fJKZyXVK1bI9ZvKtkPj20wwEUhgFAna+gXDqFiqKnrm87 nyQswvMQf/+lAhmXMv1IKF4Neugq/RNz1TVXh4QR4Rjmi9gFejcXU1v6xUNAcee5RZqFTUdRYLH lqZCplPo= X-Received: by 2002:a05:600c:3b2a:b0:493:df47:8d9f with SMTP id 5b1f17b1804b1-493df478db8mr3169965e9.10.1783351136329; Mon, 06 Jul 2026 08:18:56 -0700 (PDT) X-Received: by 2002:a05:600c:3b2a:b0:493:df47:8d9f with SMTP id 5b1f17b1804b1-493df478db8mr3169105e9.10.1783351135374; Mon, 06 Jul 2026 08:18:55 -0700 (PDT) Received: from localhost ([31.111.209.233]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493cce03fa1sm282408705e9.11.2026.07.06.08.18.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 08:18:54 -0700 (PDT) To: Zhao Yiming , gdb@sourceware.org Subject: Re: Fwd: RISC-V bare-metal: GDB loses source line info when .text starts at 0x0 In-Reply-To: References: Date: Mon, 06 Jul 2026 16:18:52 +0100 Message-ID: <87wlv8tacj.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Imu4vWnhe82vcPkPmRWg2fa0wgL4EJAObH0KhComBKA_1783351136 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" Zhao Yiming via Gdb writes: > Hi GDB maintainers, > > I am seeing a possible GDB source-line lookup issue while remote-debugging a > bare-metal RISC-V ELF. > > Environment: > - GDB: 15.2.90.20241210-git, Xuantie-900 elf newlib gcc Toolchain V3.2.0 > B-20250627 > - GCC: 14.1.1 20240710, same Xuantie toolchain > - ld: GNU ld 2.42.50 > - QEMU: qemu-system-riscv64 8.2.94 (cskysim V5.2.8 B-20250721) > - Host: Windows 10.0.19045.6466 > > Build flags: > > -O0 -g -ffunction-sections -fdata-sections -Wl,--gc-sections > > The failing ELF is linked as a bare-metal image with .text VMA = 0x0. > > Reproducer outline: > > target remote :1234 > load > b main > c > s > s > n > n > n > n > > After stepping out of SPI_ModifyGlobalReg(), GDB prints only: > > 0x00000000000002dc in I2C_PinMuxSetup () > > Expected: > > I2C_PinMuxSetup (...) at ../src/demoI2c.c:36 > > The line information appears to exist: > > addr2line -e LRV4201_SPI_I2C_2.elf 0x2dc > -> ../src/demoI2c.c:36 > > Relevant symbols: > > 0000000000000000 T Reset_Handler > 00000000000002ca T I2C_PinMuxSetup > 0000000000000920 T SPI_ModifyGlobalReg > > Additional observations: > > 1. If the linker script changes .text from 0x0 to a non-zero address, the > GDB problem disappears. > 2. If .text still starts at 0x0 but Reset_Handler is placed in .text instead > of .text.init, the problem also disappears. > 3. The failing ELF contains many zero-address decoded line-table rows from > demoI2c.c/demoSpi.c. A no-gc build and a reduced working project do not. > > I attached a small archive with decoded line tables, objdump section > headers, > addr2line output, build flags, linker script, and relevant sources. The full > ELFs are not attached because of the mailing list size limit, but I can > provide > them or file a Bugzilla issue if preferred. > If you could file a bugzilla, include this description, and attach everything including the ELFs, that would make things easier. If you post the link I'll try to take a look when I have time. I'm not surprised that there are issues here, some of the older GDB code still makes use of 0 as a "magic" flag indicating no-data, etc. I've worked on targets that allow code to be placed at address 0, and fixed some of these issues in the past, so it would be nice to fix this one too. Thanks, Andrew