Fix compilation error for cygwin native build.
authorPierre Muller <muller@ics.u-strasbg.fr>
Mon, 16 Dec 2013 22:44:43 +0000 (23:44 +0100)
committerPierre Muller <muller@ics.u-strasbg.fr>
Mon, 16 Dec 2013 22:44:43 +0000 (23:44 +0100)
        * windows-nat.c (windows_ensure_ntdll_loaded) [__USEWIDE]:
        Call wcstombs.

gdb/ChangeLog
gdb/windows-nat.c

index cd954e0e1e3d269a8fac6de1380c410800d17cad..70edc084013f5bd52c30e4b5efc9ee53a5292ea8 100644 (file)
@@ -1,3 +1,9 @@
+2013-12-16  Pierre Muller  <muller@sourceware.org>
+
+       Fix compilation error for cygwin native build.
+       * windows-nat.c (windows_ensure_ntdll_loaded) [__USEWIDE]:
+       Call wcstombs.
+
 2013-12-16  Pedro Alves  <palves@redhat.com>
 
        PR 16329
index f0545fcc967f94a1ddf90917a82bf842a836b3c1..dda9d8e020443e2f4bf6d6a5fed5251678ce3895 100644 (file)
@@ -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;
        }