I'm currently trying out some debugger code outside the IDE (will be added as a package later), and have problems with reaching certain code.
Situation: a FPCUnit console runner program. If I try to go through the whole program in the IDE pressing F7, I cannot reach my test code (probably because it's called from the test suite, which is in a package, which has no debugging information). If I set a break point within my test methods, I can reach them.
Experienced:
1. using a self created instance of TGDBMIDebugger, I can stepinto the whole program as well, but would not reach my test methods (as above with Lazarus itself).
2. using gdb on the console, I can set breakpoints on the test methods, and this way, gdb will step into this code.
3. using a self created instance of TGDBMIDebugger, the breakpoints I set are not working.
Expected:
Breakpoints to break execution, even if stepinto would otherwise skip it. I log the OnCurrent event to see which lines are reached, and those of the test methods are not. OnBreakpointHit is not triggered either.
Some very simple code:
procedure TCodeCoverageDebugger.Go(AFilename: string);
var
i: integer;
begin
FDebugger.Free;
FDebugger := CreateDebugger;
FLineProtocol.Clear;
FDebugger.BreakPoints.Add('c:\Development\Projects\CodingTools\laz-codecoverage-helper\source\CodeCoverage.GDB.TestCase.pas', 65);
FDebugger.BreakPoints.Add('c:\Development\Projects\CodingTools\laz-codecoverage-helper\source\CodeCoverage.GDB.TestCase.pas', i);
FDebugger.BreakPoints.Add('TCODECOVERAGEGDBTESTCASE__TESTLISTALLUNITFILENAMES');
FDebugger.Init;
try
FDebugger.FileName := AFilename;
FDebugger.WorkingDir := ExtractFilePath(AFilename);
repeat
FDebugger.StepInto;
until (FDebugger.State in [dsStop]);
finally
FDebugger.Done;
end;
end;
This is the debugger unit from which the above code is from, the TestDebugger project with the TestDebuggerForm form unit is there as well.
(it uses a slightly modified version of GDBMIDebugger.pas, where I added support for breakpoints by name, but only because the line based approach did not work before)
Has anyone enough direct experience with the debugger to see what I'm missing?