From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id B0QFOTnl7WBwGAAAWB0awg (envelope-from ) for ; Tue, 13 Jul 2021 15:10:49 -0400 Received: by simark.ca (Postfix, from userid 112) id DA61A1EDEE; Tue, 13 Jul 2021 15:10:49 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: ** X-Spam-Status: No, score=2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FSL_HELO_FAKE,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=no 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 8F0DB1E01B for ; Tue, 13 Jul 2021 15:10:49 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9F57396E87D for ; Tue, 13 Jul 2021 19:10:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9F57396E87D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626203448; bh=LV6zpglGlWxhTOi+DQ/GiXY50FwMbNZuW4IMxgw/k7o=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=SOpN9OWYQRVzvMivH9oRWo9veH8ruFsQ2dcGAUYMg4cAYQG0NyrnV1Qgwk3AtBLVO SiT8mCT0wdqAu85GQMLnXX2TS3Uk7BuF43ahAL5rUG5+hql1id5v8KLdNvUoVLWZx/ 3IvfLpQT7jfOHdL/cepiHFnWqISPk/Z1hBh1du78= Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 0EC8E396E87A for ; Tue, 13 Jul 2021 19:08:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0EC8E396E87A Received: by mail-ej1-x632.google.com with SMTP id c17so43343092ejk.13 for ; Tue, 13 Jul 2021 12:08:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-description:content-disposition; bh=LV6zpglGlWxhTOi+DQ/GiXY50FwMbNZuW4IMxgw/k7o=; b=OreuTqmfsrEE7U1lwrQ/gn/9d3duBYrsag8Vx+b+IvJQjadKFomLH0wx6bpYxqkn/k 9Y0i/zXxVwjfai0EW3P6GJPDkarn1Vdas2YNNV3QYHiYexlDUXSEvstreUG4amwMIcPF gxvu6BdmoXsdPSzSsFkSZY+1Gigor9WCMvxu2JMyl5axwuwzgvAFb72fKcOmTI6E/Qyr uFBzi/z1HHo8fY6TiUs6+6MpCyBTOIvxrlVjbcSiwh8YLqrid+jmQadAJShK6ffG/ylQ 2ee7/RZpJMCevojOE3vmt96n0WsIc56htkb36JJ7tX/Alcxkvg3DJUiRIYg2D7PZfyhd P3Qg== X-Gm-Message-State: AOAM530pgir2SdjoAjYtsigmNiL9LHInRjfe6Xc7Hb5paRgBd5+9gSUq ml5shBhwrWohKhHWEEfT3SbQ3RCWnOU= X-Google-Smtp-Source: ABdhPJwxTo+VBFoITSIl5ql7wTTG9G8XDbDVJr+gsbKq4NtdTuhZ5nTLahSqJ9RyNG1Be8Zwxl4Ktw== X-Received: by 2002:a17:906:6047:: with SMTP id p7mr7466078ejj.206.1626203312199; Tue, 13 Jul 2021 12:08:32 -0700 (PDT) Received: from gmail.com ([2a03:1b20:3:f011::13d]) by smtp.gmail.com with ESMTPSA id i10sm4272093edf.12.2021.07.13.12.08.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 12:08:31 -0700 (PDT) Date: Tue, 13 Jul 2021 21:08:54 +0200 To: gdb@sourceware.org Subject: Custom types in target description XMLs Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Description: issue Content-Disposition: inline X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Shahab Vahedi via Gdb Reply-To: Shahab Vahedi Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" Hello, I have difficulties defining a custom register type in a target description XML format. For the sake of argument, consider the 32-bit register below with it's own contrived fields: bit: 31 ... 11 10 9 8 7 ... 0 ,-----------------.---.---.---.---------. | dont_care_field | g | u | b | version | `-----------------^---^---^---^---------' I've come up with two definitions. One uses the "flag" and the other uses the "struct" type. However, both have their issues in representing the correct values. The definitions are as follows: -----------------------------8<----------------------------- ----------------------------->8----------------------------- The value reported by GDBstub (QEMU) is 0x1337 for both registers: 0 x 1 3 3 7 0001 0011 0011 0111 version: 0x37 (55) b: true u: true g: false However, this is how GDB prints them: ---------------------- [ gdb ] ---------------------- (gdb) info reg $f_reg f_reg 0x1337 [ version=0 b u ] ----------------------------------------------------- Here, while "$f_reg" holds the correct value (0x1337), the "version" field is 0 instead of 55. "b", "u", and "g" fields are inferred correctly though. ---------------------- [ gdb ] ---------------------- (gdb) info reg $s_reg s_reg { version = 0x37, b = 0xff, u = 0xff, g = 0x0 } { version = 55, b = -1, u = -1, g = false } ----------------------------------------------------- The register with struct type on the other hand, interprets "version" correctly while misjudging the "boolean" fields that are set. Am I doing something wrong or this could be a bug in parsing? If latter is the case, I will dive into the code to find the root cause. I just need someone to confirm it first. Thanks, Shahab