From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23906 invoked by alias); 25 Aug 2008 17:51:47 -0000 Received: (qmail 23896 invoked by uid 22791); 25 Aug 2008 17:51:46 -0000 X-Spam-Check-By: sourceware.org Received: from g1t0027.austin.hp.com (HELO g1t0027.austin.hp.com) (15.216.28.34) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 25 Aug 2008 17:51:01 +0000 Received: from g5t0030.atlanta.hp.com (g5t0030.atlanta.hp.com [16.228.8.142]) by g1t0027.austin.hp.com (Postfix) with ESMTP id 3C58C381C1; Mon, 25 Aug 2008 17:50:59 +0000 (UTC) Received: from ldl.fc.hp.com (ldl.fc.hp.com [15.11.146.30]) by g5t0030.atlanta.hp.com (Postfix) with ESMTP id 1747424132; Mon, 25 Aug 2008 17:50:59 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl.fc.hp.com (Postfix) with ESMTP id B648139C0A4; Mon, 25 Aug 2008 11:50:58 -0600 (MDT) Received: from ldl.fc.hp.com ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y2y1fZhQiwQ8; Mon, 25 Aug 2008 11:50:57 -0600 (MDT) Received: from tigger.helgaas (lart.fc.hp.com [15.11.146.31]) by ldl.fc.hp.com (Postfix) with ESMTP id AF85C39C06C; Mon, 25 Aug 2008 11:50:57 -0600 (MDT) From: Bjorn Helgaas To: Michael Snyder Subject: Re: read/write arbitrary files Date: Wed, 27 Aug 2008 07:30:00 -0000 User-Agent: KMail/1.9.9 Cc: "gdb@sourceware.org" References: <200808251040.08733.bjorn.helgaas@hp.com> <48B2EA7E.7030501@vmware.com> In-Reply-To: <48B2EA7E.7030501@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808251150.57002.bjorn.helgaas@hp.com> 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-08/txt/msg00275.txt.bz2 On Monday 25 August 2008 11:23:10 am Michael Snyder wrote: > Bjorn Helgaas wrote: > > I'd like to use gdb to examine and update arbitrary files. In > > particular, I'd like to disassemble and patch files like /dev/mem > > that are not in executable or core formats. > > > > Is there already a way to do this? If not, could there be? This > > was a very useful feature of adb. > > It's not really what gdb is good for. > Arbitrary files such as /dev/mem have no symbols and no types. > It should be easy to either use an existing hex editor, or > write one to do this sort of patching. This tool could be > orders of magnitude less complicated than gdb. The hex editor part is easy. I know how to do that already. The disassembly part is much harder, and this is the part I'm looking for. It'd be very handy to use all the disassemblers and the well-known user interface of gdb. Another useful feature of gdb is its knowledge of types. It would be convenient to be able to read type information from an executable, then use that information to format structures from /dev/mem. Bjorn