Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311182 - Enhance Spawner JNI code to use DebugBreakProcess when running on >= XP
Summary: Enhance Spawner JNI code to use DebugBreakProcess when running on >= XP
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Doug Schaefer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-30 10:12 EDT by John Cortell CLA
Modified: 2010-07-28 15:24 EDT (History)
0 users

See Also:
john.cortell: review? (cdtdoug)


Attachments
Fix (2.45 KB, patch)
2010-04-30 10:16 EDT, John Cortell CLA
john.cortell: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.