From patchwork Fri Mar 4 16:40:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 340 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:41:50 -0000 Delivered-To: patches@linaro.org Received: by 10.224.60.68 with SMTP id o4cs20851qah; Fri, 4 Mar 2011 08:40:13 -0800 (PST) Received: by 10.227.172.193 with SMTP id m1mr726299wbz.201.1299256812385; Fri, 04 Mar 2011 08:40:12 -0800 (PST) Received: from mtagate6.uk.ibm.com (mtagate6.uk.ibm.com [194.196.100.166]) by mx.google.com with ESMTPS id z68si4498480wej.57.2011.03.04.08.40.10 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2011 08:40:11 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning uweigand@de.ibm.com does not designate 194.196.100.166 as permitted sender) client-ip=194.196.100.166; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning uweigand@de.ibm.com does not designate 194.196.100.166 as permitted sender) smtp.mail=uweigand@de.ibm.com Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate6.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p24GeA80030577 for ; Fri, 4 Mar 2011 16:40:10 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p24GeMfw1744982 for ; Fri, 4 Mar 2011 16:40:22 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p24GeAGc007328 for ; Fri, 4 Mar 2011 09:40:10 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p24Ge8FW007308 for ; Fri, 4 Mar 2011 09:40:09 -0700 Message-Id: <201103041640.p24Ge8FW007308@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 04 Mar 2011 17:40:08 +0100 Subject: [rfc] Skip empty range entries in DW_AT_ranges To: patches@linaro.org Date: Fri, 4 Mar 2011 17:40:08 +0100 (CET) From: "Ulrich Weigand" X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 http://sourceware.org/ml/gdb-patches/2011-02/msg00048.html ChangeLog: * dwarf2read.c (dwarf2_ranges_read): Skip empty range entries. Complain about inverted range entries. (dwarf2_record_block_ranges): Likewise. Index: gdb/dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.496 diff -u -p -r1.496 dwarf2read.c --- gdb/dwarf2read.c 25 Jan 2011 17:25:12 -0000 1.496 +++ gdb/dwarf2read.c 3 Feb 2011 19:02:27 -0000 @@ -5863,10 +5863,22 @@ dwarf2_ranges_read (unsigned offset, COR return 0; } + if (range_beginning > range_end) + { + /* Inverted range entries are invalid. */ + complaint (&symfile_complaints, + _("Invalid .debug_ranges data (inverted range)")); + return 0; + } + + /* Empty range entries have no effect. */ + if (range_beginning == range_end) + continue; + range_beginning += base; range_end += base; - if (ranges_pst != NULL && range_beginning < range_end) + if (ranges_pst != NULL) addrmap_set_empty (objfile->psymtabs_addrmap, range_beginning + baseaddr, range_end - 1 + baseaddr, @@ -6149,6 +6161,19 @@ dwarf2_record_block_ranges (struct die_i return; } + if (start > end) + { + /* Inverted range entries are invalid. */ + complaint (&symfile_complaints, + _("Invalid .debug_ranges data " + "(inverted range)")); + return; + } + + /* Empty range entries have no effect. */ + if (start == end) + continue; + record_block_range (block, baseaddr + base + start, baseaddr + base + end - 1);