title: Read value from frida hooked native method basic_string parameter
body: <p>Recently I started using Frida and playing with some native methods. But i have a problem with reading value of <code>basic_string</code></p>
  <p>Here is method which I'm hooking:</p>
  <p><img src="https://i.stack.imgur.com/zjwgl.png" alt="" /></p>
  <p>Here is JavaScript code which I'm using to hook method:</p>
  <pre><code>Interceptor.attach(Module.getExportByName('libsigning.so', '_ZN8Security4signEP7_JNIEnvP6rsa_stRKNSt6__ndk112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE'), {
      onEnter: function (args) {
          console.log(&quot;RSA.sign()&quot;)
          console.log(Memory.readCString(args[2]))
      },
      onLeave: function (retval) {
          // simply replace the value to be returned with 0
          return retval
      }
  });
  
  </code></pre>
  <p>In output I'm getting ! character instead of real value</p>
  <p>What is a proper way of doing this?</p>