From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27327 invoked by alias); 13 Apr 2014 07:52:39 -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 27310 invoked by uid 89); 13 Apr 2014 07:52:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qc0-f176.google.com Received: from mail-qc0-f176.google.com (HELO mail-qc0-f176.google.com) (209.85.216.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 13 Apr 2014 07:52:36 +0000 Received: by mail-qc0-f176.google.com with SMTP id m20so7637120qcx.35 for ; Sun, 13 Apr 2014 00:52:34 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.229.54.201 with SMTP id r9mr42319622qcg.6.1397375554853; Sun, 13 Apr 2014 00:52:34 -0700 (PDT) Received: by 10.140.30.74 with HTTP; Sun, 13 Apr 2014 00:52:34 -0700 (PDT) In-Reply-To: References: Date: Sun, 13 Apr 2014 07:52:00 -0000 Message-ID: Subject: Re: [patch] [gdb/testsuite] include a use of the definition of a type to cause clang to emit debug info From: David Blaikie To: gdb-patches Content-Type: multipart/mixed; boundary=001a1135ef4890af0204f6e7d972 X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg00248.txt.bz2 --001a1135ef4890af0204f6e7d972 Content-Type: text/plain; charset=ISO-8859-1 Content-length: 1956 Oh, and there was one other instance of the same issue (I believe these are the only two cases) This test case (gdb.cp/pr10728) seems like it could probably be simplified a great deal, down to: struct foo; foo *f, *g; int main() { } // break and print f - g if I'm not mistaken... - but I've made a relatively small change for now. If preferred, I can make the more substantial simplification suggested. Or otherwise appease clang (by introducing a use of the original 'x' type definition in some other way - dereferencing a pointer, etc). - David On Sat, Apr 12, 2014 at 11:43 PM, David Blaikie wrote: > Clang has an optimization that causes a the debug info to only include > the declaration of a type if the type is referenced but never used in > a context that requires a definition (eg: pointers are handed around > but never deferenced). > > This patch introduces a variable to one test file to cause clang to > emit the full definition of the type as well as fixing up a related > typo in the test message of the associated expect file. > > Like the difference between GCC and Clang in the emission of unused > static entities, I think this case is also a matter of degrees - both > GCC and Clang implement other similar optimizations* to the one > outlined here and the GDB test suite has managed to pass without > disabling those optimizations in GCC and I hope it's suitable to do > the same for Clang. > > Though admittedly I don't have much of the context of the history of > the testsuite, its priorities/preferences when it comes to > distinguishing testing compiler behavior versus debugger behavior, > etc. > > * the one I know of involves dynamic types: both GCC and Clang only > emit the debug info definition of such a type in any translation unit > that emits the key function. This means in many contexts where a full > definition is provided in the source only a declaration is provided in > the debug info. --001a1135ef4890af0204f6e7d972 Content-Type: text/plain; charset=US-ASCII; name="pr10728-full-type.diff" Content-Disposition: attachment; filename="pr10728-full-type.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hty19b8v1 Content-length: 2457 Y29tbWl0IDI0YTg4MTBhOTcxNTU3MTBkM2M1M2I0MDFlYjg3MjliYzRmODBj MDAKQXV0aG9yOiBEYXZpZCBCbGFpa2llIDxkYmxhaWtpZUBnbWFpbC5jb20+ CkRhdGU6ICAgU3VuIEFwciAxMyAwMDo0ODo0NSAyMDE0IC0wNzAwCgogICAg UmV0dXJuIGJ5IHZhbHVlIHRvIGNvYXggQ2xhbmcgaW50byBlbWl0dGluZyB0 aGUgZnVsbCBkZWZpbml0aW9uIG9mIGEgdGVzdCB0eXBlLgogICAgCiAgICBn ZGIvdGVzdHN1aXRlLwogICAgCSogZ2RiLmNwL3ByMTA3MjgteC5jYzogUmV0 dXJuIGJ5IHZhbHVlIGluc3RlYWQgb2YgcG9pbnRlciB0byBjb2F4CiAgICAJ Q2xhbmcgaW50byBlbWl0dGluZy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