This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: back into the thread....


Hi All,

Off topic about gdb discution

>  if (posix_memalign((void **) &dst, 4096*8, EXEC_BYTES) != 0) {
>   printf("can't allocate.\n");
>  exit (-1);
>  }
>  if (mprotect(dst, EXEC_BYTES, PROT_READ|PROT_WRITE|PROT_EXEC) != 0) {
>    printf("can't mprotect\n");
>    exit (-1);
>  }

>   memcpy(dst, bytes, EXEC_BYTES);
>
>   return_val = dst(test_val);


The above code as very little chance to execute on modernn
architecture, at least with architecture with separate icache and
dcache.

The memcpy fill the dcache, the dst() read the icache, since the
caches are not flushed in between, the dst() will execute garbage
(well instruction living there before).

As far as GDB is concerned, it should be able to single step in any
memory area that is declared 'executable'

> Also, the "can not access addres zero" error is totally bogus,
Not if you consider your single step execute garbage instruction.


Cheers,
Phi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]