From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102106 invoked by alias); 27 Apr 2016 18:27:33 -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 102051 invoked by uid 89); 27 Apr 2016 18:27:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=shake, leftover, him X-HELO: gproxy2-pub.mail.unifiedlayer.com Received: from gproxy2-pub.mail.unifiedlayer.com (HELO gproxy2-pub.mail.unifiedlayer.com) (69.89.18.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Wed, 27 Apr 2016 18:27:23 +0000 Received: (qmail 4424 invoked by uid 0); 27 Apr 2016 18:27:20 -0000 Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy2.mail.unifiedlayer.com with SMTP; 27 Apr 2016 18:27:20 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id nWTH1s00R2f2jeq01WTLcw; Wed, 27 Apr 2016 12:27:20 -0600 X-Authority-Analysis: v=2.1 cv=aJ5j99Nm c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=PnD2wP_eR3oA:10 a=_v2sUkyEFrwA:10 a=kziv93cY1bsA:10 a=F73wUepzvVnpnC1l6DEA:9 Received: from [71.215.116.141] (port=59630 helo=pokyo) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.86_2) (envelope-from ) id 1avUBB-0001Ox-0u; Wed, 27 Apr 2016 12:27:17 -0600 From: Tom Tromey To: Pedro Alves Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH 6/8] Add support for the Rust language References: <1461725371-17620-1-git-send-email-tom@tromey.com> <1461725371-17620-7-git-send-email-tom@tromey.com> <5720A5E4.2020603@redhat.com> Date: Wed, 27 Apr 2016 18:27:00 -0000 In-Reply-To: <5720A5E4.2020603@redhat.com> (Pedro Alves's message of "Wed, 27 Apr 2016 12:43:32 +0100") Message-ID: <87y47yc3ge.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Identified-User: {36111:box522.bluehost.com:elynrobi:tromey.com} {sentby:smtp auth 71.215.116.141 authed with tom+tromey.com} X-SW-Source: 2016-04/txt/msg00605.txt.bz2 >> + /* Rust does not currently emit DW_LANG_Rust or DW_LANG_Rust_old. Pedro> "Currently" is a moving target. Could you replace it with some Pedro> version number or some such? Yeah, good idea. Eli suggested something similar in the docs as well. It turns out that the patch to drop DW_LANG_Rust didn't go in yet, since it causes an assertion failure in LLVM. This will probably shake out before the copyright assignments are done anyway. >> +#define RUSTDEBUG 1 /* Default to debug support */ Pedro> Is this referenced anywhere, or a leftoever from when this used Pedro> the bison prefix support? Just a leftover. >> + /* We treat this differently than Ada. */ Pedro> What does "differently" mean? I removed this comment, but basically Rust reuses the OP_AGGREGATE name, but not the layout in the expression structure. This seems weird, but it was handy, and it's already done elsewhere in gdb. Pedro> Similar to the Fortran opcode, did you think about promoting Pedro> OP_AGGREGATE out of ada-operator.def ? Nope! There's no big difference between std-operator.def and ada-operator.def now... just maybe whether op_name_standard handles the operator or not. >> + if (TYPE_CODE (type) == TYPE_CODE_NAMESPACE) >> + goto got_ns; Pedro> This goto will probably need to go away with C++-ification. Pedro> Maybe the got_ns label label could be a helper function, called here, Pedro> and where it is currently defined. However, other .y files use Pedro> gotos as well, so guess it shouldn't be a requirement. I rearranged this a bit to avoid the goto. >> + >> +/* The parser error handler. */ >> + >> +void >> +rustyyerror (char *msg) >> +{ >> + const char *where = prev_lexptr ? prev_lexptr : lexptr; >> + error (_("A %s in expression, near `%s'."), (msg ? msg : "error"), where); Pedro> _("error"), I suppose. I note this expands to the non-grammatical "A error". Pedro> Maybe reword to avoid it? Maybe drop the "A" ? I dropped the "A". I actually copied this function from c-exp.y. Maybe this is another wart -- every .y has to implement this function but it seems to me that there's no great reason for it. >> +static struct disr_info >> +rust_get_disr_info (struct type *type, const gdb_byte *valaddr, Pedro> Did you mean to name these discr_info and rust_get_discr_info ? Pedro> I mean, the missing 'c'. Manish wrote this part -- but not to blame him, this actually mirrors what is done in the Rust compiler. I don't know why that abbreviation was chosen by Rust. However, it is visible in the debuginfo, as enum discriminants can be named "RUST$ENUM$DISR". Tom