title: How do I use user_regs_struct on ARM processor in ptrace-based debugger
body: <p>I am following the code in Chapter 3 of "Learning Linux Binary Analysis". The code is, "A simple ptrace-based debugger".</p>
  
  <p>I am trying to write this in my Raspberry Pi 3, which has an ARM processor. I know that the error means that I have not included the correct header file, but I cannot find what the correct header file is.</p>
  
  <p>I get this error message:</p>
  
  <pre><code>field ‘pt_reg’ has incomplete type struct user_regs_struct pt_reg
  </code></pre>
  
  <p>After doing some research, I found asm/ptrace.h, which includes some macros for the registers struct specific to ARM. Am I on the right track? How in the world can I make this work with an ARM processor?</p>
  
  <p>Here are the headers:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;errno.h&gt;
  #include &lt;signal.h&gt;
  #include &lt;elf.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;sys/user.h&gt;
  #include &lt;sys/stat.h&gt;
  #include &lt;sys/ptrace.h&gt;
  #include &lt;sys/mman.h&gt;
  
  typedef struct handle {
    Elf64_Ehdr *ehdr;
    Elf64_Phdr *phdr;
    Elf64_Shdr *shdr;
    uint8_t *mem;
    char *symname;
    Elf64_Addr symaddr;
    struct user_regs_struct pt_reg;
    char *exec;
  } handle_t;
  </code></pre>