From: "H.J. Lu" <hongjiu.lu@intel.com>
To: GDB <gdb-patches@sourceware.org>
Subject: RFC: Support DW_TAG_entry_point
Date: Fri, 20 Mar 2009 22:15:00 -0000 [thread overview]
Message-ID: <20090320220041.GA26894@lucon.org> (raw)
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:
next reply other threads:[~2009-03-20 22:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-20 22:15 H.J. Lu [this message]
2009-03-21 1:02 ` Tom Tromey
2009-03-21 16:25 ` H.J. Lu
2009-03-23 18:26 ` Tom Tromey
2009-03-23 19:09 ` H.J. Lu
2009-04-22 21:13 ` Tom Tromey
2009-04-23 10:58 ` Joel Brobecker
2009-04-23 11:10 ` Jan Kratochvil
2009-04-23 23:43 ` Tom Tromey
2009-04-23 23:49 ` H.J. Lu
2009-04-24 0:13 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090320220041.GA26894@lucon.org \
--to=hongjiu.lu@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=hjl.tools@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox