From 246b383e71b24882db18311a748d713c57a2108e Mon Sep 17 00:00:00 2001 From: graydon Date: Wed, 31 Aug 2005 03:05:39 +0000 Subject: 2005-08-30 Graydon Hoare * tapsets.cxx (dwflpp::literal_stmt_for_local): Handle dwarf pointer-to-1-byte-means-char case (found in PR 1187) * parse.cxx (parse_symbol): Eliminate use of "." from target symbol parser, conflicting with string concatenation operator. * staptree.h (target_symbol::component_type) Eliminate comp_struct_pointer_member, since . and -> are considered the same now. * staptree.cxx (target_symbol::print): Likewise. * testsuite/buildok/seventeen.stp: Test solution on PR 1191. * testsuite/buildok/six.stp: Test working portion of PR 1155. * testsuite/semko/nineteen.stp: Unresolved portion of PR 1155. --- ChangeLog | 14 ++++++++++++++ parse.cxx | 11 ++--------- staptree.cxx | 4 +--- staptree.h | 1 - tapsets.cxx | 8 +++++++- testsuite/buildok/seventeen.stp | 9 +++++++++ testsuite/buildok/six.stp | 6 +++++- testsuite/semko/nineteen.stp | 8 ++++++++ 8 files changed, 46 insertions(+), 15 deletions(-) create mode 100755 testsuite/buildok/seventeen.stp create mode 100755 testsuite/semko/nineteen.stp diff --git a/ChangeLog b/ChangeLog index 2a6a2b32..9ca4147f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-08-30 Graydon Hoare + + * tapsets.cxx (dwflpp::literal_stmt_for_local): Handle dwarf + pointer-to-1-byte-means-char case (found in PR 1187) + * parse.cxx (parse_symbol): Eliminate use of "." from target + symbol parser, conflicting with string concatenation operator. + * staptree.h (target_symbol::component_type) Eliminate + comp_struct_pointer_member, since . and -> are considered the + same now. + * staptree.cxx (target_symbol::print): Likewise. + * testsuite/buildok/seventeen.stp: Test solution on PR 1191. + * testsuite/buildok/six.stp: Test working portion of PR 1155. + * testsuite/semko/nineteen.stp: Unresolved portion of PR 1155. + 2005-08-30 Frank Ch. Eigler PR systemtap/1268 diff --git a/parse.cxx b/parse.cxx index 4a4b973f..c4f028b7 100644 --- a/parse.cxx +++ b/parse.cxx @@ -1650,19 +1650,12 @@ parser::parse_symbol () while (true) { string c; - if (peek_op (".")) - { - next(); - expect_ident (c); - tsym->components.push_back - (make_pair (target_symbol::comp_struct_member, c)); - } - else if (peek_op ("->")) + if (peek_op ("->")) { next(); expect_ident (c); tsym->components.push_back - (make_pair (target_symbol::comp_struct_pointer_member, c)); + (make_pair (target_symbol::comp_struct_member, c)); } else if (peek_op ("[")) { diff --git a/staptree.cxx b/staptree.cxx index 843f96b7..8af920d6 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -242,11 +242,9 @@ void target_symbol::print (std::ostream& o) case comp_literal_array_index: o << '[' << components[i].second << ']'; break; - case comp_struct_pointer_member: + case comp_struct_member: o << "->" << components[i].second; break; - case comp_struct_member: - o << "." << components[i].second; } } } diff --git a/staptree.h b/staptree.h index 8edb3ecc..8e4ae9bb 100644 --- a/staptree.h +++ b/staptree.h @@ -183,7 +183,6 @@ struct target_symbol : public expression enum component_type { comp_struct_member, - comp_struct_pointer_member, comp_literal_array_index }; std::string base_name; diff --git a/tapsets.cxx b/tapsets.cxx index 0910c50d..4d44fb03 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -919,6 +919,7 @@ dwflpp Dwarf_Die pointee_typedie_mem; Dwarf_Die *pointee_typedie; Dwarf_Word pointee_encoding; + Dwarf_Word pointee_byte_size = 0; int pointee_typetag; if (dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem) == NULL) @@ -940,13 +941,18 @@ dwflpp if (dwarf_attr_integrate (pointee_typedie, DW_AT_type, &attr_mem) == NULL) throw semantic_error ("cannot get type of pointee: " + string(dwarf_errmsg (-1))); } + + if (dwarf_attr_integrate (pointee_typedie, DW_AT_byte_size, &attr_mem)) + dwarf_formudata (&attr_mem, &pointee_byte_size); dwarf_formudata (dwarf_attr_integrate (pointee_typedie, DW_AT_encoding, &attr_mem), &pointee_encoding); if (pointee_typetag == DW_TAG_base_type && (pointee_encoding == DW_ATE_signed_char - || pointee_encoding == DW_ATE_unsigned_char)) + || pointee_encoding == DW_ATE_unsigned_char + || ((pointee_encoding == DW_ATE_signed + || pointee_encoding == DW_ATE_unsigned) && pointee_byte_size == 1))) { // We have an (un)signed char* or (un)signed char[], fetch it into 'tmpc' and // then copy to the return value via something strcpy-ish. diff --git a/testsuite/buildok/seventeen.stp b/testsuite/buildok/seventeen.stp new file mode 100755 index 00000000..6ac87815 --- /dev/null +++ b/testsuite/buildok/seventeen.stp @@ -0,0 +1,9 @@ +#! stap -p4 + +# this tests access to members of a target global variable +# (PR 1191) + +probe kernel.function("pipe_write") +{ + log (hexstring ($write_fifo_fops->llseek)) +} diff --git a/testsuite/buildok/six.stp b/testsuite/buildok/six.stp index a63ad99b..a11014fe 100755 --- a/testsuite/buildok/six.stp +++ b/testsuite/buildok/six.stp @@ -1,5 +1,9 @@ #! stap -p4 +# tests probing of an inline function: note that due to comments +# listed in PR 1155 we cannot resolve the parameters of the inline +# at the moment. + probe kernel.function("context_switch") { - log ("switch from=" . hexstring($prev) . " to=" . hexstring($next)) + log ("found an inline function") } diff --git a/testsuite/semko/nineteen.stp b/testsuite/semko/nineteen.stp new file mode 100755 index 00000000..04a9af20 --- /dev/null +++ b/testsuite/semko/nineteen.stp @@ -0,0 +1,8 @@ +#! stap -p4 + +# PR 1155: should start working when we can resolve the parameters of +# the inlines. + +probe kernel.function("context_switch") { + log ("switch from=" . hexstring($prev) . " to=" . hexstring($next)) +} -- cgit