From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25301 invoked by alias); 28 Feb 2008 19:29:41 -0000 Received: (qmail 25291 invoked by uid 22791); 28 Feb 2008 19:29:40 -0000 X-Spam-Check-By: sourceware.org Received: from bluesmobile.specifix.com (HELO bluesmobile.specifix.com) (216.129.118.140) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 28 Feb 2008 19:29:18 +0000 Received: from [127.0.0.1] (bluesmobile.specifix.com [216.129.118.140]) by bluesmobile.specifix.com (Postfix) with ESMTP id F10083C22A; Thu, 28 Feb 2008 11:29:16 -0800 (PST) Subject: Re: GDB command to write to memory From: Michael Snyder To: Guillaume MENANT Cc: gdb@sourceware.org In-Reply-To: <15730605.post@talk.nabble.com> References: <15730605.post@talk.nabble.com> Content-Type: text/plain Date: Thu, 28 Feb 2008 19:36:00 -0000 Message-Id: <1204226956.19253.451.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-7.fc7) Content-Transfer-Encoding: 7bit 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: 2008-02/txt/msg00252.txt.bz2 On Wed, 2008-02-27 at 22:38 -0800, Guillaume MENANT wrote: > The command x is used to examine memory but i don't find the command to write > directly a value in memory. I've tried X but it is not recognized. There's no such command. The general method is to use an assignment expression. You use a cast to determine the size of memory (byte, word...) you want to write. (gdb) set *(char *) 0xabcd = -1 You can do tricky things by using or omitting "signed", and usually write up to an 8-byte word by using "long long".