This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Support of gdb for Windows 64 native systems


Christopher Faylor wrote:
+  flags = DEBUG_ONLY_THIS_PROCESS;
+  toexec = exec_file;

This doesn't seem right. You moved this setting outside of an if block and didn't accommodate the else condition.


I didn't move it. The if inside the __CYGWIN__ block sets TOEXEC in both branches.

Here is rest of the hunk:
+
+#ifdef __CYGWIN__
  if (!useshell)
    {
-      flags = DEBUG_ONLY_THIS_PROCESS;
      cygwin_conv_to_win32_path (exec_file, real_path);
      toexec = real_path;
    }
@@ -1784,6 +1798,7 @@ win32_create_inferior (char *exec_file,
      toexec = shell;
      flags = DEBUG_PROCESS;
    }
+#endif

This is what the resulting code looks like after the patch is applied:


  flags = DEBUG_ONLY_THIS_PROCESS;
  toexec = exec_file;

#ifdef __CYGWIN__
  if (!useshell)
    {
      cygwin_conv_to_win32_path (exec_file, real_path);
      toexec = real_path;
    }
  else
    {
      char *newallargs;
      sh = getenv ("SHELL");
      if (!sh)
	sh = "/bin/sh";
      cygwin_conv_to_win32_path (sh, shell);
      newallargs = alloca (sizeof (" -c 'exec  '") + strlen (exec_file)
			   + strlen (allargs) + 2);
      sprintf (newallargs, " -c 'exec %s %s'", exec_file, allargs);
      allargs = newallargs;
      toexec = shell;
      flags = DEBUG_PROCESS;
    }
#endif

It could be changed into:

#ifdef __CYGWIN__
...
#else
  toexec = exec_file;
#endif

I prefer how it is now, but I'll respect your decision.

+#ifdef __CYGWIN__
  add_setshow_boolean_cmd ("shell", class_support, &useshell, _("\
Set use of shell to start subprocess."), _("\
Show use of shell to start subprocess."), NULL,
			   NULL,
			   NULL, /* FIXME: i18n: */
			   &setlist, &showlist);
+#endif

  add_setshow_boolean_cmd ("cygwin-exceptions", class_support, &cygwin_exceptions, _("\
Break when an exception is detected in the Cygwin DLL itself."), _("\

Seems like the above should be ifdef'ed too.



Not sure why. The cygwin1.dll dll detection doesn't depend on any host habilities. Having a mingw hosted gdb be able to attach to a cygwin executable, and being able to debug it, seems useful. I imagine that it might prove useful to have a gdb that doesn't link to cygwin1.dll as a resort into debugging Cygwin issues.

Cheers,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]