From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23431 invoked by alias); 16 Oct 2006 14:42:52 -0000 Received: (qmail 23422 invoked by uid 22791); 16 Oct 2006 14:42:52 -0000 X-Spam-Check-By: sourceware.org Received: from pas38-1-82-67-71-117.fbx.proxad.net (HELO siegfried.gbfo.org) (82.67.71.117) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 16 Oct 2006 14:42:43 +0000 Received: from erda.mds (localhost [127.0.0.1]) by siegfried.gbfo.org (8.13.6/8.13.6) with ESMTP id k9GEgo07005188; Mon, 16 Oct 2006 16:42:51 +0200 Received: from localhost (saffroy@localhost) by erda.mds (8.13.6/8.13.6/Submit) with ESMTP id k9GEgoH7005185; Mon, 16 Oct 2006 16:42:50 +0200 Date: Mon, 16 Oct 2006 14:42:00 -0000 From: Jean-Marc Saffroy To: s88 cc: gdb@sourceware.org Subject: Re: gdb breakpoint on x86 In-Reply-To: Message-ID: References: <20061016003930.GA525@nevyn.them.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00114.txt.bz2 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