This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Post mortem debugging for Windows CE

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]