View Issue Details

IDProjectCategoryView StatusLast Update
0021834LazarusDebuggerpublic2020-08-15 21:10
ReporterEmelyanov Roman Assigned ToMartin Friebe  
PrioritynormalSeverityfeatureReproducibilityalways
Status feedbackResolutionopen 
Platformx86_64OSWindows, Linux 
Product Version1.1 (SVN) 
Summary0021834: Patch for remote debbuging
DescriptionI wrote a small patch to add support for remote debugging via SSH. I tested it only doing debugging app runs at x86_64-linux from x86_64-win64. In one place (TSSHGDBMIDebugger.Create) i use hardcore constant that useble only when we debug linux app from windows. Posible exist more accurate solution.
Additional InformationThere is my small article about using remote debugging in Lazarus. But it`s in russian. My english too poor to translate it. Link to it: http://catcompany.org/?p=139
TagsNo tags attached.
Fixed in Revision
LazTarget-
Widgetset
Attached Files

Activities

2012-04-22 20:07

 

GDBviaSSH.patch (5,856 bytes)   
Index: debugger/cmdlinedebugger.pp
===================================================================
--- debugger/cmdlinedebugger.pp	(revision 36883)
+++ debugger/cmdlinedebugger.pp	(working copy)
@@ -48,7 +48,8 @@
   TCmdLineDebugger = class(TDebugger)
   private
     FDbgProcess: TProcess;   // The process used to call the debugger
-    FLineEnds: TStringDynArray;  // List of strings considered as lineends
+  protected  FLineEnds: TStringDynArray;  // List of strings considered as lineends
+  private
     FOutputBuf: String;
     FReading: Boolean;       // Set if we are in the ReadLine loop
     FFlushAfterRead: Boolean;// Set if we should flush after finished reading
Index: debugger/gdbmidebugger.pp
===================================================================
--- debugger/gdbmidebugger.pp	(revision 36883)
+++ debugger/gdbmidebugger.pp	(working copy)
@@ -50,7 +50,7 @@
 {$IFDEF DBG_ENABLE_TERMINAL}
    PseudoTerminalDlg,
 {$ENDIF}
-  BaseDebugManager, GDBMIMiscClasses;
+  BaseDebugManager, GDBMIMiscClasses, Project;
 
 type
   TGDBMIProgramInfo = record
@@ -559,6 +559,8 @@
 
 implementation
 
+Uses EnvironmentOpts;
+
 var
   DBGMI_QUEUE_DEBUG, DBGMI_STRUCT_PARSER: PLazLoggerLogGroup;
 
@@ -7164,7 +7166,7 @@
     Options := '-silent -i mi -nx';
 
     if Length(TGDBMIDebuggerProperties(GetProperties).Debugger_Startup_Options) > 0
-    then Options := Options + ' ' + TGDBMIDebuggerProperties(GetProperties).Debugger_Startup_Options;
+    then Options := TGDBMIDebuggerProperties(GetProperties).Debugger_Startup_Options + ' ' + Options;
 
     if CreateDebugProcess(Options)
     then begin
@@ -10698,6 +10700,11 @@
   Result.FuncName := Frame.Values['func'];
   Result.SrcFile := ConvertGdbPathAndFile(Frame.Values['file']);
   Result.SrcFullName := ConvertGdbPathAndFile(Frame.Values['fullname']);
+
+  If (Result.SrcFullName <> '') And
+     (EnvironmentOptions.DebuggerConfig.DebuggerClass = 'TSSHGDBMIDebugger')
+     Then Result.SrcFullName := ConvertGdbPathAndFile(Project1.ProjectDirectory+'\'+Frame.Values['file']);
+
   Result.SrcLine := StrToIntDef(Frame.Values['line'], -1);
 
   Frame.Free;
Index: debugger/sshgdbmidebugger.pas
===================================================================
--- debugger/sshgdbmidebugger.pas	(revision 36883)
+++ debugger/sshgdbmidebugger.pas	(working copy)
@@ -44,11 +44,12 @@
   TSSHGDBMIDebugger = class(TGDBMIDebugger)
   private
   protected
-    function ParseInitialization: Boolean; override;
+    function ParseInitialization: Boolean; Override;
   public
     class function CreateProperties: TDebuggerProperties; override;  // Creates debuggerproperties
     class function Caption: String; override;
     class function ExePaths: String; override;
+    constructor Create(const AExternalDebugger: String); override;
   end;
 
   TSSHGDBMIDebuggerProperties = class(TGDBMIDebuggerProperties)
@@ -123,6 +124,12 @@
 
 { TSSHGDBMIDebugger }
 
+constructor TSSHGDBMIDebugger.Create(const AExternalDebugger: String);
+Begin
+ Inherited;
+ FLineEnds[0] := #10;
+End;
+
 class function TSSHGDBMIDebugger.Caption: String;
 begin
   Result := 'GNU debugger through SSH (gdb)';
Index: ide/debugmanager.pas
===================================================================
--- ide/debugmanager.pas	(revision 36883)
+++ ide/debugmanager.pas	(working copy)
@@ -2049,7 +2049,8 @@
       end;
     end
     else
-      if not FileIsExecutable(LaunchingApplication)
+      If (DebuggerClass <> TSSHGDBMIDebugger) And
+         not FileIsExecutable(LaunchingApplication)
       then begin
         MessageDlg(lisLaunchingApplicationInvalid,
           Format(lisTheLaunchingApplicationDoesNotExistsOrIsNotExecuta, ['"',
@@ -2131,14 +2132,15 @@
     Project1.RunParameterOptions.AssignEnvironmentTo(FDebugger.Environment);
     NewWorkingDir:=Project1.RunParameterOptions.WorkingDirectory;
     GlobalMacroList.SubstituteStr(NewWorkingDir);
-    if (NewWorkingDir<>'') and (not DirectoryExistsUTF8(NewWorkingDir)) then begin
+    if (DebuggerClass <> TSSHGDBMIDebugger) and
+       (NewWorkingDir<>'') and (not DirectoryExistsUTF8(NewWorkingDir)) then begin
       MessageDlg(lisUnableToRun,
         Format(lisTheWorkingDirectoryDoesNotExistPleaseCheckTheWorki, ['"',
           NewWorkingDir, '"', #13]),
         mtError,[mbCancel],0);
       exit;
     end;
-    if NewWorkingDir='' then begin
+    if (NewWorkingDir='') then begin
       NewWorkingDir:=ExtractFilePath(BuildBoss.GetProjectTargetFilename(Project1));
       if (NewWorkingDir<>'') and (not DirectoryExistsUTF8(NewWorkingDir)) then begin
         MessageDlg(lisUnableToRun,
@@ -2151,8 +2153,9 @@
 
     // The following commands may call ProcessMessages, and FDebugger can be nil after each
 
-    if FDebugger <> nil
-    then FDebugger.WorkingDir:=CleanAndExpandDirectory(NewWorkingDir);
+    if FDebugger <> nil then
+     if (DebuggerClass <> TSSHGDBMIDebugger) Then FDebugger.WorkingDir:=CleanAndExpandDirectory(NewWorkingDir)
+                                             Else FDebugger.WorkingDir:=NewWorkingDir;
     // set filename after workingdir
     if FDebugger <> nil
     then FDebugger.FileName := LaunchingApplication;
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 36883)
+++ ide/main.pp	(working copy)
@@ -12171,7 +12171,10 @@
   // Check project build
   ProgramFilename := MainBuildBoss.GetProjectTargetFilename(Project1);
   DebugLn(['TMainIDE.DoInitProjectRun ProgramFilename=',ProgramFilename]);
-  if not FileExistsUTF8(ProgramFilename)
+
+
+  If (EnvironmentOptions.DebuggerConfig.DebuggerClass <> 'TSSHGDBMIDebugger') And
+     not FileExistsUTF8(ProgramFilename)
   then begin
     IDEMessageDialog(lisFileNotFound,
       Format(lisNoProgramFileSFound, ['"', ProgramFilename, '"']),
GDBviaSSH.patch (5,856 bytes)   

Martin Friebe

2012-04-23 12:44

manager   ~0058922

I can see the issues from the patch. They need to be fixed in a different way

This is not allowed:
       If (DebuggerClass <> TSSHGDBMIDebugger)

Instead virtual methods on the debugger class must be introduced.

I will look into it.
If you want to change the patch (otherwise I will), please do multiply patches for
- line-ending
- local file testing

In any case, if behaviour is platform specific, then options must be introduced. (maybe also for "CleanAndExpandDirectory")

Mattias Gaertner

2012-04-23 12:59

manager   ~0058925

Small warnings: Since there were several bugs due to misuse of ExpandFile/ExpandDirectory functions:
Please keep in mind that these functions expand relative file names using the GetCurrentDir, which may contain an arbitrary directory in the IDE.
Use instead: TrimAndExpandFilename/Directory with a well defined base directory, e.g. the project directory.

Emelyanov Roman

2012-04-24 18:40

reporter   ~0058948

Why "If (DebuggerClass <> TSSHGDBMIDebugger)" is bad? You mean if we add some new remote debugger like TTelNetGDBMIDebugger this test will be wrong?

And file exist tests done in "ide/debugmanager.pas", so possible solution: make field "IsRemote" in debugger class and change test to "If Not DebuggerClass.IsRemote".

About line-ending: i do not understand from where it must be obtained automatically. Possible need additional parameter in remote debugger options?

Ok, i will split patch

Martin Friebe

2012-04-24 23:07

manager   ~0058963

Yes something like
  If Not DebuggerClass.IsRemote"

Preferable even more specific. Move the entire check and update, into debuggerclass. So each debugger can do what it needs.
I need to check. If currently soma of the path expansion depends on IDE internals (like macro expansion), then that needs to be separated.

line ending, again I haven't yet looked at which platform may need whdich line endings. If there is an one-for-all setting - good. Otherwise, maybe a DebuggerProperty, to allow user selection.

I will look at it in more detail, hopefully soon.

Emelyanov Roman

2012-04-25 00:56

reporter   ~0058968

Ok. I already partially implemented line-endian via DebuggerClass property and "DebuggerClass.IsRemoteDebugger". So i wait what you decide.

Martin Friebe

2012-04-25 22:04

manager   ~0058987

Ok, I started looking at it.

1)
  protected FLineEnds: TStringDynArray;
Why expose the variable? A protected setter already exists.

However in order to allow detecting any line-ending Cr,CrLf, LfCr, Lf, I moved the search for line endings in a new method and overwrote it in GDBMI dbg (so command-line-dbg keeps it functionality).
R 37026, 37027


2)
TGDBMIDebugger
     if Length(TGDBMIDebuggerProperties(GetProperties).Debugger_Startup_Options) > 0
- then Options := Options + ' ' + TGDBMIDebuggerProperties(GetProperties).Debugger_Startup_Options;
+ then Options := TGDBMIDebuggerProperties(GetProperties).Debugger_Startup_Options + ' ' + Options;

Can you give me an example, where the new order is required?


3)
TGDBMIDebugger
+ If (Result.SrcFullName <> '') And
+ (EnvironmentOptions.DebuggerConfig.DebuggerClass = 'TSSHGDBMIDebugger')
+ Then Result.SrcFullName := ConvertGdbPathAndFile(Project1.ProjectDirectory+'\'+Frame.Values['file']);

Again an example please? (Include log and output http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session )

IIRC, if SrcFullName is left empty, then the Debugger will resolve it in TDebugManager.GetFullFilename. Which may be project or package.


4)
I will still look into the remaining issues: FileExists/Executable/CleanAndExpandDirectory

Emelyanov Roman

2012-04-27 16:59

reporter   ~0059046

> 1) Why expose the variable? A protected setter already exists.
It`a my mistake, i don`t found it.

>However in order to allow detecting any line-ending Cr,CrLf, LfCr, Lf, I moved >the search for line endings in a new method and overwrote it in GDBMI dbg (so >command-line-dbg keeps it functionality).
>R 37026, 37027
I test it, it`s work and posible it best solution.

