Re: Post mortem debugging for Windows CE

Danny Backx
2009-05-06T20:05:05Z

On Wed, 2009-05-06 at 15:35 +0100, Pedro Alves wrote:
> On Wednesday 06 May 2009 15:12:10, Danny Backx wrote:
> > It doesn't print from- and to-addresses in this example. I believe
> that
> > this is because solib_map_sections can't read the DLL files (they're
> > target DLLs from Windows CE, I don't have them on my host). So it
> fails
> > in :
> > scratch_chan = solib_open (filename, &scratch_pathname);
> >
> > if (scratch_chan < 0)
> > {
> > perror_with_name (filename);
> > }
> >
> > Am I right in concluding that this is the way it should work ?
>
> Looking very good. I had a vague memory that WinCE gdbserver reports
> absolute dlls paths when doing live debugging. Does it not? What
> does "info sharedlibrary" say when doing live debugging?

I've done a couple of tests. (See below, lengthy.) The bottom line :
- I should have used solib-search-path the first time you told me, not
after the second time :-)
- without setting solib-search-path, the output for both live and post-
mortem (minidump) sessions is a list of DLLs without address range.
- with setting solib-search-path, the output of both live and postmortem
sessions shows addresses for those DLLs found

> BTW, does "info threads" show the correct list of threads?

Not yet. The place where I found the register contents until now was not
'thread-safe' - there's only one set of registers there.

The only additional info I found points to memory regions that the minidump
doesn't contain a copy of.

Further poking on MSDN reveals a table that explains the contents of "context
dumps" (limited in size) vs. "system dumps" and "complete dumps".
See http://msdn.microsoft.com/en-us/library/ms939598.aspx .

Also http://msdn.microsoft.com/en-us/library/ms939607.aspx describes
registry settings to influence dump handling. Can't find a way to change
the type of dump though.

Danny

dannypc: {1017} gdb/gdb ~/tmp/arm/test/pedro/main.exe
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=arm-mingw32ce"...
(gdb) target remote ipaq:9999
Remote debugging using ipaq:9999
[New Thread 659080034]
Yow #### solib_map_sections
Error while mapping shared library sections:
bad.dll: No such file or directory.
Yow #### solib_map_sections
Error while mapping shared library sections:
coredll.dll.0409.mui: No such file or directory.
Yow #### solib_map_sections
Error while mapping shared library sections:
coredll.dll: No such file or directory.
Symbol file not found for bad.dll
Symbol file not found for coredll.dll.0409.mui
Symbol file not found for coredll.dll
WinMainCRTStartup (hInst=0x2564721e, hPrevInst=0x0,
lpCmdLine=0x2012fed8, nCmdShow=5)

