title: Pwntools Coredump | ValueError: cannot mmap an empty file
body: <p>Using pwntools, I'm trying to use the <code>Coredump</code> method as per this part of the pwntools docs: <a href="https://docs.pwntools.com/en/latest/elf/corefile.html?highlight=using%20corefiles#using-corefiles-to-automate-exploitation" rel="nofollow noreferrer">https://docs.pwntools.com/en/latest/elf/corefile.html?highlight=using%20corefiles#using-corefiles-to-automate-exploitation</a></p>
  <p>For testing purposes, I copy and pasted the code from <a href="https://docs.pwntools.com/en/latest/elf/corefile.html?highlight=using%20corefiles#using-corefiles-to-automate-exploitation" rel="nofollow noreferrer">this section</a> (same as previous link). I used the same C file and compiled it in the same way, and copied the pwntools script and I would get the following error.</p>
  <pre><code>Traceback (most recent call last):
    File &quot;crash_pwn.py&quot;, line 10, in &lt;module&gt;
      core = Coredump('./core')
    File &quot;/home/nick/.local/lib/python3.8/site-packages/pwnlib/elf/corefile.py&quot;, line 546, in __init__
      super(Corefile, self).__init__(*a, **kw)
    File &quot;/home/nick/.local/lib/python3.8/site-packages/pwnlib/elf/elf.py&quot;, line 218, in __init__
      self.mmap = mmap.mmap(self.file.fileno(), 0, access=mmap.ACCESS_COPY)
  ValueError: cannot mmap an empty file
  </code></pre>
  <p>Upon further investigation, it seems that the <code>core</code> file that is generated by the script is empty (0 kb); not sure why this is.</p>
  <p>NOTE: I am using <a href="https://docs.microsoft.com/en-us/windows/wsl/about" rel="nofollow noreferrer">WSL</a> as opposed to a virtual machine for linux or anything like that. Not sure if that effects anything.</p>