From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1357 invoked by alias); 16 Nov 2004 18:51:40 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 1310 invoked from network); 16 Nov 2004 18:51:29 -0000 Received: from unknown (HELO sccrmhc12.comcast.net) (204.127.202.56) by sourceware.org with SMTP; 16 Nov 2004 18:51:29 -0000 Received: from lucon.org ([24.6.212.230]) by comcast.net (sccrmhc12) with ESMTP id <20041116185128012008ovkbe>; Tue, 16 Nov 2004 18:51:29 +0000 Received: by lucon.org (Postfix, from userid 1000) id 7431B64061; Tue, 16 Nov 2004 10:51:28 -0800 (PST) Date: Tue, 16 Nov 2004 18:51:00 -0000 From: "H. J. Lu" To: Andreas Schwab Cc: GDB Subject: Re: PATCH: Support DW_TAG_entry_point Message-ID: <20041116185128.GA7900@lucon.org> References: <20041116004654.GA24122@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-SW-Source: 2004-11/txt/msg00340.txt.bz2 On Tue, Nov 16, 2004 at 11:23:02AM +0100, Andreas Schwab wrote: > "H. J. Lu" writes: > > > @@ -3151,6 +3165,27 @@ dwarf2_get_pc_bounds (struct die_info *d > > > > ret = -1; > > } > > + else if (die->tag == DW_TAG_entry_point) > > + { > > + /* DW_TAG_entry_point DIE only has DW_AT_high_pc. We get > ^^^^^^^^^^^^^ > > + HIGH from its parent. */ > > + attr = dwarf2_attr (die, DW_AT_low_pc, cu); > ^^^^^^^^^^^^ > Looks like a comment typo. > Thanks for catching that. I also updated the patch to get the linkage of DW_TAG_entry_point from its parent and only scan DW_TAG_entry_point children of a DW_TAG_subprogram DIE. H.J. ----- 2004-11-16 H.J. Lu * dwarf2read.c (scan_partial_symbols): Make a recursive call if a DIE has children. Handle DW_TAG_entry_point. (load_partial_dies): Don't skip DW_TAG_entry_point. Follow children of DW_TAG_subprogram if not C. (add_partial_symbol): Handle DW_TAG_entry_point. (process_die): Likewise. (dwarf2_get_pc_bounds): Likewise. (get_scope_pc_bounds): Likewise. (fixup_partial_die): Likewise. (new_symbol): Likewise. (read_type_die): Likewise. --- gdb/dwarf2read.c.entry 2004-11-11 16:46:53.000000000 -0800 +++ gdb/dwarf2read.c 2004-11-16 10:48:36.655194789 -0800 @@ -1697,6 +1697,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) @@ -1745,6 +1746,13 @@ 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->tag == DW_TAG_entry_point) + scan_partial_symbols (pdi->die_child, lowpc, highpc, cu); /* If the die has a sibling, skip to the sibling. */ @@ -1894,6 +1902,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) { @@ -2625,6 +2656,7 @@ process_die (struct die_info *die, struc read_file_scope (die, cu); break; case DW_TAG_subprogram: + case DW_TAG_entry_point: read_subroutine_type (die, cu); read_func_scope (die, cu); break; @@ -3151,6 +3183,27 @@ dwarf2_get_pc_bounds (struct die_info *d 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) @@ -3198,6 +3251,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); @@ -5167,6 +5221,7 @@ load_partial_dies (bfd *abfd, char *info if (!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) { @@ -5271,6 +5326,7 @@ load_partial_dies (bfd *abfd, char *info internal errors in find_partial_die. */ if (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) @@ -5293,7 +5349,8 @@ load_partial_dies (bfd *abfd, char *info && (last_die->tag == DW_TAG_namespace || last_die->tag == DW_TAG_enumeration_type || (cu->language != language_c - && (last_die->tag == DW_TAG_class_type + && (last_die->tag == DW_TAG_subprogram + || last_die->tag == DW_TAG_class_type || last_die->tag == DW_TAG_structure_type || last_die->tag == DW_TAG_union_type)))) { @@ -5513,6 +5570,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 @@ -6789,6 +6856,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 @@ -7184,6 +7264,7 @@ read_type_die (struct die_info *die, str break; case DW_TAG_subprogram: case DW_TAG_subroutine_type: + case DW_TAG_entry_point: read_subroutine_type (die, cu); break; case DW_TAG_array_type: