Author: rmottola
Date: Sun May 15 10:27:14 2016
New Revision: 39766

URL: http://svn.gna.org/viewcvs/gnustep?rev=39766&view=rev
Log:
On windows kill with DebugBreakProcess() and not tskill. Available only on 
WinXP or higher.

Modified:
    apps/projectcenter/trunk/ChangeLog
    apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PCDebugger.m

Modified: apps/projectcenter/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/ChangeLog?rev=39766&r1=39765&r2=39766&view=diff
==============================================================================
--- apps/projectcenter/trunk/ChangeLog  (original)
+++ apps/projectcenter/trunk/ChangeLog  Sun May 15 10:27:14 2016
@@ -1,3 +1,8 @@
+2016-05-15 Riccardo Mottola <[email protected]>
+
+       * Modules/Debuggers/ProjectCenter/PCDebugger.m
+       On windows kill with DebugBreakProcess() and not tskill. Available only 
on WinXP or higher.
+
 2016-05-05 15:43-EDT Gregory John Casamento <[email protected]>
 
        * Modules/Debuggers/ProjectCenter/PipeDelegate.m: Minor changes.

Modified: apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PCDebugger.m
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PCDebugger.m?rev=39766&r1=39765&r2=39766&view=diff
==============================================================================
--- apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PCDebugger.m       
(original)
+++ apps/projectcenter/trunk/Modules/Debuggers/ProjectCenter/PCDebugger.m       
Sun May 15 10:27:14 2016
@@ -29,6 +29,15 @@
 #import "PCDebuggerViewDelegateProtocol.h"
 #import "PipeDelegate.h"
 
+#ifdef __MINGW32__
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501 // Minimal target is Windows XP
+
+#include <windows.h>
+#include <winbase.h>
+WINBASEAPI BOOL WINAPI DebugBreakProcess(HANDLE);
+#endif
+
 #ifndef NOTIFICATION_CENTER
 #define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter]
 #endif
@@ -239,16 +248,25 @@
 #ifndef        __MINGW32__
       kill(subProcessId,SIGINT);
 #else
-      // on windows we run tskill as a shell command
-      NSTask *t;
-      NSArray *args;
-
-      args = [NSArray arrayWithObjects:[NSString stringWithFormat:@"%d", 
subProcessId], nil];
-      t = [NSTask new];
-      [t setArguments: args];
-      [t setLaunchPath:@"tskill.exe"];
-      [t launch];
-      [t release];
+      HANDLE proc;
+      NSLog(@"Windows - sending interrupt to %d", subProcessId);
+      proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)subProcessId);
+      if (proc == NULL)
+        {
+          DWORD lastError = GetLastError();
+          NSLog(@"error opening process %lu", (unsigned long)lastError);
+          return;
+        }
+      if (DebugBreakProcess(proc))
+        {
+          DWORD lastError = GetLastError();
+          NSLog(@"error sending break %lu", (unsigned long)lastError);
+        }
+      else
+        {
+          NSLog(@"break sent successfully");
+        }
+      CloseHandle(proc);
 #endif
     }
 }


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to