From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kNlXEascw2YgfAwAWB0awg (envelope-from ) for ; Mon, 19 Aug 2024 06:21:31 -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=WtHcdzN4; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 412681E0D0; Mon, 19 Aug 2024 06:21:31 -0400 (EDT) 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 303D51E0AC for ; Mon, 19 Aug 2024 06:21:29 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DEA7E38654B7 for ; Mon, 19 Aug 2024 10:21:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DEA7E38654B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1724062888; bh=V6d5zYspFAGUD13SX3DsDZW6/i8IzpyA8bVKMB0UT8U=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=WtHcdzN4NuCqkZqx8/VJg+QgFGpF1NKNkrk4K4KZBX4OBFPOQRSuDUn9aUBL7kDpv bjSdLYXgGWpzEsLciJaJyTi7kIMHTJ3MvbYNjMxUDQttUhM2GgEDdECBCpJ2ww8Slp kuvG3JICFgmJEbwg4SFu5bjm3SOQj0HgCjdRkBGA= Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by sourceware.org (Postfix) with ESMTPS id A9E27385841E for ; Mon, 19 Aug 2024 10:20:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A9E27385841E ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A9E27385841E ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724062849; cv=none; b=AQSYLsUysfpuscgfNDyw+WwZZ5HQ+TrXazGldg9UDDX3NgNwyTAq1evQ1qDfJf2wqm0FWLdtMUW+8gOPK15cyX9/9kBjU15USuG6jIXHFtu7Y/SrH/XiQJ5qeqqjv6N57KTDzlciiMytAlBRKohXN2IC3P6nyKRqQ+nE73Ux8Tk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724062849; c=relaxed/simple; bh=jThvz3lkekFj34x7OZGS6KcZcT4ZGSGgUQv4aSttTiY=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=hIxPYdYLT8/UMNv6wjpRM9tTk8G7xFq6GzkIOp6qnNjiNh8Iu+qAdNCGvzJ8dVYoyly4fwyZl3UIsnwBRTDLzLDGdA9Q9og/EV3KSnZVxSQnha5xppvn0fzkfJjcOyNdVjRvSytr+F3jW3AIad2PZ489P+T9fWMMtmkXyWBYklI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-e0b7efa1c1bso4275183276.3 for ; Mon, 19 Aug 2024 03:20:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724062847; x=1724667647; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jThvz3lkekFj34x7OZGS6KcZcT4ZGSGgUQv4aSttTiY=; b=wYPt7FREb1JejbyvTlm1rmHxUeJT+KcygTzXhrGGq3/ihS53FrCHFiebdd3H04kFUC /X5h6gG6HmJs+wvv76Ytq5TWBk6xrHmNtFT1+ccGGGk0yaO3lWiqVZvL+cM60DJE1+SH Nzgx6G0CejYZNOvnDzk4tsggzxEr/1Gw4AjvI2U6nOxy1yPrXlg1whjiuoO1m7IxnSQN k3oPp9q5zUhbnIHmkG5XFFLHVVEt/DF00a77S2OMhOL4kjhfr+bsUXTDE7WgdFvAhqBl JBeKpwi3QQJ7tfPXfY80L+E4pqMU6l+4L/oQVJ+jp11PKR8yQ3gg60gnBgddSbSISgoz C2NQ== X-Gm-Message-State: AOJu0YzT6qacnUMc5EXyL82Y7+1RUSradI1nfaIdEURYgJCnpRW64+N9 sN/1WK2kYMIm1AWstTEewn5dR/FTyOMxzZTh5cNVAXsQ8U9yJTsKMVR6dODJYCDSMqWajIF9NSG cGYCSaCEVWECDq1hc4o6EsZ3tRf2DRcHCQuU= X-Google-Smtp-Source: AGHT+IHN3T7EiDohwu8MM3iYIc+e430WwwCkaSBUv6+Godm7QFR3PElqH4QUd1qzjc5jn96KbKFr2zmrmXSbhmnLkK8= X-Received: by 2002:a05:6902:18cd:b0:e0e:af10:ceb4 with SMTP id 3f1490d57ef6-e13d0c76c99mr8541701276.15.1724062846842; Mon, 19 Aug 2024 03:20:46 -0700 (PDT) MIME-Version: 1.0 Date: Mon, 19 Aug 2024 18:20:35 +0800 Message-ID: Subject: How to handle different sizes of pointers in GDB? To: gdb@sourceware.org X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.30 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: Iru Cai via Gdb Reply-To: Iru Cai Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" Hi, I'm porting GDB to a new architecture. Now the application for this architecture has two kinds of pointers in different sizes, one is 32-bit and one is 64-bit. I have done the following things: 1. I use set_gdbarch_addr_bit(gdbarch,64) and set_gdbarch_ptr_bit(gdbarch,64) to set both the addresses and the pointers 64-bit. 2. I tried to add a DW_AT_byte_size and DW_AT_address_class information under each of the pointer type with DW_TAG_pointer_type in the compiler for my new architecture. My program can be like this: int strlen32(const char *s) { /* s is 32-bit ... */ } int strlen64(const _PTR64 char *s) { /* s is 64-bit ... */ } However, GDB doesn't seem to get the correct type when printing the frame arguments in read_frame_arg(), when I debug into strlen32, GDB can make the GDB server crash because GDB is trying to read from a 64-bit address, which it thinks is the value of s. And when I debug this GDB read_frame_arg(), I see the type length of s in strlen32 is still 8 bytes. So is there anything missing to make GDB use the type length information from the DWARF debugging info? Regards, Iru