From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19368 invoked by alias); 23 Nov 2009 19:57:28 -0000 Received: (qmail 19359 invoked by uid 22791); 23 Nov 2009 19:57:27 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Nov 2009 19:57:21 +0000 Received: from wpaz29.hot.corp.google.com (wpaz29.hot.corp.google.com [172.24.198.93]) by smtp-out.google.com with ESMTP id nANJvG7K019487 for ; Mon, 23 Nov 2009 19:57:17 GMT Received: from pwi9 (pwi9.prod.google.com [10.241.219.9]) by wpaz29.hot.corp.google.com with ESMTP id nANJvEcU011721 for ; Mon, 23 Nov 2009 11:57:14 -0800 Received: by pwi9 with SMTP id 9so4110795pwi.26 for ; Mon, 23 Nov 2009 11:57:14 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.150.41 with SMTP id x41mr570769wfd.243.1259006222208; Mon, 23 Nov 2009 11:57:02 -0800 (PST) In-Reply-To: <20091123141622.GA23363@bromo.med.uc.edu> References: <20091121034258.GA6166@bromo.med.uc.edu> <20091122110259.GA9268@host0.dyn.jankratochvil.net> <20091122202148.GA12580@bromo.med.uc.edu> <20091123124226.GA7742@host0.dyn.jankratochvil.net> <20091123141622.GA23363@bromo.med.uc.edu> Date: Tue, 24 Nov 2009 19:15:00 -0000 Message-ID: Subject: Re: check for valid location of zero length dwarf block forms? From: Cary Coutant To: Jack Howarth Cc: Jan Kratochvil , gdb@sourceware.org, Dodji Seketeli Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-11/txt/msg00179.txt.bz2 > I wonder if I could just do something like... > > =A0 =A0 =A0 case dw_val_class_loc: > =A0 =A0 =A0 =A0 =A0size =3D size_of_locs (AT_loc (a)); > > =A0 =A0 =A0 =A0 =A0/* Output the block length for this list of location o= perations. =A0*/ > =A0 =A0 =A0 =A0 =A0dw2_asm_output_data (constant_size (size), size, "%s",= name); > > =A0 =A0 =A0 =A0 =A0if (dwarf_strict && (size =3D=3D 0)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > =A0 =A0 =A0 =A0 =A0else > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0output_loc_sequence (AT_loc (a)); > =A0 =A0 =A0 =A0 =A0break; By the time we get to output_die(), the abbrev code has already been chosen, DIE offsets have been calculated, and a DW_AT_location attribute of a known size is expected. Skipping it completely here will break the DWARF output. I think what you would want to do instead is change resolve_addr() either to remove the DW_AT_location attribute from the DIE instead of setting dw_attr_val.v.val_loc to NULL, or to set dw_attr_val.v.val_loc to a DWARF expression containing nothing but DW_OP_nop. In the dw_val_class_loc_list case, I'm not sure if the Apple tool is picky enough to complain about zero-length location expressions there, too; if it is, you'll either need to remove a NULL expr from the location list, or set it to a DW_OP_nop as well. I haven't looked to see if there are other places besides resolve_addr() that might generate a null location expression. In the long run, though, the Apple tools should be fixed. An empty DWARF location expression is well defined and valid. -cary