fix incorrect code generation in usdt
authorYonghong Song <yhs@fb.com>
Tue, 6 Jun 2017 00:55:24 +0000 (17:55 -0700)
committerBrenden Blanco <bblanco@gmail.com>
Wed, 7 Jun 2017 05:25:59 +0000 (22:25 -0700)
o This is caused by my ignorant error in previous usdt change.
  Obviously, I need to store into pointer address in order to
  propagate value back to caller.
o Thanks Tetsuo Handa pointing this out.

Signed-off-by: Yonghong Song <yhs@fb.com>
src/cc/usdt.cc

index 8801b19331d682b05435eb50ee78b100636acbfd..d390fb87fafa00ce5f7198ac4f6127a46015140d 100644 (file)
@@ -152,7 +152,7 @@ bool Probe::usdt_getarg(std::ostream &stream) {
 
   for (size_t arg_n = 0; arg_n < arg_count; ++arg_n) {
     std::string ctype = largest_arg_type(arg_n);
-    std::string cptr("dest");
+    std::string cptr = tfm::format("*((%s *)dest)", ctype);
 
     tfm::format(stream,
                 "static __always_inline int _bpf_readarg_%s_%d("