From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9800 invoked by alias); 16 Jun 2009 06:53:56 -0000 Received: (qmail 9789 invoked by uid 22791); 16 Jun 2009 06:53:54 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 16 Jun 2009 06:53:44 +0000 Received: from zps35.corp.google.com (zps35.corp.google.com [172.25.146.35]) by smtp-out.google.com with ESMTP id n5G6rer0001673 for ; Tue, 16 Jun 2009 07:53:41 +0100 Received: from qyk8 (qyk8.prod.google.com [10.241.83.136]) by zps35.corp.google.com with ESMTP id n5G6rb4J007779 for ; Mon, 15 Jun 2009 23:53:38 -0700 Received: by qyk8 with SMTP id 8so5318886qyk.19 for ; Mon, 15 Jun 2009 23:53:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.86.194 with SMTP id t2mr1495703qcl.49.1245135217724; Mon, 15 Jun 2009 23:53:37 -0700 (PDT) In-Reply-To: <3a665c760906152247r1625a2ban876c8c55ab52d4e2@mail.gmail.com> References: <3a665c760906152247r1625a2ban876c8c55ab52d4e2@mail.gmail.com> Date: Tue, 16 Jun 2009 06:53:00 -0000 Message-ID: <8ac60eac0906152353v7464a233ja58bf6d5280449e7@mail.gmail.com> Subject: Re: how to r/w memory From: Paul Pluzhnikov To: loody Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-System-Of-Record: true 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: 2009-06/txt/msg00168.txt.bz2 On Mon, Jun 15, 2009 at 10:47 PM, loody wrote: > From the gdb document, we can use "x/nfu address" to read memory, but > how we can write it? I usually do: (gdb) set *(int *)0x80000000 = 0 If GDB knows has debug info associated with the memory location, (gdb) print var = 2 or (gdb) set var = 3 also work for me. If GDB knows the symbol, but doesn't have debug info for it, you'll have to do cast again: (gdb) set *(int *)&var = 4 Cheers, -- Paul Pluzhnikov