From patchwork Thu Mar 12 20:03:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 5595 Received: (qmail 97695 invoked by alias); 12 Mar 2015 20:03:25 -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 97684 invoked by uid 89); 12 Mar 2015 20:03:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 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-yk0-f202.google.com Received: from mail-yk0-f202.google.com (HELO mail-yk0-f202.google.com) (209.85.160.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 12 Mar 2015 20:03:22 +0000 Received: by ykp131 with SMTP id 131so2975476ykp.0 for ; Thu, 12 Mar 2015 13:03:20 -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=uDoxgrNUxGS//Q2xOZKJXzeevSqA7b5gOk5+OuV3aQ4=; b=SFStTQoV6+Knj2AnasMFMONTYsMENp3+MIimrqHpvy9tTZ5k97K0Y3Ri0To/qSgrwP 6vdcCMiNLel/KAq/Qhr5hrGVPcxuG7ZqUZpVk4kOSt7pArsvhbfGVmBMWLJh/2javNtk r1XFTYkGrB9hy7E3K73dM4Pbrbd9+gqkUJDg4aPL2yfcaShbMrNPBzfwC0xJFKt6Wc5n 66LwMYCib6FOAvqi91TSWggsFYDOiuHOeTacutNGncnAzxdxhMfY4C//aKDh/4w2LO1K t9JB3fugxDJb2vu2IONFEsi3tcP6jzsMjuYw1VF7y3CRZVgjepL9LQhas8c3ntI4Q/gP 7adA== X-Gm-Message-State: ALoCoQkOGiQlT7+RCrjpCDkoGwsdso39ULL3hCcrYrh7rAO45NvejHEyuYYEU+RwXFeY2Jaq0g/x X-Received: by 10.236.28.230 with SMTP id g66mr45109365yha.2.1426190600805; Thu, 12 Mar 2015 13:03:20 -0700 (PDT) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id 40si418053yho.6.2015.03.12.13.03.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Mar 2015 13:03:20 -0700 (PDT) Received: from ruffy.mtv.corp.google.com ([172.17.128.44]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTPS id kMEwZpuF.1; Thu, 12 Mar 2015 13:03:20 -0700 From: Doug Evans To: gdb-patches@sourceware.org Subject: [PATCH 3/6] DWARF Two Level Line Tables: check_line_address cc: ccoutant@google.com Date: Thu, 12 Mar 2015 13:03:19 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. This patch just factors out the checking of a line address to improve the S/N ratio of the calling function. 2015-03-12 Doug Evans * dwarf2read.c (record_line_ftype): New typedef. (check_line_address): New function. (dwarf_decode_lines_1): Call it. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index d980b1a..fff5474 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -17429,6 +17429,11 @@ psymtab_include_file_name (const struct line_header *lh, int file_index, return include_name; } +/* Function to record a line number. */ + +typedef void (record_line_ftype) (struct subfile *subfile, int line, + CORE_ADDR pc); + /* Ignore this record_line request. */ static void @@ -17528,6 +17533,36 @@ dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile, dwarf_record_line (gdbarch, subfile, 0, address, p_record_line); } +/* Check address and if invalid nop-out the rest of the lines in this + sequence. */ + +static void +check_line_address (struct dwarf2_cu *cu, record_line_ftype **p_record_line, + const gdb_byte *line_ptr, + CORE_ADDR lowpc, CORE_ADDR address) +{ + /* If address < lowpc then it's not a usable value, it's outside the + pc range of the CU. However, we restrict the test to only address + values of zero to preserve GDB's previous behaviour which is to + handle the specific case of a function being GC'd by the linker. */ + + if (address == 0 && address < lowpc) + { + /* This line table is for a function which has been + GCd by the linker. Ignore it. PR gdb/12528 */ + + struct objfile *objfile = cu->objfile; + long line_offset = line_ptr - get_debug_line_section (cu)->buffer; + + complaint (&symfile_complaints, + _(".debug_line address at offset 0x%lx is 0 [in module %s]"), + line_offset, objfile_name (objfile)); + *p_record_line = noop_record_line; + /* Note: *p_record_line is left as noop_record_line + until we see DW_LNE_end_sequence. */ + } +} + /* Subroutine of dwarf_decode_lines to simplify it. Process the line number information in LH. */ @@ -17661,31 +17696,10 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, break; case DW_LNE_set_address: address = read_address (abfd, line_ptr, cu, &bytes_read); - - /* If address < lowpc then it's not a usable value, it's - outside the pc range of the CU. However, we restrict - the test to only address values of zero to preserve - GDB's previous behaviour which is to handle the specific - case of a function being GC'd by the linker. */ - if (address == 0 && address < lowpc) - { - /* This line table is for a function which has been - GCd by the linker. Ignore it. PR gdb/12528 */ - - long line_offset - = line_ptr - get_debug_line_section (cu)->buffer; - - complaint (&symfile_complaints, - _(".debug_line address at offset 0x%lx is 0 " - "[in module %s]"), - line_offset, objfile_name (objfile)); - p_record_line = noop_record_line; - /* Note: p_record_line is left as noop_record_line - until we see DW_LNE_end_sequence. */ - } - - op_index = 0; line_ptr += bytes_read; + check_line_address (cu, &p_record_line, line_ptr, + lowpc, address); + op_index = 0; address += baseaddr; address = gdbarch_adjust_dwarf2_line (gdbarch, address, 0); break;