diff options
author | fche <fche> | 2005-09-03 17:24:49 +0000 |
---|---|---|
committer | fche <fche> | 2005-09-03 17:24:49 +0000 |
commit | f9eba66ef3ec406f883caebed75cdeaa042f6b33 (patch) | |
tree | ee5996857ff254f209742df2ad9ed54e50b4e157 /tapsets.cxx | |
parent | 6a505121fc997e6f21d26f8c8656f99e58faaaab (diff) | |
download | systemtap-steved-f9eba66ef3ec406f883caebed75cdeaa042f6b33.tar.gz systemtap-steved-f9eba66ef3ec406f883caebed75cdeaa042f6b33.tar.xz systemtap-steved-f9eba66ef3ec406f883caebed75cdeaa042f6b33.zip |
2005-09-03 Frank Ch. Eigler <fche@elastic.org>
PR 1187 prime
* tapset.cxx (literal_stmt_for_local): Don't automgaically copy
target char*'s to systemtap strings.
* tapset/conversions.stp (user_string, kernel_string): New functions.
* stapfuncs.5.in: Document new functions.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index f2eeb5d1..14031308 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -957,42 +957,28 @@ dwflpp 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_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. - ty = pe_string; - prelude += "intptr_t tmpc = 0;\n"; - if (typetag == DW_TAG_array_type) - c_translate_array (&pool, 1, module_bias, typedie, &tail, NULL, 0); - else - c_translate_pointer (&pool, 1, module_bias, typedie, &tail); - c_translate_addressof (&pool, 1, module_bias, NULL, pointee_typedie, &tail, "tmpc"); - postlude += "deref_string (THIS->__retvalue, tmpc, MAXSTRINGLEN);\n"; - } + // We have the pointer: cast it to an integral type via &(*(...)) + + // NB: per bug #1187, at one point char*-like types were + // automagically converted here to systemtap string values. + // For several reasons, this was taken back out, leaving + // pointer-to-string "conversion" (copying) to tapset functions. + + ty = pe_long; + if (typetag == DW_TAG_array_type) + c_translate_array (&pool, 1, module_bias, typedie, &tail, NULL, 0); else - { - // We have some other pointer: cast it to an integral type via &(*(...)) - ty = pe_long; - if (typetag == DW_TAG_array_type) - c_translate_array (&pool, 1, module_bias, typedie, &tail, NULL, 0); - else - c_translate_pointer (&pool, 1, module_bias, typedie, &tail); - c_translate_addressof (&pool, 1, module_bias, NULL, pointee_typedie, &tail, - "THIS->__retvalue"); - } + c_translate_pointer (&pool, 1, module_bias, typedie, &tail); + c_translate_addressof (&pool, 1, module_bias, NULL, pointee_typedie, &tail, + "THIS->__retvalue"); } break; } - + size_t bufsz = 1024; char *buf = static_cast<char*>(malloc(bufsz)); assert(buf); - + FILE *memstream = open_memstream (&buf, &bufsz); assert(memstream); |