>Can you give me an example, where the new order is required?
Look, we have:
Debugger file name = C:\Program Files\Portable Software\Utilits\Putty\PLINK.EXE (its my SSh client). Lazarus check this value for file exist and it`s ok, file exist in local file system. But, we need run gdb, not SSH, so we need execute something like that: "C:\Program Files\Portable Software\Utilits\Putty\PLINK.EXE" CentOSDev gdb <parametrs for gdb>. I put this "CentOSDev gdb" in Debbuger_Startup_Options.
If you dont like this solution, it`s possible another solution: write SSH parameters with client file name, like: "C:\Program Files\Portable Software\Utilits\Putty\PLINK.EX" CentOSDev gdb. But in this case we need to change check debugger file exist procedure for support extract file name from filename+params string before check file exist.

>3) Again an example please?
It`s strange. Now i can not reproduce situation in that my changes need. The problem was same as file exist test. GDB return source files full names in remote file system. But now it`s ok, GDB return file name without any patches. Meanwhile let's forget about it to a problem.

2012-04-27 17:06

 

GDBviaSSH2.patch (8,888 bytes)   
Index: debugger/debugger.pp
===================================================================
--- debugger/debugger.pp	(revision 37048)
+++ debugger/debugger.pp	(working copy)
@@ -2767,6 +2767,7 @@
     procedure SetEnvironment(const AValue: TStrings);
     procedure SetFileName(const AValue: String);
   protected
