From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10877 invoked by alias); 24 Nov 2010 15:15:32 -0000 Received: (qmail 10868 invoked by uid 22791); 24 Nov 2010 15:15:31 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from almaty.radix50.net (HELO almaty.kz-easy.com) (85.214.25.173) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 24 Nov 2010 15:15:24 +0000 Received: from alatau.radix50.net (dslb-088-066-122-229.pools.arcor-ip.net [88.66.122.229]) (authenticated bits=0) by almaty.kz-easy.com (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id oAOFFHLs016845 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 24 Nov 2010 16:15:19 +0100 Received: from medeu.radix50.net (root@medeu [192.168.0.3]) by alatau.radix50.net (8.14.3/8.14.3/Debian-5) with ESMTP id oAOFF4ug030386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 24 Nov 2010 16:15:04 +0100 Received: from medeu.radix50.net (ibr@localhost [127.0.0.1]) by medeu.radix50.net (8.14.3/8.14.3/Debian-5) with ESMTP id oAOFF49b007848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 24 Nov 2010 16:15:04 +0100 Received: (from ibr@localhost) by medeu.radix50.net (8.14.3/8.14.3/Submit) id oAOFF41H007847 for gdb@sourceware.org; Wed, 24 Nov 2010 16:15:04 +0100 Date: Wed, 24 Nov 2010 15:15:00 -0000 From: Baurzhan Ismagulov To: "'gdb@sourceware.org'" Subject: Re: How do I patch my binary Message-ID: <20101124151504.GB5841@radix50.net> Mail-Followup-To: "'gdb@sourceware.org'" References: <20101123215005.GG5574@radix50.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00096.txt.bz2 On Wed, Nov 24, 2010 at 10:00:39AM -0500, Marc Khouzam wrote: > Linux x86. > > I'm trying to do with C/C++ the hot-swap that Java allows. > > So, if GDB can't do it on its own, can we involve the compiler/linker > to make this happen? Is there more complexity with C/C++ than with Java? > > The section below of the doc talks about patching, but doesn't describe > a way to actually do it :-) > http://sourceware.org/gdb/current/onlinedocs/gdb/Patching.html#Patching I'm not an expert at that. I've tried set write on, then p *(unsigned long *)0x8049a5c = 0x4e5f068 -- this does change the value, albeit x/2x 0x08049a57 issued after that shows a bit different value. If you share the motivation and the details about the extent of the modifications you want to make, perhaps someone could suggest another way to do that. With kind regards, -- Baurzhan Ismagulov http://www.kz-easy.com/