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

On Friday 01 May 2009 15:35:13, Danny Backx wrote:

> I've done some of that, but I'm stuck, I have questions.
> Basically I think I don't find the documentation that says what (from my
> new minidump-core.c module) is used to implement things like the
> backtrace command.

GDB needs registers and the thread's stack memory, so it can
unwind the stack, and needs to be tought about the register layout
in those ".reg" sections, as that layout differs between machines,
ABIs, and core file formats.

> warning: "/home/danny/src/gdb/gdb/arm/gdb/examples/Ce042809-01.kdmp": no
> core file handler recognizes format, using default

You need to fix this.  Look at i386-cygwin-tdep.c, and do something
similar in arm-wince-tdep.c.  You'll need to register a new sniffer
in _initialize_arm_wince_tdep (probably for bfd_target_unknown_flavour
or for a new minidump flavour you've added?), the sniffer callback can be
the current `arm_wince_osabi_sniffer' function, but you'll need to
tweak it to return GDB_OSABI_WINCE for your bfd.

Then, in arm_wince_init_abi, you need to register a
callback with set_gdbarch_regset_from_core_section that
extracts the registers from .reg sections.

> I see code that creates ".reg", ".crash", ".data" sections.

> Where can I find documentation for that ? 

Docs, who needs stinking docs ?!!!1 :-)  I don't know where
these things are documented, I just look at src/gdb/corelow.c
to see what GDB expects.

> Are these the things I need to do ?

Yes.  In your case, it will be one '.reg/TID' section per thread.  The
thread that was current at the time of the crash gets a literal ".reg"
section, that lives at the same offset as its corresponding ".reg/TID"
section.  Best look at the sections of a core file on your linux box
to see what I mean (objdump -h core).  You can borrow bits 
from bfd/elf.c:_bfd_elfcore_make_pseudosection for this.

".crash" isn't used by GDB, it seems specific to cisco cores.  It doesn't
matter the name of the section that contains data (only the
section flags count), but ".data" is fine.

I (re-)suggest to also add a ".module" section, containing the
list of loaded dlls, and their load addresses, and then to
copy the bits from i386-cygwin-tdep.c to arm-wince-tdep.c that
parse that section --- start with this bit:

    (gdbarch, windows_core_xfer_shared_libraries);

It looks to me that this ends sharing significant chunks of code
between arm-wince-tdep.c and i386-cygwin-tdep.c, so we
could move those bits of shared code to windows-tdep.c.

Pedro Alves

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