• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* This test used to cause an assertion in the address space manager */
2 
3 __attribute__((noinline))
inner(void)4 static 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))
outer(void)24 static void outer(void)
25 {
26    inner();
27 }
28 
main(int argc,const char * argv[])29 int main(int argc, const char *argv[])
30 {
31    outer();
32    return 0;
33 }
34