at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/crt3.c:35
35 {
(gdb) l main
1 #include <stdio.h>
2 int main()
3 {
4 crashme (NULL);
5 }
(gdb) break main
Breakpoint 1 at 0x11060: file main.c, line 3.
(gdb) c
Continuing.

Breakpoint 1, main () at main.c:3
3 {
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
No bad.dll
No coredll.dll.0409.mui
No coredll.dll
(gdb) c
Continuing.
Data Abort: Thread=85eec650 Proc=8034e070 'main.exe'
AKY=00008001 PC=01451098(bad.dll+0x00001098) RA=0001106c(main.exe
+0x0000106c) BVA=20000000 FSR=00000007

Program received signal SIGSEGV, Segmentation fault.
0x01451098 in ?? ()
(gdb) q
The program is running. Exit anyway? (y or n) y
dannypc: {1018} gdb/gdb ~/tmp/arm/test/pedro/main.exe
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=arm-mingw32ce"...

(gdb) set solib-search-path /home/danny/tmp/arm/test/pedro
(gdb) break main
Breakpoint 1 at 0x11060: file main.c, line 3.
(gdb) c
The program is not being run.
(gdb) target remote ipaq:9999
Remote debugging using ipaq:9999
[New Thread 1154232258]
Yow #### solib_map_sections
Yow ### solib_target_relocate_section_addresses
Yow ### solib_target_relocate_section_addresses
Yow ### solib_target_relocate_section_addresses
Yow ### solib_target_relocate_section_addresses
Yow ### solib_target_relocate_section_addresses
Yow ### solib_target_relocate_section_addresses
Yow #### solib_map_sections
Error while mapping shared library sections:
coredll.dll.0409.mui: No such file or directory.
Yow #### solib_map_sections
Error while mapping shared library sections:
coredll.dll: No such file or directory.
Reading symbols from /home/danny/tmp/arm/test/pedro/bad.dll...done.
Loaded symbols for /home/danny/tmp/arm/test/pedro/bad.dll
Symbol file not found for coredll.dll.0409.mui
Symbol file not found for coredll.dll
WinMainCRTStartup (hInst=0x45da2d4a, hPrevInst=0x0,
lpCmdLine=0x2012fed8, nCmdShow=5)

at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/crt3.c:35
35 {
(gdb) break main
Note: breakpoint 1 also set at pc 0x11060.
Breakpoint 2 at 0x11060: file main.c, line 3.
(gdb) c
Continuing.

Breakpoint 1, main () at main.c:3
3 {
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
0x01451000 0x01456044
Yes /home/danny/tmp/arm/test/pedro/bad.dll
No coredll.dll.0409.mui
No coredll.dll
(gdb) q
The program is running. Exit anyway? (y or n) y
dannypc: {1019} rsh ipaq:/temp/main
ipaq:/temp/main: Unknown host
dannypc: {1020} rsh ipaq /temp/main
dannypc: {1021} rsh ipaq:/temp/ls /windows/system/dumpfiles/\*
ipaq:/temp/ls: Unknown host
dannypc: {1022} rsh ipaq /temp/ls /windows/system/dumpfiles/\*
ls /windows/system/dumpfiles/* :
0 [Ce041409-01] dir
1 [Ce042709-01] dir
2 [CabFiles] dir
3 [Ce042809-01] dir
4 [Ce042909-01] dir
5 [Ce042909-02] dir
6 [Ce050209-01] dir
7 [Ce050409-01] dir
8 [Ce050409-02] dir
9 [Ce050609-01] dir
dannypc: {1023} rsh
ipaq /temp/copydump /windows/system/dumpfiles/Ce050609-01/Ce050609-01k.dmp
dannypc: {1024} rcp ipaq:/temp/Ce050609-01.kdmp .
rcp: /temp/Ce050609-01.kdmp: No such file or directory
dannypc: {1025} rsh
ipaq /temp/copydump /windows/system/dumpfiles/Ce050609-01/Ce050609-01.kdmp
dannypc: {1026} rcp ipaq:/temp/Ce050609-01.kdmp .
dannypc: {1027} gdb/gdb ~/tmp/arm/test/pedro/main.exe Ce050609-01.kdmp
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=arm-mingw32ce"...
Yow module NK.EXE base 80001000 sz 0006C000
Yow pass ptr 0x881d970 -> module NK.EXE
Yow module main base 1E010000 sz 00012000
Yow pass ptr 0x881d9a0 -> module main
Yow module bad.dll base 01450000 sz 00010000
Yow pass ptr 0x880f040 -> module bad.dll
Yow module coredll.dll.0409.mui base 7FFE0000 sz 00015000
Yow pass ptr 0x881e0a0 -> module coredll.dll.0409.mui
Yow module coredll.dll base 03F4E000 sz 00096000
Yow pass ptr 0x881d8c8 -> module coredll.dll
Yow ##### win32_core_xfer_shared_libraries
Yow module name (NK.EXE) base_addr 0x80001000
Yow module name (main) base_addr 0x1e010000
Yow module name (bad.dll) base_addr 0x1450000
Yow ##### win32_xfer_shared_library (bad.dll) load 0x1450000
Yow module name (coredll.dll.0409.mui) base_addr 0x7ffe0000
Yow ##### win32_xfer_shared_library (coredll.dll.0409.mui) load
0x7ffe0000
Yow module name (coredll.dll) base_addr 0x3f4e000
Yow ##### win32_xfer_shared_library (coredll.dll) load 0x3f4e000
Yow ##### win32_core_xfer_shared_libraries
Yow module name (NK.EXE) base_addr 0x80001000
Yow module name (main) base_addr 0x1e010000
Yow module name (bad.dll) base_addr 0x1450000
Yow ##### win32_xfer_shared_library (bad.dll) load 0x1450000
Yow module name (coredll.dll.0409.mui) base_addr 0x7ffe0000
Yow ##### win32_xfer_shared_library (coredll.dll.0409.mui) load
0x7ffe0000
Yow module name (coredll.dll) base_addr 0x3f4e000
Yow ##### win32_xfer_shared_library (coredll.dll) load 0x3f4e000
Yow #### solib_map_sections
Error while mapping shared library sections:
bad.dll: No such file or directory.
Yow #### solib_map_sections
Error while mapping shared library sections:
coredll.dll.0409.mui: No such file or directory.
Yow #### solib_map_sections
Error while mapping shared library sections:
coredll.dll: No such file or directory.
Symbol file not found for bad.dll
Symbol file not found for coredll.dll.0409.mui
Symbol file not found for coredll.dll
Core was generated by `main'.
Yow minidump_core_file_failing_signal -> C0000005
Program terminated with signal 11, Segmentation fault.
[New process 1182062390]
Yow arm_minidump_regset_from_core_section
Yow arm_minidump_supply_gregset
#0 0x01451098 in ?? ()
(gdb) set solib-search-path /home/danny/tmp/arm/test/pedro
Yow ##### win32_core_xfer_shared_libraries
Yow module name (NK.EXE) base_addr 0x80001000
Yow module name (main) base_addr 0x1e010000
Yow module name (bad.dll) base_addr 0x1450000
Yow ##### win32_xfer_shared_library (bad.dll) load 0x1450000
Yow module name (coredll.dll.0409.mui) base_addr 0x7ffe0000
Yow ##### win32_xfer_shared_library (coredll.dll.0409.mui) load
0x7ffe0000
Yow module name (coredll.dll) base_addr 0x3f4e000
Yow ##### win32_xfer_shared_library (coredll.dll) load 0x3f4e000
Yow ##### win32_core_xfer_shared_libraries
Yow module name (NK.EXE) base_addr 0x80001000
Yow module name (main) base_addr 0x1e010000
Yow module name (bad.dll) base_addr 0x1450000
Yow ##### win32_xfer_shared_library (bad.dll) load 0x1450000
Yow module name (coredll.dll.0409.mui) base_addr 0x7ffe0000
Yow ##### win32_xfer_shared_library (coredll.dll.0409.mui) load
0x7ffe0000
Yow module name (coredll.dll) base_addr 0x3f4e000
Yow ##### win32_xfer_shared_library (coredll.dll) load 0x3f4e000
Yow #### solib_map_sections
Yow ### solib_target_relocate_section_addresses
Yow ### solib_target_relocate_section_addresses
Yow ### solib_target_relocate_section_addresses
Yow ### solib_target_relocate_section_addresses
Yow ### solib_target_relocate_section_addresses
Yow ### solib_target_relocate_section_addresses
Yow #### solib_map_sections
Error while mapping shared library sections:
coredll.dll.0409.mui: No such file or directory.
Yow #### solib_map_sections
Error while mapping shared library sections:
coredll.dll: No such file or directory.
Reading symbols from /home/danny/tmp/arm/test/pedro/bad.dll...done.
Loaded symbols for /home/danny/tmp/arm/test/pedro/bad.dll
Symbol file not found for coredll.dll.0409.mui
Symbol file not found for coredll.dll
(gdb) info sharedlibrary
Yow ##### win32_core_xfer_shared_libraries
Yow module name (NK.EXE) base_addr 0x80001000
Yow module name (main) base_addr 0x1e010000
Yow module name (bad.dll) base_addr 0x1450000
Yow ##### win32_xfer_shared_library (bad.dll) load 0x1450000
Yow module name (coredll.dll.0409.mui) base_addr 0x7ffe0000
Yow ##### win32_xfer_shared_library (coredll.dll.0409.mui) load
0x7ffe0000
Yow module name (coredll.dll) base_addr 0x3f4e000
Yow ##### win32_xfer_shared_library (coredll.dll) load 0x3f4e000
Yow ##### win32_core_xfer_shared_libraries
Yow module name (NK.EXE) base_addr 0x80001000
Yow module name (main) base_addr 0x1e010000
Yow module name (bad.dll) base_addr 0x1450000
Yow ##### win32_xfer_shared_library (bad.dll) load 0x1450000
Yow module name (coredll.dll.0409.mui) base_addr 0x7ffe0000
Yow ##### win32_xfer_shared_library (coredll.dll.0409.mui) load
0x7ffe0000
Yow module name (coredll.dll) base_addr 0x3f4e000
Yow ##### win32_xfer_shared_library (coredll.dll) load 0x3f4e000
From To Syms Read Shared Object Library
0x01451000 0x01456044
Yes /home/danny/tmp/arm/test/pedro/bad.dll
No coredll.dll.0409.mui
No coredll.dll
(gdb) q
dannypc: {1028}

--
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info