From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14045 invoked by alias); 28 Nov 2014 01:10:04 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 14022 invoked by uid 48); 28 Nov 2014 01:10:03 -0000 From: "asmwarrior at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/17659] New: [win32] GDB failed to get dll names when handling LOAD_DLL_DEBUG_EVENT event Date: Fri, 28 Nov 2014 01:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: asmwarrior at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q4/txt/msg00323.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=17659 Bug ID: 17659 Summary: [win32] GDB failed to get dll names when handling LOAD_DLL_DEBUG_EVENT event Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: asmwarrior at gmail dot com Hi, I see that some dlls are not listed when I type the "info shared" command under my Windows XP system. Thus, I can't set debug into the missing dll(such as I can't set a break point in the missing dll) I exam the source code a little, and found that we have a function named: static char * get_image_name (HANDLE h, void *address, int unicode) Which try to get the loaded dll name, but after debugged for a while, I see that for some dlls (not only the ntdll.dll, but there are other dlls), this function failed to get the image name of the dll. This is due to the condition that: /* See if we could read the address of a string, and that the address isn't null. */ if (!ReadProcessMemory (h, address, &address_ptr, sizeof (address_ptr), &done) || done != sizeof (address_ptr) || !address_ptr) return NULL; Here, the address_ptr is NULL. By looking at MSDN, I see that this value could be NULL, see: [LOAD_DLL_DEBUG_INFO structure (Windows)](http://msdn.microsoft.com/en-us/library/windows/desktop/ms680351(v=vs.85).aspx), as said by MSDN, the value lpImageName could not contains any information. So, I think the correct way to get the dll name is to through the hFile value of the LOAD_DLL_DEBUG_INFO, I see many articles saying about this, E.g.: [Writing Windows Debugger - Part 2 - CodeProject](http://www.codeproject.com/Articles/132742/Writing-Windows-Debugger-Part), it refer to a function named: GetFileNameFromHandle(), this function can also be seen from MSDN in the page: [Obtaining a File Name From a File Handle (Windows)](http://msdn.microsoft.com/en-us/library/windows/desktop/aa366789(v=vs.85).aspx) But to use this function, we need to include the psapi.dll under WindowsXP, which need link to libpsapi.a in MinGW. I don't tried it yet. -- You are receiving this mail because: You are on the CC list for the bug.