From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32319 invoked by alias); 20 Oct 2011 18:49:22 -0000 Received: (qmail 32308 invoked by uid 22791); 20 Oct 2011 18:49:21 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BJ,TW_GD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 Oct 2011 18:49:07 +0000 Received: from hpaq3.eem.corp.google.com (hpaq3.eem.corp.google.com [172.25.149.3]) by smtp-out.google.com with ESMTP id p9KIn52f004904 for ; Thu, 20 Oct 2011 11:49:05 -0700 Received: from qyk2 (qyk2.prod.google.com [10.241.83.130]) by hpaq3.eem.corp.google.com with ESMTP id p9KIlBlo013284 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 20 Oct 2011 11:49:04 -0700 Received: by qyk2 with SMTP id 2so4631676qyk.8 for ; Thu, 20 Oct 2011 11:49:04 -0700 (PDT) Received: by 10.100.39.15 with SMTP id m15mr2687181anm.130.1319136544619; Thu, 20 Oct 2011 11:49:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.39.15 with SMTP id m15mr2687173anm.130.1319136544440; Thu, 20 Oct 2011 11:49:04 -0700 (PDT) Received: by 10.100.154.19 with HTTP; Thu, 20 Oct 2011 11:49:04 -0700 (PDT) In-Reply-To: <20111020145541.GA31871@host1.jankratochvil.net> References: <20111020145541.GA31871@host1.jankratochvil.net> Date: Thu, 20 Oct 2011 19:16:00 -0000 Message-ID: Subject: Re: Regression for .debug_types [Re: [patch] Allow dummy CUs created by incremental linker] From: Cary Coutant To: Jan Kratochvil Cc: Tom Tromey , gdb-patches@sourceware.org, Doug Evans Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true X-IsSubscribed: yes 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 X-SW-Source: 2011-10/txt/msg00570.txt.bz2 > I did not debug it yet but it is a regression for many testcases iff > .debug_types are used. Sorry, this patch fixes the problem. In process_psymtab_comp_unit, if it was scanning a type unit, it was adjusting the info_ptr after my check for a 0 abbrev code. It turns out that first_die_offset is also set too early, so I moved the adjustment into partial_read_comp_unit_head. Running the tests now, with -gdwarf4 explicitly turned on. -cary 2011-10-20 Cary Coutant * dwarf2read.c (dw2_get_file_names): Move adjustment for type section to... (partial_read_comp_unit_head): ...here. Add is_debug_type_section flag. Adjust all callers. (process_psymtab_comp_unit): Remove adjustment for type section. Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.576 diff -u -p -r1.576 dwarf2read.c --- dwarf2read.c 20 Oct 2011 01:11:34 -0000 1.576 +++ dwarf2read.c 20 Oct 2011 18:40:54 -0000 @@ -1336,7 +1336,8 @@ static gdb_byte *partial_read_comp_unit_ gdb_byte *info_ptr, gdb_byte *buffer, unsigned int buffer_size, - bfd *abfd); + bfd *abfd, + int is_debug_type_section); static void init_cu_die_reader (struct die_reader_specs *reader, struct dwarf2_cu *cu); @@ -2307,7 +2308,8 @@ dw2_get_file_names (struct objfile *objf info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr, buffer, buffer_size, - abfd); + abfd, + this_cu->debug_type_section != NULL); /* Skip dummy compilation units. */ if (info_ptr >= buffer + buffer_size @@ -2323,8 +2325,6 @@ dw2_get_file_names (struct objfile *objf dwarf2_read_abbrevs (abfd, &cu); make_cleanup (dwarf2_free_abbrev_table, &cu); - if (this_cu->debug_type_section) - info_ptr += 8 /*signature*/ + cu.header.offset_size; init_cu_die_reader (&reader_specs, &cu); read_full_die (&reader_specs, &comp_unit_die, info_ptr, &has_children); @@ -2971,7 +2971,7 @@ read_comp_unit_head (struct comp_unit_he static gdb_byte * partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr, gdb_byte *buffer, unsigned int buffer_size, - bfd *abfd) + bfd *abfd, int is_debug_type_section) { gdb_byte *beg_of_comp_unit = info_ptr; @@ -2979,6 +2979,11 @@ partial_read_comp_unit_head (struct comp info_ptr = read_comp_unit_head (header, info_ptr, abfd); + /* If we're reading a type unit, skip over the signature and + type_offset fields. */ + if (is_debug_type_section) + info_ptr += 8 /*signature*/ + header->offset_size; + header->first_die_offset = info_ptr - beg_of_comp_unit; if (header->version != 2 && header->version != 3 && header->version != 4) @@ -3372,7 +3377,8 @@ process_psymtab_comp_unit (struct objfil info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr, buffer, buffer_size, - abfd); + abfd, + this_cu->debug_type_section != NULL); /* Skip dummy compilation units. */ if (info_ptr >= buffer + buffer_size @@ -3407,8 +3413,6 @@ process_psymtab_comp_unit (struct objfil make_cleanup (dwarf2_free_abbrev_table, &cu); /* Read the compilation unit die. */ - if (this_cu->debug_type_section) - info_ptr += 8 /*signature*/ + cu.header.offset_size; init_cu_die_reader (&reader_specs, &cu); info_ptr = read_full_die (&reader_specs, &comp_unit_die, info_ptr, &has_children); @@ -3670,7 +3674,7 @@ load_partial_comp_unit (struct dwarf2_pe info_ptr = partial_read_comp_unit_head (&cu->header, info_ptr, dwarf2_per_objfile->info.buffer, dwarf2_per_objfile->info.size, - abfd); + abfd, 0); /* Skip dummy compilation units. */ if (info_ptr >= (dwarf2_per_objfile->info.buffer