+    FIsRemoteDebugger: Boolean;
     procedure ResetStateToIdle; virtual;
     function  CreateBreakPoints: TDBGBreakPoints; virtual;
     function  CreateLocals: TLocalsSupplier; virtual;
@@ -2884,6 +2885,7 @@
     property OnConsoleOutput: TDBGOutputEvent read FOnConsoleOutput write FOnConsoleOutput;  // Passes Application Console Output
     property OnFeedback: TDBGFeedbackEvent read FOnFeedback write FOnFeedback;
     property OnIdle: TNotifyEvent read FOnIdle write FOnIdle;                    // Called if all outstanding requests are processed (queue empty)
+    property IsRemoteDebugger: Boolean read FIsRemoteDebugger;
   end;
   TDebuggerClass = class of TDebugger;
 
Index: debugger/sshgdbmidebugger.pas
===================================================================
--- debugger/sshgdbmidebugger.pas	(revision 37048)
+++ debugger/sshgdbmidebugger.pas	(working copy)
@@ -49,6 +49,7 @@
     class function CreateProperties: TDebuggerProperties; override;  // Creates debuggerproperties
     class function Caption: String; override;
     class function ExePaths: String; override;
+    constructor Create(const AExternalDebugger: String); override;
   end;
 
   TSSHGDBMIDebuggerProperties = class(TGDBMIDebuggerProperties)
