From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id t86SAopvkGCVTQAAWB0awg (envelope-from ) for ; Mon, 03 May 2021 17:47:54 -0400 Received: by simark.ca (Postfix, from userid 112) id EE20C1F11C; Mon, 3 May 2021 17:47:53 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 3E7111E813 for ; Mon, 3 May 2021 17:47:53 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A1F86393BC37; Mon, 3 May 2021 21:47:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A1F86393BC37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620078472; bh=7JrP1k6h86t0ZjTNqKiQxmk7EnAeeoAir8nniep7Npk=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Laqa8QrLdsbBSofzUCdZeHdMPl3VvPt5g3X1vec3hRWJo4e6600uoaZdiHXbJNouU 07TAbSnHmpMV4HYthsAOBHsGvkNTUjyR3ksEGesrjb1uXdpTeONPyVflT6aoiX3RJd QtgnqTuorl/U1EDm0SVi0I/JCMFSQPL0VGn4i+LQ= Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by sourceware.org (Postfix) with ESMTPS id 9820D393BC36 for ; Mon, 3 May 2021 21:47:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9820D393BC36 Received: by mail-qk1-x729.google.com with SMTP id i17so6698966qki.3 for ; Mon, 03 May 2021 14:47:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=7JrP1k6h86t0ZjTNqKiQxmk7EnAeeoAir8nniep7Npk=; b=nM2TybbrR/E8Vo8nQoRWN7hNh4YOeb8WWoPEJ5v56nA0hDLC4E1rldMcixC2p+LGfi cpwLt0Ap/HPSM4J33ILy4UAo7WdtSVP+9h8/Rz5j6smrdn9hxIa94W1BK+WtkwwNC6Tl KoVLp30ej47qLerfcbWtXSkiFsVJcKv4h7+CwcuZm+601wwy8nSU5c+bl+9JU3wGo8N9 5UdhM6SKeSNxXtelKqr0lK6b5icV+QaIL70+GBeh20tBDa8bjp12FELt1W0ch5rgWJ+m zxTvq43mrkg5r1dRTPGZG+sZt18RLC71CnTK04J0QfjRBgNtWd/kMVnLkRYrL7/d/FmL on/A== X-Gm-Message-State: AOAM532hdHTCmOK1AryXgvygE7PJbcjqV0EADPjFsXM/nm8kNefkGx8/ 6Uu6VO1xLnscWDAW5uoUHS/bnghUqNPAbmz7az69uA== X-Google-Smtp-Source: ABdhPJz7HWKLPvUKHKCoc/XJ5B26/dyVG9wrzgosa0S1jMn8I3h6Nruj8H3oZW6K1c0UnBNafg+Dd6n4r7FjYKl/HlM= X-Received: by 2002:a37:658a:: with SMTP id z132mr21847386qkb.28.1620078468964; Mon, 03 May 2021 14:47:48 -0700 (PDT) MIME-Version: 1.0 References: <20210501202929.29766-1-vapier@gentoo.org> In-Reply-To: Date: Mon, 3 May 2021 16:47:12 -0500 Message-ID: Subject: Re: [PATCH/committed] sim: rx: cast bfd_vma when printing To: Christian Biesinger , gdb-patches Content-Type: text/plain; charset="UTF-8" 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: , From: Christian Biesinger via Gdb-patches Reply-To: Christian Biesinger Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On Mon, May 3, 2021 at 3:57 PM Mike Frysinger wrote: > > On 03 May 2021 11:20, Christian Biesinger wrote: > > On Sat, May 1, 2021, 15:29 Mike Frysinger wrote: > > > A bit of a hack, but it's what we've been doing so far when printing > > > bfd_vma's since bfd doesn't provide PRI helper types for us to use. > > > > > > --- a/sim/rx/load.c > > > +++ b/sim/rx/load.c > > > @@ -151,7 +151,7 @@ rx_load (bfd *prog, host_callback *callback) > > > } > > > if (bfd_bread (buf, size, prog) != size) > > > { > > > - fprintf (stderr, "Failed to read %lx bytes\n", size); > > > + fprintf (stderr, "Failed to read %lx bytes\n", (long) size); > > > > Wouldn't it be better to use "long long", especially for mingw? > > not sure why mingw is special here. but let's ignore that. mingw (and msvc) is special because sizeof(long) is 4, even on a 64-bit system. https://stackoverflow.com/questions/22344388/size-of-long-int-and-int-in-c-showing-4-bytes > bfd_vma printing is poorly handled in many places in sim when bfd_vma is 64-bit > but the host cpu is 32-bit (i.e. sizeof(long) == 4). the (long) cast pattern > that i used here for printing is based on those. i don't think sim is the only > place that does this poorly tbh, it's just what i'm focusing on. But if other places already do that, then eh... Christian