A month or two ago, Dave Murphy uploaded a (pre-compiled) version of insight/gdb to the mingw sourceforge website (http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82725&release_id=371590). This was based on gdb CVS 6.3.50-20051116, with a 32k patch also available at the preceding URL. However, there were still a few issues: (1) Couldn't single-step (null pointer error in solib.c(in_solib_dynsym_resolve_code) (2) Couldn't map shared library sections/read shared library symbols I tracked these down, and was able to correct them with just a few minor changes (on top of Dave's original patch, which I brought forward to gdb CVS 6.4.50-20060131). My changes are quite minor, since Dave's patch does most of the work. For a detailed description of the observed behavior (with Dave's patch, but without my fixes), see this forum thread: http://sourceforge.net/forum/forum.php?thread_id=1430825&forum_id=511897 I hope that Dave does not take it amiss if I post the forward-ported version of his patch here, but I want to keep it here together with my dependent contributions. He has posted portions of it to this list before (notably, here: http://sources.redhat.com/ml/gdb-patches/2005-09/msg00205.html), and of course the full version against 6.3.50.20051116 at the URL at the top of this email). My forward ported version of his patch differs only in line-number fuzz, so it's really his, and not mine -- which means he'll have to re-post it or sign off on it, not me; and that'll have to happen before my minor contributions can really be considered. So, I've not created a ChangeLog entry for his stuff, but it should be noted that Dave's patch creates 7 new files: config/mh-mingw32 gdb/config/arm/mingw_embed.mt gdb/config/i386/mingw32.mh gdb/config/i386/mingw32.mt gdb/config/i386/nm-mingw32.h gdb/config/i386/tm-mingw32.h gdb/config/i386/xm-mingw32.h in addition to modifying 21 others (diffstat output for all both patches below). It's also possible that Dave's patch should be split into (at least) 2 pieces because some of it is really insight/tcl/tk, not gdb. However, with Dave's patch and my minor fixes, I can build an insight/gdb under mingw that actually works when dealing with apps that link to DLLs. 2006-02-02 Charles Wilson <...> * gdb/config/i386/nm-mingw32.h: define IN_SOLIB_DYNSYM_RESOLVE_CODE macro * gdb/win32-nat.c(register_loaded_dll): make sure so->so_name is populated, even on non-cygwin * gdb/solib.c(solib_open): ensure solib files are opened in binary mode. That binary mode one was fun. Didja know that "This program cannot be run in DOS mode." in the DOS stub of DLLs/EXEs is really "This program cannot be run in DOS mode.\r\r\n"? bfd_seek got all messed up, and the image_hdr.nt_signature contained the wrong bytes... Worse, even tho bfd_open "re-opens" the descriptor in binary mode by using fdopen(filedescriptor_from_solib_open, "rb") the actual mode does *not* get changed to binarymode in the gdb executable -- as I determined by actually inspecting the buffers in bfd_bread/cache_bread. But in a tiny test app using the same sequence, it _does_ work. int fd = open(..., O_RDONLY); >> explicit test/inspection: it's text mode here FILE* f = fdopen(fd, "rb"); >> explicit test/inspection: it's binary mode here Totally bizarre. But, the proof is in the pudding: by making the changes to solib.c, the solib is definitely opened in binary mode, and symbols are successfully read and sections are successfully mapped. gdb-6.4.50.20060131-cvs.patch-CharlesWilson2 config/i386/nm-mingw32.h | 3 +++ solib.c | 16 ++++++++++------ win32-nat.c | 2 ++ 3 files changed, 15 insertions(+), 6 deletions(-) gdb-6.4.50.20060131-cvs.patch-DaveMurphy1 Makefile.in | 2 bfd/doc/chew.c | 6 + config/mh-mingw32 | 7 + configure | 1 gdb/config/arm/mingw_embed.mt | 7 + gdb/config/i386/mingw32.mh | 5 + gdb/config/i386/mingw32.mt | 4 + gdb/config/i386/nm-mingw32.h | 38 +++++++++ gdb/config/i386/tm-mingw32.h | 21 +++++ gdb/config/i386/xm-mingw32.h | 25 ++++++ gdb/configure | 4 - gdb/configure.host | 1 gdb/configure.tgt | 7 + gdb/gdbtk/generic/gdbtk-cmds.c | 2 gdb/gdbtk/generic/gdbtk-hooks.c | 2 gdb/gdbtk/generic/gdbtk-interp.c | 5 + gdb/gdbtk/generic/gdbtk.c | 15 +++ gdb/gdbtk/library/download.itb | 2 gdb/gdbtk/library/interface.tcl | 2 gdb/gdbtk/library/prefs.tcl | 2 gdb/gdbtk/library/session.tcl | 2 gdb/gdbtk/library/srctextwin.itb | 4 - gdb/remote-rdp.c | 8 ++ gdb/remote-sim.c | 4 + gdb/win32-nat.c | 133 ++++++++++++++++++++++++++++++++- tcl/win/tclWin32Dll.c | 155 +++++++++++++++++++++++++++------------ tcl/win/tclWinChan.c | 6 - tcl/win/tclWinFCmd.c | 4 - 28 files changed, 408 insertions(+), 66 deletions(-) -- Chuck Wilson