@@ -123,6 +124,12 @@
 
 { TSSHGDBMIDebugger }
 
+constructor TSSHGDBMIDebugger.Create(const AExternalDebugger: String);
+Begin
+ FIsRemoteDebugger := True;
+ Inherited;
+End;
+
 class function TSSHGDBMIDebugger.Caption: String;
 begin
   Result := 'GNU debugger through SSH (gdb)';
Index: ide/basedebugmanager.pas
===================================================================
--- ide/basedebugmanager.pas	(revision 37048)
+++ ide/basedebugmanager.pas	(working copy)
@@ -121,9 +121,7 @@
     function  FindDebuggerClass(const Astring: String): TDebuggerClass;
     function  GetState: TDBGState; virtual; abstract;
     function  GetCommands: TDBGCommands; virtual; abstract;
-    {$IFDEF DBG_WITH_DEBUGGER_DEBUG}
     function GetDebugger: TDebugger; virtual; abstract;
-    {$ENDIF}
   public
     procedure Reset; virtual; abstract;
 
@@ -219,9 +217,7 @@
     property Watches: TWatchesMonitor read FWatches;
     property Threads: TThreadsMonitor read FThreads;
     property Snapshots: TSnapshotManager read FSnapshots;
-    {$IFDEF DBG_WITH_DEBUGGER_DEBUG}
     property Debugger: TDebugger read GetDebugger;
-    {$ENDIF}
   end;
 
 procedure RegisterDebugger(const ADebuggerClass: TDebuggerClass);
Index: ide/debugmanager.pas
===================================================================
--- ide/debugmanager.pas	(revision 37048)
+++ ide/debugmanager.pas	(working copy)
@@ -153,9 +153,7 @@
     function  GetState: TDBGState; override;
     function  GetCommands: TDBGCommands; override;
     function GetDebuggerClass: TDebuggerClass;
-    {$IFDEF DBG_WITH_DEBUGGER_DEBUG}
     function GetDebugger: TDebugger; override;
-    {$ENDIF}
   public
     constructor Create(TheOwner: TComponent); override;
     destructor Destroy; override;
@@ -2024,40 +2022,6 @@
 
     SplitCmdLine(LaunchingCmdLine, LaunchingApplication, LaunchingParams);
 
