From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 From: Shahab Vahedi 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FSL_HELO_FAKE, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 13 Jul 2021 19:08:34 -0000 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