Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Phi Debian <phi.debian@gmail.com>
To: Sterling Augustine <saugustine@google.com>
Cc: Mark Manning <mark4th@gmail.com>, gdb@sourceware.org
Subject: Re: back into the thread....
Date: Wed, 13 Nov 2013 06:48:00 -0000	[thread overview]
Message-ID: <CAJOr74hUMywBACxchzpsL=+bur4s=iJaVQNdU0T0S4M2X15idw@mail.gmail.com> (raw)
In-Reply-To: <CAEG7qUyR8OZ=XGy0WwK=1UW46afS=e-67Hs=P3XToxKA1Q9+Pw@mail.gmail.com>

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


  parent reply	other threads:[~2013-11-13  6:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-12 22:09 Mark Manning
2013-11-12 22:42 ` Sterling Augustine
2013-11-12 22:47   ` Sterling Augustine
2013-11-12 22:59     ` Mark Manning
2013-11-12 23:00       ` Mark Manning
     [not found]         ` <CAPGNrUUYWR7AOcFwTSxdEZa47E8iUJyfhzhWs+6jSc2+f4xqrg@mail.gmail.com>
2013-11-12 23:10           ` Sterling Augustine
2013-11-12 23:09     ` Mark Manning
2013-11-13  6:48     ` Phi Debian [this message]
2013-11-13 12:29       ` Mark Manning
2013-11-13 12:54         ` Phi Debian
2013-11-13 12:59           ` Mark Manning
2013-11-14 17:19             ` Arnab Bhaduri
2013-11-12 22:55   ` Mark Manning
2013-11-13 10:34     ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJOr74hUMywBACxchzpsL=+bur4s=iJaVQNdU0T0S4M2X15idw@mail.gmail.com' \
    --to=phi.debian@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=mark4th@gmail.com \
    --cc=saugustine@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox