summaryrefslogtreecommitdiffstats
path: root/dwflpp.cxx
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-08-19 18:19:53 -0700
committerJosh Stone <jistone@redhat.com>2009-08-19 18:19:53 -0700
commit72c5ecc2fffe43146eaf54284cf9626b7f76cb78 (patch)
treeec6bba39ad63ad05bbed0573a8d4e12f0a77ba33 /dwflpp.cxx
parent3d1ad34033e6f77368287927049e112d9ee3677e (diff)
downloadsystemtap-steved-72c5ecc2fffe43146eaf54284cf9626b7f76cb78.tar.gz
systemtap-steved-72c5ecc2fffe43146eaf54284cf9626b7f76cb78.tar.xz
systemtap-steved-72c5ecc2fffe43146eaf54284cf9626b7f76cb78.zip
PR10538: Give a file:line hint for anonymous types
When we list the possible members for an anonymous struct/union, the user may want to go look at the source for the type. That's hard without a type name, so we now list the decl file:line for them. * dwflpp.cxx (dwflpp::translate_components): List file:line for anon.
Diffstat (limited to 'dwflpp.cxx')
-rw-r--r--dwflpp.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/dwflpp.cxx b/dwflpp.cxx
index dce19f21..780a3510 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -1762,15 +1762,26 @@ dwflpp::translate_components(struct obstack *pool,
vector<Dwarf_Attribute> locs;
if (!find_struct_member(c, &parentdie, die, locs))
{
+ /* Add a file:line hint for anonymous types */
+ string source;
+ if (!dwarf_hasattr_integrate(&parentdie, DW_AT_name))
+ {
+ int line;
+ const char *file = dwarf_decl_file(&parentdie);
+ if (file && dwarf_decl_line(&parentdie, &line) == 0)
+ source = " (" + string(file) + ":"
+ + lex_cast<string>(line) + ")";
+ }
+
string alternatives;
stringstream members;
print_members(&parentdie, members);
if (members.str().size() != 0)
- alternatives = " (alternatives:" + members.str();
+ alternatives = " (alternatives:" + members.str() + ")";
throw semantic_error("unable to find member '" +
c.member + "' for "
+ dwarf_type_name(&parentdie)
- + alternatives,
+ + source + alternatives,
c.tok);
}