mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-23 00:18:51 +02:00
* fix problems for updating Debuggee title if Ctrl-C pressed
This commit is contained in:
parent
58893b78cd
commit
b63122a94e
@ -23,6 +23,9 @@ interface
|
|||||||
procedure ChangeDebuggeeWindowTitleTo(State : DebuggeeState);
|
procedure ChangeDebuggeeWindowTitleTo(State : DebuggeeState);
|
||||||
|
|
||||||
function CygDrivePrefix : string;
|
function CygDrivePrefix : string;
|
||||||
|
const
|
||||||
|
|
||||||
|
main_pid_valid : boolean = false;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -88,20 +91,34 @@ begin
|
|||||||
RegCloseKey(Key);
|
RegCloseKey(Key);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
MaxTitleLength = 512;
|
||||||
|
main_pid : longint = 0;
|
||||||
|
|
||||||
|
|
||||||
function GetWindowHandle(H : HWND; state : LPARAM) : WINBOOL;stdcall;
|
function GetWindowHandle(H : HWND; state : LPARAM) : WINBOOL;stdcall;
|
||||||
var pTitle, pEnd, pNewTitle : pchar;
|
var pTitle, pEnd, pNewTitle : pchar;
|
||||||
len : longint;
|
len : longint;
|
||||||
begin
|
begin
|
||||||
GetWindowHandle:=true;
|
GetWindowHandle:=true;
|
||||||
GetMem(pTitle,256);
|
GetMem(pTitle,MaxTitleLength);
|
||||||
{ we want all windows !! }
|
{ we want all windows !! }
|
||||||
if GetWindowThreadProcessId(H,nil)=inferior_pid then
|
if (GetWindowThreadProcessId(H,nil)=inferior_pid) or
|
||||||
|
main_pid_valid and (GetWindowThreadProcessId(H,nil)=main_pid) then
|
||||||
begin
|
begin
|
||||||
len:=GetWindowText(H,pTitle,256);
|
if not main_pid_valid then
|
||||||
|
begin
|
||||||
|
main_pid:=inferior_pid;
|
||||||
|
main_pid_valid:=true;
|
||||||
|
end;
|
||||||
|
len:=GetWindowText(H,pTitle,MaxTitleLength);
|
||||||
if DebuggeeState(State) = Stopped_State then
|
if DebuggeeState(State) = Stopped_State then
|
||||||
begin
|
begin
|
||||||
GetMem(pNewTitle,len+50);
|
GetMem(pNewTitle,len+50);
|
||||||
pEnd:=strpos(pTitle,'... running under FP debugger');
|
pEnd:=strpos(pTitle,'... running under FP debugger');
|
||||||
|
if assigned(pEnd) then
|
||||||
|
pEnd^:=#0;
|
||||||
|
pEnd:=strpos(pTitle,'... stopped by FP debugger');
|
||||||
if assigned(pEnd) then
|
if assigned(pEnd) then
|
||||||
pEnd^:=#0;
|
pEnd^:=#0;
|
||||||
strcopy(pNewTitle,pTitle);
|
strcopy(pNewTitle,pTitle);
|
||||||
@ -113,6 +130,9 @@ function GetWindowHandle(H : HWND; state : LPARAM) : WINBOOL;stdcall;
|
|||||||
begin
|
begin
|
||||||
GetMem(pNewTitle,len+50);
|
GetMem(pNewTitle,len+50);
|
||||||
pEnd:=strpos(pTitle,'... stopped by FP debugger');
|
pEnd:=strpos(pTitle,'... stopped by FP debugger');
|
||||||
|
if assigned(pEnd) then
|
||||||
|
pEnd^:=#0;
|
||||||
|
pEnd:=strpos(pTitle,'... running under FP debugger');
|
||||||
if assigned(pEnd) then
|
if assigned(pEnd) then
|
||||||
pEnd^:=#0;
|
pEnd^:=#0;
|
||||||
strcopy(pNewTitle,pTitle);
|
strcopy(pNewTitle,pTitle);
|
||||||
@ -121,7 +141,7 @@ function GetWindowHandle(H : HWND; state : LPARAM) : WINBOOL;stdcall;
|
|||||||
FreeMem(pNewTitle,len+50);
|
FreeMem(pNewTitle,len+50);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
FreeMem(pTitle,256);
|
FreeMem(pTitle,MaxTitleLength);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ChangeDebuggeeWindowTitleTo(State : DebuggeeState);
|
procedure ChangeDebuggeeWindowTitleTo(State : DebuggeeState);
|
||||||
|
Loading…
Reference in New Issue
Block a user