This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
PATCH: Support DW_TAG_entry_point
- From: "H. J. Lu" <hjl at lucon dot org>
- To: GDB <gdb-patches at sources dot redhat dot com>
- Date: Mon, 15 Nov 2004 16:46:54 -0800
- Subject: PATCH: Support DW_TAG_entry_point
This patch adds the support for DW_TAG_entry_point. I tested it
with Intel Fortran compiler. It seems to work fine.
H.J.
----
2004-11-15 H.J. Lu <hongjiu.lu@intel.com>
* 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-15 15:50:13.752074008 -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,9 @@ scan_partial_symbols (struct partial_die
break;
}
}
+
+ if (pdi->has_children)
+ scan_partial_symbols (pdi->die_child, lowpc, highpc, cu);
/* If the die has a sibling, skip to the sibling. */
@@ -1894,6 +1898,15 @@ add_partial_symbol (struct partial_die_i
cu->language, objfile);
}
break;
+ case DW_TAG_entry_point:
+ /*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);
+ break;
case DW_TAG_variable:
if (pdi->is_external)
{
@@ -2625,6 +2638,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 +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);
+ 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 +3233,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 +5203,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 +5308,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 +5331,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 +5552,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 +6838,13 @@ new_symbol (struct die_info *die, struct
add_symbol_to_list (sym, cu->list_in_scope);
}
break;
+ case DW_TAG_entry_point:
+ /* SYMBOL_BLOCK_VALUE (sym) will be filled in later by
+ finish_block. */
+ SYMBOL_CLASS (sym) = LOC_BLOCK;
+ /* Fortran alternate entry point is always external. */
+ add_symbol_to_list (sym, &global_symbols);
+ 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 +7240,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: