From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29423 invoked by alias); 16 Dec 2013 02:21:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 29410 invoked by uid 89); 16 Dec 2013 02:21:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.5 required=5.0 tests=AWL,BAYES_00,GARBLED_BODY autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Dec 2013 02:21:51 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1VsNoY-0006l4-LF from Yao_Qi@mentor.com ; Sun, 15 Dec 2013 18:21:46 -0800 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sun, 15 Dec 2013 18:21:46 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Sun, 15 Dec 2013 18:21:44 -0800 Message-ID: <52AE633E.9020604@codesourcery.com> Date: Mon, 16 Dec 2013 02:21:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Pierre Muller CC: Subject: Re: [RFA] Fix cygwin compilation failure due to nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missing References: <002f01cef853$f44500e0$dccf02a0$@muller@ics-cnrs.unistra.fr> In-Reply-To: <002f01cef853$f44500e0$dccf02a0$@muller@ics-cnrs.unistra.fr> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00562.txt.bz2 On 12/14/2013 06:37 AM, Pierre Muller wrote: > introduced a failure for cygwin native build. > The problem is that __USEWIDE is not considered in the patch. > For the record, the build failure is this: cc1: warnings being treated as errors ../../git/gdb/windows-nat.c: In function ‘windows_ensure_ntdll_loaded’: ../../git/gdb/windows-nat.c:1773:11: error: passing argument 3 of ‘GetModuleFileNameEx’ from incompatible pointer type ../../git/gdb/windows-nat.c:1773:11: note: expected ‘LPWSTR’ but argument is of type ‘char *’ Makefile:998: recipe for target `windows-nat.o' failed > The patch below fixes this compilation error > and should allow cygwin to work as mingw. > > Pierre Muller > > > ChangeLog entry: > > 2013-12-13 Pierre Muller > > Fix compilation error for cygwin native build. > * windows-nat.c (windows_ensure_ntdll_loaded): Add > code using wchar_t type and conversion to char string > if __USEWIDE is defined. Probably, we can write (windows_ensure_ntdll_loaded) [__USEWIDE]: Call wcstombs. > > > diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c > index f0545fc..dda9d8e 100644 > --- a/gdb/windows-nat.c > +++ b/gdb/windows-nat.c > @@ -1764,17 +1764,27 @@ windows_ensure_ntdll_loaded (void) > for (i = 0; i < (int) (cb_needed / sizeof (HMODULE)); i++) > { > MODULEINFO mi; > +#ifdef __USEWIDE > + wchar_t dll_name[__PMAX]; > + char name[__PMAX]; > +#else > char dll_name[__PMAX]; > - > + char *name; > +#endif > if (GetModuleInformation (current_process_handle, hmodules[i], > &mi, sizeof (mi)) == 0) > continue; > if (GetModuleFileNameEx (current_process_handle, hmodules[i], > dll_name, sizeof (dll_name)) == 0) > continue; > - if (FILENAME_CMP (lbasename (dll_name), "ntdll.dll") == 0) > +#ifdef __USEWIDE > + wcstombs (name, dll_name, __PMAX); > +#else > + name = dll_name; > +#endif > + if (FILENAME_CMP (lbasename (name), "ntdll.dll") == 0) > { > - solib_end->next = windows_make_so (dll_name, mi.lpBaseOfDll); > + solib_end->next = windows_make_so (name, mi.lpBaseOfDll); > solib_end = solib_end->next; > return; > } GetModuleFileNameEx is also used in get_module_name, so probably we can copy its pattern here too #ifdef __CYGWIN__ len = GetModuleFileNameEx (current_process_handle, DllHandle, pathbuf, __PMAX); if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, pathbuf, dll_name_ret, __PMAX) < 0) ... #else len = GetModuleFileNameEx (current_process_handle, DllHandle, dll_name_ret, __PMAX); #endif and code is more consistent on using GetModuleFileNameEx. -- Yao (齐尧)