title: Why is '<<<' filtering null bytes in gdb where '<()' does not?
body: <p>I recently discovered that the <code>&lt;&lt;&lt;</code> trick in <code>gdb</code> to feed the <code>stdin</code> of the debugged program is filtering the null bytes out from the stream.</p>
  
  <p>Here is a small example (that anybody should be able to reproduce at home) to testify that it filters out the null bytes:</p>
  
  <pre><code>$&gt; python -c 'print("A\x00" * 10)' | cat -A
  A^@A^@A^@A^@A^@A^@A^@A^@A^@A^@$
  $&gt; gdb /bin/cat
  
  ... gdb license prelude ... snip...
  
  (gdb) r -A &lt;&lt;&lt; $(python -c 'print("A\x00" * 10)')
  Starting program: /bin/cat -A &lt;&lt;&lt; $(python -c 'print("A\x00" * 10)')
  /bin/bash: warning: command substitution: ignored null byte in input
  AAAAAAAAAA$
  [Inferior 1 (process 3798) exited normally]
  </code></pre>
  
  <p>Where, using the bash-specific <code>&lt;()</code> <a href="https://www.gnu.org/software/bash/manual/bashref.html#Process-Substitution" rel="nofollow noreferrer">process substitution</a> leave the null bytes reach the program <code>stdin</code> within <code>gdb</code>:</p>
  
  <pre><code>(gdb) r -A &lt; &lt;(python -c 'print("A\x00" * 10)')
  Starting program: /bin/cat -A &lt; &lt;(python -c 'print("A\x00" * 10)')
  A^@A^@A^@A^@A^@A^@A^@A^@A^@A^@$
  [Inferior 1 (process 3804) exited normally]
  </code></pre>
  
  <p>So, I have always thought that <code>&lt;&lt;&lt;</code> and <code>&lt;()</code> were doing about the same thing which is now obviously wrong. I would like to know what are the differences between the two methods and have an explanation about the <code>bash</code> mysterious error message stating that:</p>
  
  <pre><code>/bin/bash: warning: command substitution: ignored null byte in input
  </code></pre>
  
  <p>Any help is more than welcome!</p>