From patchwork Thu Jul 20 21:00:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 791761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-458616-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wDO0okAo"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xD5sm0MgNz9s71 for ; Fri, 21 Jul 2017 07:01:14 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=K6uIZGJx2twyBCZsx 5sPcBCvOILROj1fwdJoI92XqHZMiyUTB01zfYVQnFGVAoQ5t4lpJtmW3l+LC+b5H D9J0DGmssr9AHgGImdAxWxa77qIP4BE6+D5uDbOAW6OLH8P8/aSOY9qcljwgRQP2 Kd8YgbuFUFJQHTs48w0PZsFlCg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=BvFGllEhL+QZq/H3vC6rkih 8lTo=; b=wDO0okAo292/0C+mE5cYyCbTUZCSyWkLnD23t3Nj2pO4NStJtX/d+MA QzD7QZ8v0nBKu7rYAqOKSjVqsOu8WvScG7QN8ILJINsoBBivRiO0XBN0STh/RqmF WM19wtZ/w1uySVBJEwj2qDVD5U4apCH0YImh0Xu4fKkoxyl4wtJE= Received: (qmail 2666 invoked by alias); 20 Jul 2017 21:00:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 108591 invoked by uid 89); 20 Jul 2017 21:00:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*wilson X-HELO: mail-yb0-f173.google.com Received: from mail-yb0-f173.google.com (HELO mail-yb0-f173.google.com) (209.85.213.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Jul 2017 21:00:37 +0000 Received: by mail-yb0-f173.google.com with SMTP id 74so8976776ybf.3 for ; Thu, 20 Jul 2017 14:00:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:references:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=YsBMMLShn6MT4LkcQcd/Dxw4k5k1KdsnRzZTgCYnq14=; b=npTEMlU25msQwUzQJX5U8FNvaDIejdxO5vA1CpPVzAJBCaxdAo6kzJ/O8bjQjHhUzu WcIBJpuc0VXkRG89Fxiwv7AtbOPE19qqKfnD7GRZngo2VjV+Cg+PfH1Q7/POpMjHmnI1 FyiWWa2gL1MetmweP/9tkKCZDYnY85rVBdoBjOpmEWLY0Ty4usa6DFjcUd+3f2sXMX20 t4xouserq6zvSKfr0+P1/Pum6hBK08HHXJFrA9Mx4NB08E/IxuuB0CpVqwFhgvT1I0VS /5nohtEYheq6wy7hIrfsAmEdk/vKNxKHNez2SOujnzUak5MVwm0nmk1Ram7hHQm2NCi1 LMPw== X-Gm-Message-State: AIVw110PYbyZV/0bpktQCmRhYp/D/66L32hWaEAP5eWS3mVcXVx5kSsD XPSFn5yBgSxspQ== X-Received: by 10.37.244.9 with SMTP id q9mr4319534ybd.341.1500584435291; Thu, 20 Jul 2017 14:00:35 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254? ([2620:10d:c091:200::3:fb48]) by smtp.googlemail.com with ESMTPSA id z20sm1142147ywa.27.2017.07.20.14.00.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jul 2017 14:00:34 -0700 (PDT) Subject: Re: [PATCH] Kill TYPE_METHODS debug 1/9 From: Nathan Sidwell To: Jim Wilson , GCC Patches Cc: Jason Merrill , Richard Guenther , Jim Wilson , Jan Hubicka References: <8377f2cd-577c-60b2-63ac-f2619ebe63aa@acm.org> <6af64e4b-403e-2b88-3067-cd0dc4da64d8@linaro.org> <000f20c2-86fb-9d71-dc66-03167de00142@acm.org> <0be1446d-d866-f3b9-8691-3df4cc088211@acm.org> Message-ID: Date: Thu, 20 Jul 2017 17:00:32 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <0be1446d-d866-f3b9-8691-3df4cc088211@acm.org> A bit more poking showed that dbx's desire to put all methods of the same name in a single record was significant -- gdb requires that to build an overload set. So, this version of the dbxout changes is much smaller, in that we iterate the TYPE_FIELDS twice. There's the original scan, which just needs to now skip FUNCTION_DECLs as well. The method emission routine now iterates over TYPE_FIELDS again, skipping everything that is not a FUNCTION_DECL. I preserve the previous behaviour of merging decls with the same name -- of course it'll still fail in the same manner if you declare overloads discontigously. With this patch the gdb stabs test results are still awful, but they are unchanged awfulness. nathan 2017-07-20 Nathan Sidwell * dbxout.c (dbxout_type_fields): Ignore FUNCTION_DECLs. (dbxout_type_methods): Scan TYPE_FIELDS. (dbxout_type): Don't check TYPE_METHODS here. Index: dbxout.c =================================================================== --- dbxout.c (revision 250318) +++ dbxout.c (working copy) @@ -1481,6 +1481,8 @@ dbxout_type_fields (tree type) /* Omit here local type decls until we know how to support them. */ if (TREE_CODE (tem) == TYPE_DECL || TREE_CODE (tem) == TEMPLATE_DECL + /* Member functions emitted after fields. */ + || TREE_CODE (tem) == FUNCTION_DECL /* Omit here the nameless fields that are used to skip bits. */ || DECL_IGNORED_P (tem) /* Omit fields whose position or size are variable or too large to @@ -1586,55 +1588,38 @@ dbxout_type_method_1 (tree decl) } } -/* Subroutine of `dbxout_type'. Output debug info about the methods defined - in TYPE. */ +/* Subroutine of `dbxout_type'. Output debug info about the member + functions defined in TYPE. */ static void dbxout_type_methods (tree type) { - /* C++: put out the method names and their parameter lists */ - tree methods = TYPE_METHODS (type); - tree fndecl; - tree last; - - if (methods == NULL_TREE) - return; - - if (TREE_CODE (methods) != TREE_VEC) - fndecl = methods; - else if (TREE_VEC_ELT (methods, 0) != NULL_TREE) - fndecl = TREE_VEC_ELT (methods, 0); - else - fndecl = TREE_VEC_ELT (methods, 1); - - while (fndecl) + for (tree fndecl = TYPE_FIELDS (type); fndecl;) { int need_prefix = 1; /* Group together all the methods for the same operation. These differ in the types of the arguments. */ - for (last = NULL_TREE; + for (tree last = NULL_TREE; fndecl && (last == NULL_TREE || DECL_NAME (fndecl) == DECL_NAME (last)); fndecl = DECL_CHAIN (fndecl)) /* Output the name of the field (after overloading), as well as the name of the field before overloading, along with its parameter list */ { - /* Skip methods that aren't FUNCTION_DECLs. (In C++, these - include TEMPLATE_DECLs.) The debugger doesn't know what - to do with such entities anyhow. */ + /* Skip non-functions. */ if (TREE_CODE (fndecl) != FUNCTION_DECL) continue; - CONTIN; - - last = fndecl; - /* Also ignore abstract methods; those are only interesting to the DWARF backends. */ if (DECL_IGNORED_P (fndecl) || DECL_ABSTRACT_P (fndecl)) continue; + CONTIN; + + last = fndecl; + /* Redundantly output the plain name, since that's what gdb expects. */ if (need_prefix) @@ -2209,10 +2194,8 @@ dbxout_type (tree type, int full) /* Write out the field declarations. */ dbxout_type_fields (type); - if (use_gnu_debug_info_extensions && TYPE_METHODS (type) != NULL_TREE) - { - dbxout_type_methods (type); - } + if (use_gnu_debug_info_extensions) + dbxout_type_methods (type); stabstr_C (';');