On windows kill with DebugBreakProcess() and not tskill. Available only on WinXP or higher.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@39766 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Riccardo Mottola 2016-05-15 08:27:14 +00:00
parent 27f8ec6f47
commit 3c0c85f3a5
2 changed files with 33 additions and 10 deletions

View file

@ -1,3 +1,8 @@
2016-05-15 Riccardo Mottola <rm@gnu.org>
* 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 <greg.casamento@gmail.com>
* Modules/Debuggers/ProjectCenter/PipeDelegate.m: Minor changes.

View file

@ -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 @@ static NSImage *downImage = nil;
#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
}
}