From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23574 invoked by alias); 23 Jun 2018 20:22:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23559 invoked by uid 89); 23 Jun 2018 20:22:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Union, outermost, ptype X-HELO: gateway31.websitewelcome.com Received: from gateway31.websitewelcome.com (HELO gateway31.websitewelcome.com) (192.185.143.33) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 23 Jun 2018 20:22:31 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 38757980B for ; Sat, 23 Jun 2018 15:22:30 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id Wp3Gf6MO4aSeyWp3GfmktA; Sat, 23 Jun 2018 15:22:30 -0500 X-Authority-Reason: nr=8 Received: from 75-166-79-120.hlrn.qwest.net ([75.166.79.120]:40170 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fWp3G-0012UF-0M for gdb-patches@sourceware.org; Sat, 23 Jun 2018 15:22:30 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [RFA 0/2] Support ptype/o in Rust Date: Sat, 23 Jun 2018 20:22:00 -0000 Message-Id: <20180623202227.17259-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fWp3G-0012UF-0M X-Source-Sender: 75-166-79-120.hlrn.qwest.net (bapiya.Home) [75.166.79.120]:40170 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2018-06/txt/msg00554.txt.bz2 This adds support for ptype/o to the Rust code. The first patch slightly refactors the existing ptype/o code. The utility functions are now public methods on struct print_offset_data. The second patch changes the Rust language code. I would self-approve this one but it required a change outside of Rust. Perhaps this check ought to have been a flag on the language_defn. I noticed that ptype/o generates somewhat funny output: /* offset | size */ type = union simple::Union { /* 1 */ f1: i8, /* 1 */ f2: u8, /* total size (bytes): 1 */ } Here, I think it might be cleaner to put the "total size" information on the same line as the trailing "}" (and of course not indent it), like: /* offset | size */ type = union simple::Union { /* 1 */ f1: i8, /* 1 */ f2: u8, /* total size 1 */ } If you agree I can at least file a bug or maybe implement it. Additionally I noticed that in C, in most cases fields are indented 4 spaces, but with ptype/o the outermost fields are only indented 2 spaces (relative to the "type =" text). I think this is probably unintended as well, but I thought I'd ask... ? Regression tested on x86-64 Fedora 26. Tom