Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 311182

Summary: Enhance Spawner JNI code to use DebugBreakProcess when running on >= XP
Product: [Tools] CDT Reporter: John Cortell <john.cortell>
Component: cdt-coreAssignee: Project Inbox <cdt-core-inbox>
Status: RESOLVED FIXED QA Contact: Doug Schaefer <cdtdoug>
Severity: normal    
Priority: P3 Flags: john.cortell: review? (cdtdoug)
Version: 7.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Fix john.cortell: iplog-

Description John Cortell CLA 2010-04-30 10:12:11 EDT
Currently, the Spawner code is limited when interrupting a process in another console. It has to simulate a CTRL-C via keyboard events. Not only is it complicated, but it will only work if that process has a dedicated console. Pedro Alves revealed to us that we can use DebugBreakProcess instead. 
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c60

It's available in XP and beyond. I've updated the Spawner raise() method to use this if it's available.

What this means is that a CDT debugger user can now interrupt an attached-to process without having to launch the program using 'start myprogram.exe'.

Note that even the use of DebugBreakProcess will eventually becomes unnecessary-- when we stop supporting gdb's < 7.0. With 7.0, we can simply interrupt gdb itself and gdb takes care of interrupting the inferior.
Comment 1 John Cortell CLA 2010-04-30 10:16:59 EDT
Created attachment 166614 [details]
Fix

Fix. Note that though the suggestion to use DebugBreakProcess came from an engineer at CodeSourcery, stating they use the function in gdb, I did not look at any such GPL code. This simple patch was written 100% from scratch using nothing but MSDN documentation as a reference.
Comment 2 John Cortell CLA 2010-04-30 10:18:50 EDT
Committed to HEAD. Doug, please review.