Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jean-Marc Saffroy <saffroy@gmail.com>
To: s88 <dave.tw@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: gdb breakpoint on x86
Date: Mon, 16 Oct 2006 14:42:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.0610161631370.4788@erda.mds> (raw)
In-Reply-To: <c9d32f760610151815t7b1969c5ve50ed368af290773@mail.gmail.com>

On Mon, 16 Oct 2006, s88 wrote:

> I have a new question, how to remove the memory protection? I'm trying
> to find out this part in gdb, but I do not find anything!!

Use mprotect to change your own mappings:

         char *p = target;

         p -= (unsigned long)p % PAGE_SIZE;
         if(mprotect(p, PAGE_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC)) {
                 perror("mprotect");
                 exit(1);
         }


> let's see the default_memory_insert_breakpoint (CORE_ADDR addr,
> bfd_byte *contents_cache) in the mem-break.c
> first, the program "determine appropriate breakpoint contents and size
> for this address".
> I don't know, the sizeof the int3 is 1 byte, right? why need to detect
> the "appropriate" breakpoint size?

This size is architecture-specific, people use gdb on other CPU 
architectures as well. Look at i386_breakpoint_from_pc or 
ia64_breakpoint_from_pc for wildly different sizes (1 byte vs. 8 bytes).


-- 
saffroy@gmail.com


      parent reply	other threads:[~2006-10-16 14:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-16  0:12 s88
2006-10-16  0:39 ` Daniel Jacobowitz
2006-10-16  1:15   ` s88
2006-10-16  8:51     ` Frederic RISS
2006-10-16 14:42     ` Jean-Marc Saffroy [this message]

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=Pine.LNX.4.64.0610161631370.4788@erda.mds \
    --to=saffroy@gmail.com \
    --cc=dave.tw@gmail.com \
    --cc=gdb@sourceware.org \
    /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