From patchwork Thu Oct 16 20:32:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 3253 Received: (qmail 16940 invoked by alias); 16 Oct 2014 20:32:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 16929 invoked by uid 89); 16 Oct 2014 20:32:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-yh0-f74.google.com Received: from mail-yh0-f74.google.com (HELO mail-yh0-f74.google.com) (209.85.213.74) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 16 Oct 2014 20:32:45 +0000 Received: by mail-yh0-f74.google.com with SMTP id f73so331098yha.5 for ; Thu, 16 Oct 2014 13:32:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:cc:date:message-id:mime-version :content-type; bh=DCHXdMfRpDBd1mXkoMYhoS1QcxeYQ3l/Xs7BO52rhXo=; b=VeDJJeGLktnK4D18PiO/eS/K4WVxcBpfKi6ViC+qk4Id0x1c+lnXUW6ZL2FEx8qaoS C/BnP7A4E6UWRRL79gArvep7NuHUA+SxEWvQjxikfOAWP59F1pYoDvoEgfd398PXjbS6 3lUsGOZSG7ey3P9As+Unc49pRC2sxXZaZDqCq8iRIXW8ZUH4ISe58v/BwWgFszRERkDz uMuyvtTzHp2iVJSg0MAKdNqKXIynHgQfSDE2MW2oL6Da36cSb0HWANEWKmTl4E9eJBZ2 Zh3g66hMN+/DfmuYh+kKh0WA6SEpUlDtwxEDlVbItgJo7wlPcEAaDEpgF1+xA/pQp8um F40A== X-Gm-Message-State: ALoCoQl4X1/znGCBUGQmX+Zij0fOOkmt2vzKnheWRZXNq6z0ndoEIzWf+zQpkTCJ2e6Y51UDBNEG X-Received: by 10.236.4.106 with SMTP id 70mr2500922yhi.33.1413491563035; Thu, 16 Oct 2014 13:32:43 -0700 (PDT) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id s23si1022408yhf.0.2014.10.16.13.32.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Oct 2014 13:32:43 -0700 (PDT) Received: from ruffy.mtv.corp.google.com ([172.17.128.44]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTPS id 6RKwVPYA.1; Thu, 16 Oct 2014 13:32:42 -0700 From: Doug Evans To: gdb-patches@sourceware.org Subject: [PATCH] dwarf2read.c (dwarf2_attach_fields_to_type): Add comment. cc: ccoutant@google.com Date: Thu, 16 Oct 2014 13:32:42 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. This patch just adds a comment to dwarf2_attach_fields_to_type. I have some python code that makes use of field ordering of static class members, which the dwarf spec supports. "5.5.1 Structure, Union and Class Type Entries .... The members of a structure, union, or class are represented by debugging information entries that are owned by the corresponding structure type, union type, or class type entry and appear in the same order as the corresponding declarations in the source program." This comment documents this so that the reader knows there is an explicit reason for preserving the order. 2014-10-16 Doug Evans * dwarf2read.c (dwarf2_attach_fields_to_type): Add comment. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index eccd11a..c97e0da 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -12500,7 +12500,12 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, /* Copy the saved-up fields into the field vector. Start from the head of the list, adding to the tail of the field array, so that they end up in - the same order in the array in which they were added to the list. */ + the same order in the array in which they were added to the list. + + N.B. The DWARF spec says that member DIEs appear in the same order as in + the source program (DWARF4 Structure, Union, and Class Type Entries, + section 5.5.1. Users (e.g. python code) may be relying on this rule. */ + while (nfields-- > 0) { struct nextfield *fieldp;