From: Frederic RISS <frederic.riss@st.com>
To: s88 <dave.tw@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: gdb breakpoint on x86
Date: Mon, 16 Oct 2006 08:51:00 -0000 [thread overview]
Message-ID: <1160988550.3423.28.camel@crx549.cro.st.com> (raw)
In-Reply-To: <c9d32f760610151815t7b1969c5ve50ed368af290773@mail.gmail.com>
On Mon, 2006-10-16 at 09:15 +0800, s88 wrote:
> > > By the way, the following code can compile without any error. But the
> > > sizeof which in the "i386_breakpoint_from_pc" derives segmentation
> > > fault.
> >
> > You need to read up on memory protection. You can't modify a running
> > program directly this way on most platforms.
> >
> Thank gor your reply...
>
> 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!!
On Linux, GDB uses the ptrace(2) API to get access to another process'
address space. This API allows a debugger process to modify the memory
of another (debuggee) process.
Looking at your segmentation fault issue, it's not a breakpoint issue,
it's a simple C issue AFAICT. You do:
int *len=0;
b = (my_byte *)i386_breakpoint_from_pc ((CORE_ADDR *)(t), len);
and in i386_breakpoint_from_pc:
*len = sizeof (break_insn);
which is *0 = sizeof (break_insn);
That's also a memory protection error, but not due to editing executable
memory pages, it's simply a NULL pointer dereference.
Fred.
next prev parent reply other threads:[~2006-10-16 8:51 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 [this message]
2006-10-16 14:42 ` Jean-Marc Saffroy
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=1160988550.3423.28.camel@crx549.cro.st.com \
--to=frederic.riss@st.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