This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RFC: Support DW_TAG_entry_point
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GDB <gdb-patches at sourceware dot org>
- Date: Fri, 20 Mar 2009 15:00:41 -0700
- Subject: RFC: Support DW_TAG_entry_point
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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: