From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6080 invoked by alias); 20 Mar 2009 22:00:54 -0000 Received: (qmail 6071 invoked by uid 22791); 20 Mar 2009 22:00:53 -0000 X-SWARE-Spam-Status: No, hits=0.2 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,NO_DNS_FOR_FROM X-Spam-Check-By: sourceware.org Received: from mga05.intel.com (HELO fmsmga101.fm.intel.com) (192.55.52.89) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 20 Mar 2009 22:00:43 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 20 Mar 2009 14:52:37 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.111]) by fmsmga002.fm.intel.com with ESMTP; 20 Mar 2009 14:56:09 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id 8D04F3B575D; Fri, 20 Mar 2009 15:00:41 -0700 (PDT) Date: Fri, 20 Mar 2009 22:15:00 -0000 From: "H.J. Lu" To: GDB Subject: RFC: Support DW_TAG_entry_point Message-ID: <20090320220041.GA26894@lucon.org> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2009-03/txt/msg00419.txt.bz2 I have a patch to support DW_TAG_entry_point. Should I submit it with a ChangeLog entry? H.J. --- gdb/dwarf2read.c.entry 2008-05-07 10:41:46.000000000 -0700 +++ gdb/dwarf2read.c 2008-05-07 11:26:14.000000000 -0700 @@ -1780,6 +1780,7 @@ scan_partial_symbols (struct partial_die switch (pdi->tag) { case DW_TAG_subprogram: + case DW_TAG_entry_point: if (pdi->has_pc_info) { if (pdi->lowpc < *lowpc) @@ -1829,6 +1830,14 @@ scan_partial_symbols (struct partial_die break; } } + + /* A DW_TAG_subprogram DIE may have DW_TAG_entry_point DIEs + as children. */ + if (pdi->tag == DW_TAG_subprogram + && pdi->has_children + && pdi->die_child + && pdi->die_child->tag == DW_TAG_entry_point) + scan_partial_symbols (pdi->die_child, lowpc, highpc, cu); /* If the die has a sibling, skip to the sibling. */ @@ -1981,6 +1990,29 @@ add_partial_symbol (struct partial_die_i cu->language, objfile); } break; + case DW_TAG_entry_point: + if (pdi->die_parent->tag == DW_TAG_subprogram) + { + if (pdi->die_parent->is_external) + /*prim_record_minimal_symbol (actual_name, pdi->lowpc + baseaddr, + mst_text, objfile); */ + psym = add_psymbol_to_list (actual_name, + strlen (actual_name), + VAR_DOMAIN, LOC_BLOCK, + &objfile->global_psymbols, + 0, pdi->lowpc + baseaddr, + cu->language, objfile); + else + /*prim_record_minimal_symbol (actual_name, pdi->lowpc + baseaddr, + mst_file_text, objfile); */ + psym = add_psymbol_to_list (actual_name, + strlen (actual_name), + VAR_DOMAIN, LOC_BLOCK, + &objfile->static_psymbols, + 0, pdi->lowpc + baseaddr, + cu->language, objfile); + } + break; case DW_TAG_variable: if (pdi->is_external) { @@ -2713,6 +2745,7 @@ process_die (struct die_info *die, struc read_file_scope (die, cu); break; case DW_TAG_subprogram: + case DW_TAG_entry_point: read_func_scope (die, cu); break; case DW_TAG_inlined_subroutine: @@ -3276,6 +3309,27 @@ dwarf2_get_pc_bounds (struct die_info *d /* Found discontinuous range of addresses. */ ret = -1; } + else if (die->tag == DW_TAG_entry_point) + { + /* DW_TAG_entry_point DIE only has DW_AT_low_pc. We get + HIGH from its parent. */ + attr = dwarf2_attr (die, DW_AT_low_pc, cu); + if (attr) + { + low = DW_ADDR (attr); + if (die->parent->tag == DW_TAG_subprogram) + { + CORE_ADDR parent_low = 0; + CORE_ADDR parent_high = 0; + if (dwarf2_get_pc_bounds (die->parent, &parent_low, + &parent_high, cu)) + { + high = parent_high; + ret = 1; + } + } + } + } } if (high < low) @@ -3323,6 +3377,7 @@ get_scope_pc_bounds (struct die_info *di { switch (child->tag) { case DW_TAG_subprogram: + case DW_TAG_entry_point: if (dwarf2_get_pc_bounds (child, ¤t_low, ¤t_high, cu)) { best_low = min (best_low, current_low); @@ -5581,6 +5636,7 @@ load_partial_dies (bfd *abfd, gdb_byte * && !is_type_tag_for_partial (abbrev->tag) && abbrev->tag != DW_TAG_enumerator && abbrev->tag != DW_TAG_subprogram + && abbrev->tag != DW_TAG_entry_point && abbrev->tag != DW_TAG_variable && abbrev->tag != DW_TAG_namespace && abbrev->tag != DW_TAG_member) @@ -5688,6 +5744,7 @@ load_partial_dies (bfd *abfd, gdb_byte * if (load_all || abbrev->tag == DW_TAG_subprogram + || abbrev->tag == DW_TAG_entry_point || abbrev->tag == DW_TAG_variable || abbrev->tag == DW_TAG_namespace || part_die->is_declaration) @@ -5713,6 +5770,7 @@ load_partial_dies (bfd *abfd, gdb_byte * || (cu->language != language_c && (last_die->tag == DW_TAG_class_type || last_die->tag == DW_TAG_interface_type + || last_die->tag == DW_TAG_subprogram || last_die->tag == DW_TAG_structure_type || last_die->tag == DW_TAG_union_type)))) { @@ -6028,6 +6086,16 @@ fixup_partial_die (struct partial_die_in || part_die->tag == DW_TAG_class_type || part_die->tag == DW_TAG_union_type) guess_structure_name (part_die, cu); + + if (part_die->tag == DW_TAG_entry_point) + { + if (part_die->die_parent->tag == DW_TAG_subprogram) + { + part_die->highpc = part_die->die_parent->highpc; + if (part_die->lowpc < part_die->highpc) + part_die->has_pc_info = 1; + } + } } /* Read the die from the .debug_info section buffer. Set DIEP to @@ -7437,6 +7505,19 @@ new_symbol (struct die_info *die, struct add_symbol_to_list (sym, cu->list_in_scope); } break; + case DW_TAG_entry_point: + if (die->parent->tag == DW_TAG_subprogram) + { + /* SYMBOL_BLOCK_VALUE (sym) will be filled in later by + finish_block. */ + SYMBOL_CLASS (sym) = LOC_BLOCK; + attr2 = dwarf2_attr (die->parent, DW_AT_external, cu); + if (attr2 && (DW_UNSND (attr2) != 0)) + add_symbol_to_list (sym, &global_symbols); + else + add_symbol_to_list (sym, cu->list_in_scope); + } + break; case DW_TAG_variable: /* Compilation with minimal debug info may result in variables with missing type entries. Change the misleading `void' type @@ -7839,6 +7920,7 @@ read_type_die (struct die_info *die, str break; case DW_TAG_subprogram: case DW_TAG_subroutine_type: + case DW_TAG_entry_point: this_type = read_subroutine_type (die, cu); break; case DW_TAG_array_type: