更新动态库
This commit is contained in:
JianjunLiu
2022-12-01 14:22:17 +08:00
parent 5d8fb9e994
commit dc16fb9d4e
116 changed files with 282 additions and 402 deletions
+20 -46
View File
@@ -4,7 +4,7 @@ unit UtslCodeEditor;
20220520 分离调试器代码
}
interface
uses utslvcldesignerresource,cstructurelib,utslvclauxiliary,utslvclmemstruct,utslvclgdi,
uses utslvcldesignerresource,cstructurelib,utslvclauxiliary,utslvclmemstruct,utslvclgdi,utslvclstdctl,
tslvcl,UTslmemo,UTslSynMemo,utslvclsyntaxparser,utslvcldebuger;
{
1. page标签
@@ -2034,23 +2034,10 @@ type TEditer=class(TCustomcontrol) //
begin
if not it then return;
ShowEchoWnd();
//exe :=(FTslExe and ifstring(FTslExe))?FTslExe:SysExecName();
if FEchoWnd.Exeing()then FEchoWnd.Endexe();
if FEchoWnd.Exeing()then return FEchoWnd.Endexe();
s := FExecuteEditer.GetCurrentExuteString(it.Scriptpath);
// echo s,"\r\n";
FEchoWnd.Exec(s,"",h);
//FEchoWnd.Exec(exe,format('"%s" -libpath "%s"',it.ScriptPath,getdirfromfile(it.ScriptPath)),h);
FEchoWnd.Exec("",s,h);
end
{function ExecutePageItemWithCmd(it);
begin
s := FExecuteEditer.GetCurrentExuteString(it.Scriptpath);
hd := "d:\\test\\execmd.cmd";
//RewriteString(hd,s);
_wapi.WinExec("cmd.exe",1);
//_wapi.WinExec("",1);
//SysExec("","cmd.exe /c " + s,nil,false,c,nil);
//echo "===\r\n";
end }
function SavePageItem(it,f);
begin
if not it then return -1;
@@ -4256,60 +4243,47 @@ type TEditerEchoWnd=class(TSynMemoNorm) //
ClearAll();
AppendString("ctrl+z 停止;ctrl+c 复制选择\r\n");
end;
FProcess := new TCreateProcessA();
FProcess.BufSize := 1024 * 5;
FProcess := new tcustomprocess(self);
FProcess.OnEcho := thisfunction(TEchoToString);
FProcess.onended := thisfunction(onprocend);
FProcess.onstarted := thisfunction(onprocstart);
AppendString("ctrl+z 停止;ctrl+c 复制选择\r\n");
F_Highlighter := new TSynHighLighter(self);
//Highlighter := new TSynHighLighter(self);
end
function onprocstart(o,e);
begin
AppendString("开始执行");
end
function onprocend(o,e);
begin
AppendString(format("\r\n执行结束:endcode:%d\r\n",o.ErrInfo));
end
function TEchoToString(o,s);
begin
//t := now();
{if (t-FDoLockTime)>(0.3E-5) then
begin
FDoLockTime := t;
if FIsLocked then
begin
FIsLocked := false;
DecPaintLock();
end else
begin
FIsLocked := true;
IncPaintLock();
end
end }
AppendString(s);
//Visible := true;
return true;
end
function Exec(exe,cmd,h);
begin
//AppendString(format('"%s" %s\r\n',exe,cmd));
self.HighLighter := nil;
AppendString(format('%s %s\r\n',exe,cmd));
//EndExe();
r := FProcess.CreateProcessWaitRead(exe,cmd,h);
AppendString(format("\r\n执行结束:endcode:%d\r\n",r));
{if FIsLocked then
begin
FIsLocked := false;
DecPaintLock();
end }
r := FProcess.CreateProcess(exe,cmd);
h := r;
if r=0 then AppendString("执行失败!");
self.HighLighter := F_Highlighter;
h := 0;
return r;
end
function Exeing();
begin
return FProcess.LastExeHandle;
return FProcess.Handle;
end
function EndExe();
begin
if FProcess.LastExeHandle then
if FProcess.Handle then
begin
r := 1;
SysTerminate(r,FProcess.LastExeHandle);
SysTerminate(r,FProcess.Handle);
end
end
function KeyDown(o,e);override;
+27 -24
View File
@@ -4,7 +4,7 @@ interface
@explan(说明) 编辑器调试功能 %%
@date(20220520)
**}
uses cstructurelib,utslvclauxiliary,utslvclmemstruct, UTslMemo,UTslSynMemo, tslvcl;
uses cstructurelib,utslvclauxiliary,utslvclmemstruct, UTslMemo,UTslSynMemo,utslvclstdctl, tslvcl;
function tdbgcallback(); //调试回调
type TTslDebug = class(TTslDebuga)
function create(AOwner);
@@ -263,7 +263,7 @@ type TTslDebuga=class(TCustomControl)
FRuningfile; //执行脚本文件名
FRuningItem; //执行的pageitem
FCurrentgotoitem; //当前运行到的pageitem
FDebughandle; //调试的句柄
fdebugproc;
Fdebugedwhandle ;//调试的窗口
FDebugExe; //调试功能的exe
FConnectchannel; //调试的 通道
@@ -611,7 +611,6 @@ type TTslDebuga=class(TCustomControl)
fremotedbugstart := true;
fscriptbrks := array();
{$ifdef linux}
//
sp := ioFileseparator();
for i:= length(FDebugExe) downto 1 do
begin
@@ -619,15 +618,14 @@ type TTslDebuga=class(TCustomControl)
begin
exepath := FDebugExe[1:i];
break;
end
end
end
npm := array("LD_LIBRARY_PATH=" $ exepath ,getgtkdisplay());
exestr := ParserCommandLine(exestr);
{$else }
npm := nil;
Sysexecsetenvs(npm,0);
exestr := ParserCommandLine(exestr);
{$endif}
FDebughandle := sysexec(FDebugExe,exestr,npm,0,rcode,0);
if FDebughandle then
h := fdebugproc.CreateProcess(nil,exestr);
if h then
begin
ExecuteCommand("dbgcreatechannel");
ExecuteCommand("showeval","调试程序:"+FDebugExe);
@@ -716,6 +714,15 @@ type TTslDebuga=class(TCustomControl)
ow.DebugPageItem(ow.GetCurrentItem());
end
end
fdebugproc := new tcustomprocess(self);
fdebugproc.onended := function(o,e)
begin
toolbtnState("停止");
end
fdebugproc.OnEcho := function();
begin
return 1;
end
end
function addbreak(item,idx,n); //添加断点
begin
@@ -771,7 +778,7 @@ type TTslDebuga=class(TCustomControl)
{$ifdef linux}
{$else}
if not Fdebugedwhandle then
Fdebugedwhandle := GetWindowHandleByPID(_wapi.GetProcessId(FDebughandle),_wapi);
Fdebugedwhandle := GetWindowHandleByPID(_wapi.GetProcessId(fdebugproc.Handle),_wapi);
if Fdebugedwhandle then
begin
_wapi.SetForegroundWindow(Fdebugedwhandle);
@@ -859,7 +866,7 @@ type TTslDebuga=class(TCustomControl)
FConnectchannel := 0;
g_tsldbgcallback_handle := nil;
if FCurrentgotoitem and FCurrentgotoitem.FEditer then FCurrentgotoitem.FEditer.ExecuteCommand("ecruningto",nil);
FDebughandle := 0;Fdebugedwhandle := 0;
Fdebugedwhandle := 0;
toolbtnState("停止");
return;
end
@@ -1163,11 +1170,11 @@ type TTslDebuga=class(TCustomControl)
begin
if FConnectchannel then
begin
if FDebughandle then
if fdebugproc.Handle then
begin
//cd := {$ifdef linux} 1 {$else} -1 {$endif} ;
return SysTerminate(1,FDebughandle);
fdebugproc.terminate(1);
end
if FAttchedid then
begin
@@ -1232,15 +1239,11 @@ type TTslDebuga=class(TCustomControl)
end
//property rundirect read Frundirect write Frundirect;
private
function getgtkdisplay();
function getgtkdisplay(); //去掉try
begin
try
dsp := sys_getenv("DISPLAY");
if dsp="" then dsp := ":0";
if not ifstring(dsp) then dsp := ":0";
except
dsp := ":0";
end;
dsp := Sysgetenv("DISPLAY");
if dsp="" then dsp := ":0";
if not ifstring(dsp) then dsp := ":0";
return "DISPLAY="+dsp;
end
function getdefaultdbger();
@@ -1527,10 +1530,10 @@ type TTslDebuga=class(TCustomControl)
end
function stopdebug(); //结束进程
begin
if FDebughandle then
if fdebugproc.Handle then
begin
SysTerminate(1,FDebughandle);
FDebughandle := 0; Fdebugedwhandle := 0;
fdebugproc.terminate(1);
Fdebugedwhandle := 0;
end
end
function parseriteminfo(item,idx,n,usr);