From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2495 invoked by alias); 30 Apr 2009 09:58:11 -0000 Received: (qmail 2483 invoked by uid 22791); 30 Apr 2009 09:58:10 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_13,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Apr 2009 09:58:05 +0000 Received: (qmail 12551 invoked from network); 30 Apr 2009 09:58:03 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Apr 2009 09:58:03 -0000 From: Pedro Alves To: danny.backx@scarlet.be Subject: Re: Post mortem debugging for Windows CE Date: Thu, 30 Apr 2009 09:58:00 -0000 User-Agent: KMail/1.9.10 Cc: gdb-patches@sourceware.org References: <1240929901.29047.110.camel@dannypc> <200904281702.30473.pedro@codesourcery.com> <1241076281.500.2.camel@dannypc> In-Reply-To: <1241076281.500.2.camel@dannypc> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904301058.14585.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00808.txt.bz2 Hi Danny, On Thursday 30 April 2009 08:24:41, Danny Backx wrote: > On Tue, 2009-04-28 at 17:02 +0100, Pedro Alves wrote: > > On Tuesday 28 April 2009 15:45:01, Danny Backx wrote: > > > I don't think gdb currently has this capability (to inspect postmortem > > > dump files) for debugging CE applications. > [..] > > If you mean adding gdb support to load minidump files, I can think > > of several ways to skin that cat: > [..] > > 2) teach bfd proper about minidumps, and export the register > > set info with fake .reg sections, similarly to how we do for elf > > core dumps. If you export the same set of sections GDB expects from > > elf cores (e.g., .reg/XXX sections for thread register sets, .module sections > > for loaded dlls.), then the GDB tweaks are the same as > > for #1 above. E.g, teach src/gdb/arm-wince-tdep.c how to extract the loaded > > dll list from the core's .module sections. > > > > 3) Teach GDB about minidumps, by adding a new minidump target_ops, > > similar in vein to src/gdb/corelow.c. GDB doesn't currenly like > > having more than on core file target_ops, though. > > I was wondering what is the difference between 2 and 3, and which one is > preferred ? 3. meant putting the minidump file parsing/loading code in GDB itself. The core of GDB is abstracted out from a "target" by the target_ops interface. This is the interface responsible for implementing the "read memory", "read registers", "gimme me shared library list", etc. callbacks. src/gdb/corelow.c is that interface implemented for reading core files. If you take a look there, you'll notice that that file doesn't load and parsing a core file itself. It uses bfd to do so. This means that GDB doesn't really care much if the core file is an elf core dump, an a.out core dump or something else. The file *format* itself is abstracted out on the bfd side. As long as the bfd interface is the same, new core file formats will work without much fuss. I wasn't certain how much of a core dump a minidump is when I wrote that; I'm now mostly convinced that 2. is the way to go. 2. meant putting the minidump file parsing code in bfd. On GDB side, things become mostly transparent. This is the prefered approach. See all the *-core.c files in bfd for starters, e.g. cisco-core.c or ptrace-core.c looks small enough to base on. See also bfd/elf.c, and look for bfd_core, and look at all the elfcore_grok_* functions to get a feel, specifically, you'll be interested in copying elfcore_grok_win32pstatus's NOTE_INFO_MODULE handling. I've never done this myself, but it looks to me you'll need to follow suit and add a new minidump bfd target, in a new bfd/minidump-core.c file. -- Pedro Alves