1/* This test used to cause an assertion in the address space manager */
2
3__attribute__((noinline))
4static void inner(void)
5{
6   /* Set other registers to apriori known values. */
7   __asm__ __volatile__(
8      "movl $0x101, %%eax\n"
9      "movl $0x102, %%ebx\n"
10      "movl $0x103, %%ecx\n"
11      "movl $0x104, %%edx\n"
12      "movl $0x105, %%esi\n"
13      "movl $0x106, %%edi\n"
14      // not %ebp as mdb is then not able to reconstruct stack trace
15      "movl $0x108, %%esp\n"
16      "movl $0x1234, (%%eax)\n"  // should cause SEGV here
17      "ud2"                      // should never get here
18      : // no output registers
19      : // no input registers
20      : "memory", "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%esp");
21}
22
23__attribute__((noinline))
24static void outer(void)
25{
26   inner();
27}
28
29int main(int argc, const char *argv[])
30{
31   outer();
32   return 0;
33}
34