-    if BuildBoss.GetProjectUsesAppBundle then
-    begin
-      // it is Application Bundle (darwin only)
-
-      if not DirectoryExistsUTF8(LaunchingApplication) then
-      begin
-        if MessageDlg(lisLaunchingApplicationInvalid,
-          Format(lisTheLaunchingApplicationBundleDoesNotExists,
-            [LaunchingCmdLine, #13, #13, #13, #13]),
-          mtError, [mbYes, mbNo, mbCancel], 0) = mrYes then
-        begin
-          if not BuildBoss.CreateProjectApplicationBundle then Exit;
-        end
-        else
-          Exit;
-      end;
-
-      if DebuggerClass = TProcessDebugger then
-      begin // use executable path inside Application Bundle (darwin only)
-        LaunchingApplication := LaunchingApplication + '/Contents/MacOS/' +
-          ExtractFileNameOnly(LaunchingApplication);
-        LaunchingParams := LaunchingParams;
-      end;
-    end
-    else
-      if not FileIsExecutable(LaunchingApplication)
-      then begin
-        MessageDlg(lisLaunchingApplicationInvalid,
-          Format(lisTheLaunchingApplicationDoesNotExistsOrIsNotExecuta, ['"',
-            LaunchingCmdLine, '"', #13, #13, #13]),
-          mtError, [mbOK],0);
-        Exit;
-      end;
-
     //todo: this check depends on the debugger class
     if (DebuggerClass <> TProcessDebugger)
     and not FileIsExecutable(EnvironmentOptions.GetParsedDebuggerFilename)
@@ -2096,6 +2060,42 @@
       Exit;
     end;
 
+    if BuildBoss.GetProjectUsesAppBundle then
+    begin
+      // it is Application Bundle (darwin only)
+
+      if not DirectoryExistsUTF8(LaunchingApplication) then
+      begin
+        if MessageDlg(lisLaunchingApplicationInvalid,
+          Format(lisTheLaunchingApplicationBundleDoesNotExists,
+            [LaunchingCmdLine, #13, #13, #13, #13]),
+          mtError, [mbYes, mbNo, mbCancel], 0) = mrYes then
+        begin
+          if not BuildBoss.CreateProjectApplicationBundle then Exit;
+        end
+        else
+          Exit;
+      end;
+
+      if DebuggerClass = TProcessDebugger then
+      begin // use executable path inside Application Bundle (darwin only)
+        LaunchingApplication := LaunchingApplication + '/Contents/MacOS/' +
+          ExtractFileNameOnly(LaunchingApplication);
+        LaunchingParams := LaunchingParams;
+      end;
+    end
+    else
+      If ((Not FDebugger.IsRemoteDebugger)) And
+         not FileIsExecutable(LaunchingApplication)
+      then begin
+        MessageDlg(lisLaunchingApplicationInvalid,
+          Format(lisTheLaunchingApplicationDoesNotExistsOrIsNotExecuta, ['"',
+            LaunchingCmdLine, '"', #13, #13, #13]),
+          mtError, [mbOK],0);
+        Exit;
+      end;
+
+
     EnvironmentOptions.LoadDebuggerProperties(DebuggerClass.ClassName, FDebugger.GetProperties);
 
     ClearDebugOutputLog;
@@ -2131,14 +2131,15 @@
     Project1.RunParameterOptions.AssignEnvironmentTo(FDebugger.Environment);
     NewWorkingDir:=Project1.RunParameterOptions.WorkingDirectory;
     GlobalMacroList.SubstituteStr(NewWorkingDir);
-    if (NewWorkingDir<>'') and (not DirectoryExistsUTF8(NewWorkingDir)) then begin
+    if (Not FDebugger.IsRemoteDebugger) and
+       (NewWorkingDir<>'') and (not DirectoryExistsUTF8(NewWorkingDir)) then begin
       MessageDlg(lisUnableToRun,
         Format(lisTheWorkingDirectoryDoesNotExistPleaseCheckTheWorki, ['"',
           NewWorkingDir, '"', #13]),
         mtError,[mbCancel],0);
       exit;
     end;
-    if NewWorkingDir='' then begin
+    if (NewWorkingDir='') then begin
       NewWorkingDir:=ExtractFilePath(BuildBoss.GetProjectTargetFilename(Project1));
       if (NewWorkingDir<>'') and (not DirectoryExistsUTF8(NewWorkingDir)) then begin
         MessageDlg(lisUnableToRun,
@@ -2151,8 +2152,9 @@
 
     // The following commands may call ProcessMessages, and FDebugger can be nil after each
 
-    if FDebugger <> nil
-    then FDebugger.WorkingDir:=CleanAndExpandDirectory(NewWorkingDir);
+    if FDebugger <> nil then
+     if (Not FDebugger.IsRemoteDebugger) Then FDebugger.WorkingDir:=CleanAndExpandDirectory(NewWorkingDir)
+                                         Else FDebugger.WorkingDir:=NewWorkingDir;
     // set filename after workingdir
     if FDebugger <> nil
     then FDebugger.FileName := LaunchingApplication;
@@ -2642,12 +2644,10 @@
     Result := TProcessDebugger;
 end;
 
-{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
 function TDebugManager.GetDebugger: TDebugger;
 begin
   Result := FDebugger;
 end;
-{$ENDIF}
 
 function TDebugManager.ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult;
 begin
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 37048)
+++ ide/main.pp	(working copy)
@@ -12185,7 +12185,12 @@
   // Check project build
   ProgramFilename := MainBuildBoss.GetProjectTargetFilename(Project1);
   DebugLn(['TMainIDE.DoInitProjectRun ProgramFilename=',ProgramFilename]);
-  if not FileExistsUTF8(ProgramFilename)
+
+  // Setup debugger
+  if not DebugBoss.InitDebugger then Exit;
+
+  If (Not DebugBoss.Debugger.IsRemoteDebugger) And
+     not FileExistsUTF8(ProgramFilename)
   then begin
     IDEMessageDialog(lisFileNotFound,
       Format(lisNoProgramFileSFound, ['"', ProgramFilename, '"']),
@@ -12193,9 +12198,6 @@
     Exit;
   end;
 
-  // Setup debugger
-  if not DebugBoss.InitDebugger then Exit;
-
   Result := mrOK;
   ToolStatus := itDebugger;
 end;
GDBviaSSH2.patch (8,888 bytes)   

Emelyanov Roman

2012-04-27 17:07

reporter   ~0059047

I upload another version of my patch. Only for files test with use DebuggerClass.IsRemoteDebugger. See GDBviaSSH2.patch.

Martin Friebe

2012-04-29 20:45

manager   ~0059109

I have fixed all the local filename checks in Revision r 37091. Please test.

The code will need some clean up, but in order to be merged to 1.0, the current approach is better (less changes)


I will still look at the "Debugger file name = <ssh>" order of options

Stephano

2012-04-29 22:44

developer   ~0059115

Lazarus compilation is broken now:

function GetCurrentDebuggerClass: TDebuggerClass; override; (* TODO: workaround for http://bugs.freepascal.org/view.php?id=21834 *)

lazarus-svn/ide/debugmanager.pas(159,14) Error: Forward declaration not solved "TDebugManager.GetCurrentDebuggerClass:Class Of TDebugger;"

Ubuntu 11.04 OS

Martin Friebe

2012-04-29 23:15

manager   ~0059116

I have changed the way to specify the remote gdb in r 37094

Use the main file setting to specify the SSH exe only.

- SSH_Startup_Options => for hostname and any options to ssh
- Remote_GDB_Exe => gdb
- Debugger_Startup_Options => any options for gdb or empty

- Append_GDB_to_SSH_opt

if TRUE ssh will be called as
  ssh.exe SSH_Startup_Options Remote_GDB_Exe Debugger_Startup_Options

if FALSE
  ssh.exe SSH_Startup_Options
and then gdb will be called via the ssh console (the gdb command will be sent as input to ssh)
   Remote_GDB_Exe Debugger_Startup_Options


*** Can you please TEST BOTH ? and report if they work for you.


------------
Please note: the ssh debug has some shortcomings.
You can not use the Pause button. The IDE will try to stop a local process, using the PID of the remote process (not ssh, but the remote app in gdb)

Same for breakpoints. You can set them, while you are paused at a breakpoint already. But not while the process is running (the IDE would attempt to pause the process...)

Jadiel Sousa

2012-04-30 00:37

reporter   ~0059121

I'm building from svn and am having the same error.

debugmanager.pas(159,12) Error: Forward declaration not solved "TDebugManager.GetCurrentDebuggerClass:Class Of TDebugger;"
debugmanager.pas(2737) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted


I'm already with the revision 37094 from svn and is still a problem.

Martin Friebe

2012-04-30 00:43

manager   ~0059122

compilation should be fixed in 37097

Emelyanov Roman

2012-05-01 18:07

reporter   ~0059171

Don`t work. When i try to start debug debugger fail in "<-environment-cd "C:/root/">". For remote debugging i must enter in run options app name and app work dir path for remote system. And i do it. I type "/root/", but lazarus expand to "C:/root/". "C:/root/" is incorrect path for linux machine.

Martin Friebe

2012-05-01 19:09

manager   ~0059174

Please try with 37125

Emelyanov Roman

2012-05-01 22:01

reporter   ~0059177

FPC r21160 + Lazarus r37130.

Append_GDB_to_SSH_opt = TRUE: all work fine.
Append_GDB_to_SSH_opt = FALSE: don`t work, look at debugout.zip

2012-05-01 22:01

 

debugout.zip (1,960 bytes)

Martin Friebe

2020-08-15 20:25

manager   ~0124905

Last edited: 2020-08-15 20:51

View 2 revisions

Some updates

1) SshDebugger failed because there is no local exe.
 This has been fixed in the meantime.

2) SshDebugger does not recognize 0000010 as linebreak.
 I added this today in revision 63748

--- EDIT: And reverted => Just found that this was fixed in the past....

Martin Friebe

2020-08-15 21:10

manager   ~0124908

Unfortunately I do not have a test setup at the moment.

Also: With the amount of old discussions here, it gets increasingly hard to identify which note belongs to what topic.
Therefore I would request that for any issues that still needs work, a new separate bug-report is created.
Then this report will be closed, and notes for already fixed parts of the issue will no longer be in the way.
Thanks


-------------------------

The original patch addressed 3 issues:
1) local exe file does not exist, prevents debugger start => fixed
2) line-endings => afaik: fixed
3) finding local files (as remote files have different path names) => some work done? fixed or still broken?

Other than this, there are notes, that appear to address issues unrelated to the original patch?

4) 0021834:0059171 "And i do it. I type "/root/", but lazarus expand to "C:/root/"."

5) Append_GDB_to_SSH_opt = FALSE: don`t work, look at debugout.zip
Is that still needed?
Looking at TSSHGDBMIDebugger.CreateDebugProcess
It seems that the "ssh exe" is in either case called with SshOpt?

6) anything I missed?


Which parts of this issue still need attention?

Issue History

Date Modified Username Field Change
2012-04-22 20:07 Emelyanov Roman New Issue
2012-04-22 20:07 Emelyanov Roman Status new => assigned
2012-04-22 20:07 Emelyanov Roman Assigned To => Marc Weustink
2012-04-22 20:07 Emelyanov Roman File Added: GDBviaSSH.patch
2012-04-23 12:39 Martin Friebe Assigned To Marc Weustink => Martin Friebe
2012-04-23 12:44 Martin Friebe Note Added: 0058922
2012-04-23 12:59 Mattias Gaertner Note Added: 0058925
2012-04-24 18:40 Emelyanov Roman Note Added: 0058948
2012-04-24 23:07 Martin Friebe Note Added: 0058963
2012-04-25 00:56 Emelyanov Roman Note Added: 0058968
2012-04-25 22:04 Martin Friebe Note Added: 0058987
2012-04-27 16:59 Emelyanov Roman Note Added: 0059046
2012-04-27 17:06 Emelyanov Roman File Added: GDBviaSSH2.patch
2012-04-27 17:07 Emelyanov Roman Note Added: 0059047
2012-04-29 20:45 Martin Friebe Note Added: 0059109
2012-04-29 22:44 Stephano Note Added: 0059115
2012-04-29 23:15 Martin Friebe Note Added: 0059116
2012-04-30 00:37 Jadiel Sousa Note Added: 0059121
2012-04-30 00:43 Martin Friebe Note Added: 0059122
2012-05-01 18:07 Emelyanov Roman Note Added: 0059171
2012-05-01 19:09 Martin Friebe Note Added: 0059174
2012-05-01 22:01 Emelyanov Roman Note Added: 0059177
2012-05-01 22:01 Emelyanov Roman File Added: debugout.zip
2020-08-15 20:25 Martin Friebe Note Added: 0124905
2020-08-15 20:51 Martin Friebe Note Edited: 0124905 View Revisions
2020-08-15 21:10 Martin Friebe Status assigned => feedback
2020-08-15 21:10 Martin Friebe LazTarget => -
2020-08-15 21:10 Martin Friebe Note Added: 0124908