### TDebugger Usage Example Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md Demonstrates the standard lifecycle of creating and starting the debugger. ```pascal var ADebugger: TDebugger; begin ADebugger := TDebugger.Create; try ADebugger.Start(); finally ADebugger.Free; end; end; ``` -------------------------------- ### TLogManager Usage Example Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Demonstrates how to instantiate TLogManager and register multiple loggers. ```pascal var LogManager: TLogManager; FileLogger: ILogger; ApiLogger: ILogger; begin LogManager := TLogManager.Create; try // Add text file logger FileLogger := TLoggerTextFile.Create('debug.log'); LogManager.AddLogger(FileLogger); // Add API logger ApiLogger := TLoggerAPI.Create; LogManager.AddLogger(ApiLogger); // Both loggers receive all messages LogManager.Log('Debug message'); finally LogManager.Free; end; end; ``` -------------------------------- ### IDebugger Start Method Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md Signature for the Start method used to initiate the debugging process. ```pascal procedure Start() ``` -------------------------------- ### Handle EConfigurationException Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Example of catching the configuration exception during command line parsing. ```pascal try Config.ParseCommandLine; except on E: EConfigurationException do WriteLn('Configuration error: ' + E.Message); end; ``` -------------------------------- ### Start Debugging Process Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Main entry point for the debugger that initiates the coverage collection workflow. ```pascal procedure Start ``` -------------------------------- ### Debugger Execution Flow Example Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md A high-level trace of the debugger lifecycle from initialization to report generation. ```text CodeCoverage -m MyApp.map -e MyApp.exe -u MyUnit -html -od reports 1. TDebugger.Create └─ Create TCoverageConfiguration └─ Create TLogManager with -lt logging └─ Create TBreakPointList └─ Create TCoverageStats tree 2. TDebugger.Start ├─ ParseCommandLine -> finds MyApp.exe, MyApp.map, unit "MyUnit" ├─ StartProcessToDebug │ └─ DebugActiveProcess(MyApp.exe) │ ├─ HandleCreateProcess event │ ├─ Load MyApp.map with TJCLMapScanner │ └─ AddBreakPoints for "MyUnit" │ └─ For each line in MyUnit in .map: │ ├─ TBreakPoint.Create(address) │ ├─ BreakPoint.AddDetails(MyUnit, line#) │ └─ BreakPoint.Activate -> WriteProcessMemory(INT 3) │ ├─ ProcessDebugEvents loop │ └─ For each EXCEPTION_BREAKPOINT: │ ├─ Find BreakPoint in list │ ├─ BreakPoint.IncBreakCount │ ├─ Coverage.AddLineCoverage(line#, 1) │ └─ BreakPoint.Clear(thread) │ ├─ EXIT_PROCESS_DEBUG_EVENT │ └─ Exit debug loop │ ├─ Coverage.Calculate │ └─ Compute aggregates and percentages │ └─ GenerateReport └─ THTMLCoverageReport.Generate └─ Write CodeCoverage_summary.html + MyUnit.html ``` -------------------------------- ### XML Output Structure Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/05-report-generation.md Example of the EMMA-compatible XML format generated by the report. ```xml ``` -------------------------------- ### Parse Delphi Project XML Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Example of the XML structure parsed from .dproj files to extract build configurations and search paths. ```xml true true MyApp.dpr ... ``` -------------------------------- ### Initialize Coverage Configuration with Command Line Provider Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Demonstrates instantiating the provider and passing it to the coverage configuration parser. ```pascal var Provider: IParameterProvider; Config: ICoverageConfiguration; begin Provider := TCommandLineProvider.Create; Config := TCoverageConfiguration.Create(Provider); Config.ParseCommandLine; end; ``` -------------------------------- ### StartProcessToDebug Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Launches the target executable by creating a process and setting initial debugging flags. ```pascal function StartProcessToDebug: Boolean ``` -------------------------------- ### Usage of TModuleNameSpace Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/04-types.md Demonstrates creating a namespace and adding modules to it. ```pascal var NS: TModuleNameSpace; begin NS := TModuleNameSpace.Create('MainApp'); NS.AddModule('MyApp.exe'); NS.AddModule('MyLib.dll'); if NS.HasModule('MyApp.exe') then WriteLn('MyApp.exe is in namespace: ' + NS.Name); end; ``` -------------------------------- ### Jacoco XML Report Structure Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/05-report-generation.md Example structure of the generated Jacoco XML report format. ```xml ``` -------------------------------- ### Environment Variable Expansion Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Demonstrates using Windows batch-style environment variables for file paths and directory parameters. ```text CodeCoverage -m %BUILDDIR%\project.map -e %BUILDDIR%\project.exe -od %OUTDIR% ``` -------------------------------- ### Custom Configuration Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/08-api-reference-summary.md Configuring coverage parameters using a command line provider and validating the configuration state. ```pascal var Config: ICoverageConfiguration; Provider: IParameterProvider; begin Provider := TCommandLineProvider.Create; Config := TCoverageConfiguration.Create(Provider); Config.ParseCommandLine; if Config.IsComplete(Reason) then begin WriteLn('Output dir: ' + Config.OutputDir); WriteLn('Units: ' + Config.Units.DelimitedText); end else WriteLn('Configuration incomplete: ' + Reason); end; ``` -------------------------------- ### HandleCreateProcess Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Initializes the debug session upon process creation, including loading the .map file and setting initial breakpoints. ```pascal procedure HandleCreateProcess(const ADebugEvent: DEBUG_EVENT) ``` -------------------------------- ### Generate Coverage Reports in Pascal Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/05-report-generation.md Demonstrates the conditional instantiation and execution of report generators based on configuration settings. ```pascal var Coverage: ICoverageStats; ModuleList: TModuleList; LogManager: ILogManager; Config: ICoverageConfiguration; Report: IReport; begin { Assume Coverage, ModuleList, Config, LogManager are populated } { Generate HTML } if Config.HtmlOutput then begin Report := THTMLCoverageReport.Create(Config); Report.Generate(Coverage, ModuleList, LogManager); end; { Generate XML } if Config.XmlOutput then begin Report := TXMLCoverageReport.Create(Config); Report.Generate(Coverage, ModuleList, LogManager); end; { Generate EMMA } if Config.EmmaOutput then begin Report := TEmmaCoverageReport.Create(Config); Report.Generate(Coverage, ModuleList, LogManager); end; { Generate Jacoco } if Config.JacocoOutput then begin Report := TJacocoCoverageReport.Create(Config); Report.Generate(Coverage, ModuleList, LogManager); end; end; ``` -------------------------------- ### Implement Mock Parameter Provider Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Uses a mock class to simulate command-line parameter parsing without executing the target process. ```pascal type TMockParameterProvider = class(TInterfacedObject, IParameterProvider) private FParams: TArray; public constructor Create(const AParams: TArray); function Count: Integer; function ParamString(const AIndex: Integer): string; end; var Provider: IParameterProvider; Config: ICoverageConfiguration; begin Provider := TMockParameterProvider.Create(['-m', 'test.map', '-e', 'test.exe', '-u', 'TestUnit']); Config := TCoverageConfiguration.Create(Provider); Config.ParseCommandLine; // Assert Config.MapFileName = 'test.map' end; ``` -------------------------------- ### Initialize Main Program Entry Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/08-api-reference-summary.md The primary entry point for the console application, managing the debugger lifecycle and exception handling. ```pascal program CodeCoverage; {$APPTYPE CONSOLE} uses System.SysUtils, BreakPoint in 'BreakPoint.pas', { ... 50+ units ... } begin try ADebugger := TDebugger.Create; try ADebugger.Start(); finally ADebugger.Free; end; except on E: Exception do WriteLn(E.ClassName, ': ', E.message); end; end. ``` -------------------------------- ### Iterate Breakpoint Details Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/04-types.md Demonstrates accessing breakpoint details via the IBreakPoint interface. ```pascal var BP: IBreakPoint; Detail: TBreakPointDetail; i: Integer; begin for i := 0 to BP.DetailCount - 1 do begin Detail := BP.DetailByIndex(i); WriteLn(Format('%s.%s line %d', [Detail.ModuleName, Detail.UnitName, Detail.Line])); end; end; ``` -------------------------------- ### Expand Environment Variables in Paths Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Demonstrates the recursive expansion of Windows batch-style environment variables within file paths. ```pascal // In TCoverageConfiguration.ExpandEnvString: Input: '%BUILDDIR%\project.map' Output: 'C:\build\project.map' // After expansion ``` -------------------------------- ### Source Paths Configuration File Format Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Specify source directories with one path per line, supporting environment variable expansion. ```text C:\MyProject\Source %BUILDDIR%\Source ..\Common ``` -------------------------------- ### Query Configuration Values Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Methods to retrieve parsed configuration settings such as file paths, directories, and unit lists. ```pascal function ApplicationParameters: string function ExeFileName: string function ExeFileNames: TList function MapFileName: string function MapFileNames: TList function OutputDir: string function SourceDir: string function SourcePaths: TStrings function Units: TStrings function ExcludedUnits: TStrings function ExcludedClassPrefixes: TStrings function DebugLogFile: string function LineCountLimit: Integer function CodePage: Integer ``` -------------------------------- ### HandleLoadDLL Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Handles DLL or BPL loading by checking for associated .map files and adding breakpoints if found. ```pascal procedure HandleLoadDLL(const ADebugEvent: DEBUG_EVENT) ``` -------------------------------- ### Initialize TCoverageConfiguration Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Creates a new configuration object using a parameter provider, typically a TCommandLineProvider. ```pascal constructor TCoverageConfiguration.Create(const AParameterProvider: IParameterProvider) ``` -------------------------------- ### TEmmaFileHelper Utilities Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Utility class providing static methods for reading and writing UTF strings and boolean arrays in the EMMA binary format. ```pascal type TEmmaFileHelper = class public class function GetUtf8Length(const AString: string): Int64 class function GetEntryLength(const AArray: TBooleanArray): Int64 class procedure WriteUTF(Output: IEmmaDataOutput; const AString: string) class procedure WriteBooleanArray(Output: IEmmaDataOutput; const AArray: TBooleanArray) class function ReadUTF(Input: IEmmaDataInput): string class function ReadBooleanArray(Input: IEmmaDataInput): TBooleanArray end; ``` -------------------------------- ### Configure Module Namespace Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Use the -mns flag to group modules under a logical namespace. ```text -mns NamespaceName dll1.dll dll2.exe ``` -------------------------------- ### Coverage Statistics Navigation Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/08-api-reference-summary.md Iterating through coverage reports to retrieve module names and line coverage statistics. ```pascal var Coverage: ICoverageStats; i, j: Integer; begin // Iterate modules for i := 0 to Coverage.Count - 1 do begin WriteLn('Module: ' + Coverage.CoverageReport[i].Name); WriteLn(' Covered: ' + IntToStr(Coverage.CoverageReport[i].CoveredLineCount) + '/' + IntToStr(Coverage.CoverageReport[i].LineCount)); end; end; ``` -------------------------------- ### Usage of TModuleNameSpaceList Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/04-types.md Demonstrates adding a namespace to the list and performing a lookup by module name. ```pascal var NSList: TModuleNameSpaceList; NS: TModuleNameSpace; begin NSList := TModuleNameSpaceList.Create; try NS := TModuleNameSpace.Create('MainApp'); NS.AddModule('MyApp.exe'); NSList.Add(NS); // Look up by module name NS := NSList['MyApp.exe']; if NS <> nil then WriteLn('Found namespace: ' + NS.Name); finally NSList.Free; end; end; ``` -------------------------------- ### Iterate Coverage Statistics Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/04-types.md Demonstrates accessing coverage data through the ICoverageStats interface. ```pascal var Stats: ICoverageStats; Line: TCoverageLine; i: Integer; begin for i := 0 to Stats.GetCoverageLineCount - 1 do begin Line := Stats.GetCoverageLine(i); if Line.IsCovered then WriteLn(Format('Line %d executed %d times', [Line.LineNumber, Line.LineCount])); end; end; ``` -------------------------------- ### Manage String List Lifecycle Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Ensures proper memory cleanup for configuration string lists using a try-finally block. ```pascal FUnitsStrLst := TStringList.Create; try // Add units finally FUnitsStrLst.Free; // All strings freed end; ``` -------------------------------- ### SonarQube Configuration Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/05-report-generation.md Define the source directory and coverage report path in SonarQube properties. ```xml src CodeCoverage_summary.xml ``` -------------------------------- ### Retrieve Namespace Configuration Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Fetches namespace configuration for a specific module or unit. Returns nil if not configured. ```pascal function ModuleNameSpace(const AModuleName: string): TModuleNameSpace function UnitNameSpace(const AModuleName: string): TUnitNameSpace ``` -------------------------------- ### Define IParameterProvider and TCommandLineProvider Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/08-api-reference-summary.md Interface for accessing application parameters and a command-line implementation. ```pascal EParameterIndexException = class(Exception); IParameterProvider = interface function Count: Integer; function ParamString(const AIndex: Integer): string; end; TCommandLineProvider = class(TInterfacedObject, IParameterProvider) constructor Create; { ... interface implementation ... } end; ``` -------------------------------- ### Generate Basic Coverage Report Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/README.md Executes a coverage analysis using a map file, executable, and specific unit, outputting the results in HTML format to a designated directory. ```bash CodeCoverage -m MyApp.map -e MyApp.exe -u MyUnit -html -od reports ``` -------------------------------- ### Define Configuration Parameters Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/08-api-reference-summary.md Constants representing command-line configuration parameters and default settings for DelphiCodeCoverage. ```pascal cESCAPE_CHARACTER = '^' cDEFULT_DEBUG_LOG_FILENAME = 'Delphi-Code-Coverage-Debug.log' cIGNORE_UNIT_PREFIX = '!' cPARAMETER_VERBOSE = '-v' cPARAMETER_EXECUTABLE = '-e' cPARAMETER_MAP_FILE = '-m' cPARAMETER_UNIT = '-u' cPARAMETER_EXCLUDE_CLASS_PREFIX = '-ecp' cPARAMETER_UNIT_FILE = '-uf' cPARAMETER_SOURCE_DIRECTORY = '-sd' cPARAMETER_SOURCE_PATHS = '-sp' cPARAMETER_SOURCE_PATHS_FILE = '-spf' cPARAMETER_OUTPUT_DIRECTORY = '-od' cPARAMETER_EXECUTABLE_PARAMETER = '-a' cPARAMETER_LOGGING_TEXT = '-lt' cPARAMETER_LOGGING_WINAPI = '-lapi' cPARAMETER_FILE_EXTENSION_INCLUDE = '-ife' cPARAMETER_FILE_EXTENSION_EXCLUDE = '-efe' cPARAMETER_EMMA_OUTPUT = '-emma' cPARAMETER_EMMA21_OUTPUT = '-emma21' cPARAMETER_EMMA_SEPARATE_META = '-meta' cPARAMETER_XML_OUTPUT = '-xml' cPARAMETER_XML_LINES = '-xmllines' cPARAMETER_XML_LINES_MERGE_GENERICS = '-xmlgenerics' cPARAMETER_HTML_OUTPUT = '-html' cPARAMETER_DPROJ = '-dproj' cPARAMETER_DGROUPPROJ = '-dgroupproj' cPARAMETER_EXCLUDE_SOURCE_MASK = '-esm' cPARAMETER_INCLUDE_SOURCE_MASK = '-ism' cPARAMETER_MODULE_NAMESPACE = '-mns' cPARAMETER_UNIT_NAMESPACE = '-uns' cPARAMETER_TESTEXE_EXIT_CODE = '-tec' cPARAMETER_USE_TESTEXE_WORKING_DIR = '-twd' cPARAMETER_LINE_COUNT = '-lcl' cPARAMETER_CODE_PAGE = '-cp' cPARAMETER_JACOCO = '-jacoco' ``` -------------------------------- ### Configure Unit Namespace Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Use the -uns flag to group specific units within a module under a namespace. ```text -uns dll_or_exe UnitName1 UnitName2 ``` -------------------------------- ### Navigate Coverage Hierarchy Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md Methods for traversing the coverage tree structure. ```pascal function Parent: ICoverageStats // Parent node (nil for root) function Count: Integer // Number of child nodes function GetCoverageReportByIndex(const AIndex: Integer): ICoverageStats function GetCoverageReportByName(const AName: string): ICoverageStats ``` -------------------------------- ### Define IParameterProvider Interface Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Defines the interface for accessing command-line parameters with index-based retrieval. ```pascal type EParameterIndexException = class(Exception); type IParameterProvider = interface function Count: Integer function ParamString(const AIndex: Integer): string end; ``` -------------------------------- ### TDebugModule Constructor Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Initializes a wrapper for a loaded module using the module name, base address, size, and map scanner. ```pascal constructor TDebugModule.Create( const AModuleName: string; const ABase: HMODULE; const ASize: Cardinal; const AMapScanner: TJCLMapScanner) ``` -------------------------------- ### Check Output Format Flags Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Returns true if the specific output format was requested via command-line flags. ```pascal function HtmlOutput: Boolean function XmlOutput: Boolean function XmlLines: Boolean function XmlMergeGenerics: Boolean function EmmaOutput: Boolean function EmmaOutput21: Boolean function JacocoOutput: Boolean function SeparateMeta: Boolean function TestExeExitCode: Boolean function UseTestExePathAsWorkingDir: Boolean function UseApiDebug: Boolean ``` -------------------------------- ### View Output Directory Structure Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/05-report-generation.md Displays the expected file hierarchy generated after running all coverage report options. ```text output/ ├─ CodeCoverage_summary.html (main HTML report) ├─ CodeCoverage_summary.xml (XML report) ├─ jacoco.xml (Jacoco report) ├─ coverage.es (EMMA combined, or .em/.ec if -meta) │ (or coverage.em and coverage.ec) ├─ MyModule.html (module-level report) ├─ MyModule.MyClass.html (class-level report with source) ├─ MyModule2.html └─ ... ``` -------------------------------- ### Define EConfigurationException class Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Custom exception class definition for invalid configuration scenarios. ```pascal type EConfigurationException = class(Exception) end; ``` -------------------------------- ### Validate Configuration Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Checks if all required parameters are set. Returns false and provides a reason if validation fails. ```pascal function IsComplete(var AReason: string): Boolean ``` -------------------------------- ### DPROJ Project File Format Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Standard XML structure used by the parser to extract search paths, output directories, and build configurations. ```xml .\Win32\Debug .\Win32\Debug Source;Lib;$(SearchPath) ``` -------------------------------- ### IDebugProcess Module Management Methods Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md Methods for tracking loaded modules, where GetModule searches by name. ```pascal procedure AddModule(const AModule: IDebugModule) procedure RemoveModule(const AModule: IDebugModule) function GetModule(const AName: string): IDebugModule ``` -------------------------------- ### TDebugModule Methods Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Accessors for module metadata including name, base address, size, and map scanner. ```pascal function Name: string function Base: HMODULE function Size: Cardinal function MapScanner: TJCLMapScanner ``` -------------------------------- ### IBreakPointList Methods Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md Individual method signatures for the IBreakPointList interface. ```pascal function Count: Integer // Number of breakpoints function BreakPoint(const AIndex: Integer): IBreakPoint // Get by index procedure Add(const ABreakPoint: IBreakPoint) // Add a breakpoint ``` -------------------------------- ### HandleCreateThread and HandleExitThread Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Manages thread lifecycle events for context tracking. ```pascal procedure HandleCreateThread(const ADebugEvent: DEBUG_EVENT) procedure HandleExitThread(const ADebugEvent: DEBUG_EVENT) ``` -------------------------------- ### Configuration Validation Pattern Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Validates configuration completeness before execution to prevent runtime errors. ```pascal if not Config.IsComplete(Reason) then begin WriteLn('Configuration incomplete: ' + Reason); // Reason: "Executable filename not specified" Exit; end; ``` -------------------------------- ### Breakpoint Activation Methods Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md Methods for toggling the breakpoint instruction at the target address. ```pascal function Activate: Boolean ``` ```pascal function DeActivate: Boolean ``` ```pascal function IsActive: Boolean ``` -------------------------------- ### HTML Report Generation Logic Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md High-level procedural steps for generating HTML coverage reports from source modules. ```pascal 1. For each module: - Open source file (using configured encoding/code page) - Iterate over lines - For each line: * Check if covered (BreakPoint.IsCovered) * Apply CSS class (green=covered, red=uncovered, neutral=no code) * Generate HTML row with line number and source 2. Generate summary page - Table of modules with coverage percentages - Hyperlinks to module reports ``` -------------------------------- ### IDebugProcess Lookup Methods Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md Methods for retrieving process handles and finding modules by memory address. ```pascal function Handle: THandle function FindDebugModuleFromAddress(Addr: Pointer): IDebugModule ``` -------------------------------- ### Access Coverage Statistics Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md Methods to retrieve line execution counts and percentages. ```pascal function CoveredLineCount: Integer // Lines that were executed function LineCount: Integer // Total lines with code function PercentCovered: Integer // 0-100; integer percentage ``` -------------------------------- ### Module Management Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Methods for tracking loaded modules and resolving addresses to specific modules. ```pascal procedure AddModule(const AModule: IDebugModule) procedure RemoveModule(const AModule: IDebugModule) function GetModule(const AName: string): IDebugModule function FindDebugModuleFromAddress(Addr: Pointer): IDebugModule ``` -------------------------------- ### Parse Command-Line Parameters Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Parses command-line arguments. Providing an ILogManager enables verbose logging. ```pascal procedure ParseCommandLine(const ALogManager: ILogManager = nil) ``` -------------------------------- ### Initialize TXMLCoverageReport Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/05-report-generation.md Constructor for the TXMLCoverageReport class requiring a coverage configuration interface. ```pascal constructor TXMLCoverageReport.Create(const ACoverageConfiguration: ICoverageConfiguration) ``` -------------------------------- ### TBreakPoint Lifecycle Operations Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Individual steps for creating, registering, activating, handling, and deactivating breakpoints. ```pascal BreakPoint := TBreakPoint.Create(FDebugProcess, Address, Module, FLogManager) ``` ```pascal BreakPoint.AddDetails(ModuleName, UnitName, LineNumber) ``` ```pascal BreakPoint.Activate // Writes INT 3 at address ``` ```pascal Windows generates EXCEPTION_BREAKPOINT when target hits INT 3 ``` ```pascal BreakPoint.IncBreakCount Coverage.AddLineCoverage(LineNumber, 1) BreakPoint.Clear(Thread) // Restore opcode and step over ``` ```pascal BreakPoint.DeActivate // Restores original instruction ``` -------------------------------- ### EMMA Output with Multiple Executables Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Generates EMMA format reports when working with multiple map files and executables. ```text CodeCoverage -m app.map -e app.exe -m lib.map -u LibUnit -emma -od reports ``` -------------------------------- ### Address Conversion Helper Functions Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Functions for converting between virtual addresses and module-relative offsets. ```pascal function AddressFromVA(const AVA: DWORD; const AModule: HMODULE): Pointer function VAFromAddress(const AAddr: Pointer; const AModule: HMODULE): DWORD ``` -------------------------------- ### Manage Interface Reference Counting Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Demonstrates automatic reference counting for interface variables, eliminating the need for explicit Free calls. ```pascal var Logger: ILogger; begin Logger := TLoggerTextFile.Create('log.txt'); // RefCount = 1 LogManager.AddLogger(Logger); // RefCount = 2 // Logger scope ends, RefCount = 1 (LogManager holds reference) // When LogManager freed, RefCount = 0, TLoggerTextFile freed end; ``` -------------------------------- ### Define TUnitNameSpaceList class Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/04-types.md Defines a collection class for managing unit namespaces. ```pascal type TUnitNameSpaceList = class public property Items[const AName: string]: TUnitNameSpace read GetUnitNameSpace; default; constructor Create; destructor Destroy; override; procedure Add(const AUnitNameSpace: TUnitNameSpace); end; ``` -------------------------------- ### Access Line-Level Details Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md Methods to retrieve specific line coverage data. ```pascal function GetCoverageLineCount: Integer function GetCoverageLine(const AIndex: Integer): TCoverageLine ``` -------------------------------- ### Manual EMMA Report Merging Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/05-report-generation.md Merge multiple EMMA coverage files and generate a combined HTML report using the command line. ```bash java -cp emma.jar emmarun -merge=true run1.es run2.es -out merged.es java -cp emma.jar emmarun report merged.es -r html -Dreport.html.out.file=merged.html ``` -------------------------------- ### Define IReport and Coverage Implementations Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/08-api-reference-summary.md Interface for generating coverage reports and various format-specific implementations. ```pascal IReport = interface procedure Generate(const ACoverage: ICoverageStats; const AModuleInfoList: TModuleList; const ALogManager: ILogManager); end; // Implementations: TXMLCoverageReport = class(TInterfacedObject, IReport) constructor Create(const ACoverageConfiguration: ICoverageConfiguration); { ... interface implementation ... } end; THTMLCoverageReport = class(TInterfacedObject, IReport) constructor Create(const ACoverageConfiguration: ICoverageConfiguration); { ... interface implementation ... } end; TEmmaCoverageReport = class(TInterfacedObject, IReport) constructor Create(const ACoverageConfiguration: ICoverageConfiguration); { ... interface implementation ... } end; TJacocoCoverageReport = class(TInterfacedObject, IReport) constructor Create(const ACoverageConfiguration: ICoverageConfiguration); { ... interface implementation ... } end; ``` -------------------------------- ### Minimal Coverage Collection Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/08-api-reference-summary.md Basic pattern for initializing the debugger and executing the coverage collection process. ```pascal var Debugger: TDebugger; begin Debugger := TDebugger.Create; try Debugger.Start; // Parses args, runs target, generates reports finally Debugger.Free; end; end; ``` -------------------------------- ### TDebugProcess Constructor Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Initializes a new instance of the TDebugProcess class with process handles, identifiers, and management interfaces. ```pascal constructor TDebugProcess.Create( const AProcessHandle: THandle; const AProcessId: DWORD; const AModuleName: string; const AModuleBase: HMODULE; const AModuleSize: Cardinal; const AMapScanner: TJCLMapScanner; const ALogManager: ILogManager) ``` -------------------------------- ### Initialize THTMLCoverageReport Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/05-report-generation.md Constructor for the HTML report generator, requiring configuration for output paths and formatting. ```pascal constructor THTMLCoverageReport.Create(const ACoverageConfiguration: ICoverageConfiguration) ``` -------------------------------- ### Define ICoverageConfiguration Interface Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/08-api-reference-summary.md Interface for managing application parameters, file paths, and output settings for coverage analysis. ```pascal ICoverageConfiguration = interface procedure ParseCommandLine(const ALogManager: ILogManager = nil); function ApplicationParameters: string; function ExeFileName: string; function ExeFileNames: TList; function MapFileName: string; function MapFileNames: TList; function OutputDir: string; function SourceDir: string; function SourcePaths: TStrings; function Units: TStrings; function ExcludedUnits: TStrings; function ExcludedClassPrefixes: TStrings; function DebugLogFile: string; function UseApiDebug: Boolean; function IsComplete(var AReason: string): Boolean; function EmmaOutput: Boolean; function EmmaOutput21: Boolean; function JacocoOutput: Boolean; function SeparateMeta: Boolean; function XmlOutput: Boolean; function XmlLines: Boolean; function XmlMergeGenerics: Boolean; function HtmlOutput: Boolean; function TestExeExitCode: Boolean; function UseTestExePathAsWorkingDir: Boolean; function ModuleNameSpace(const AModuleName: string): TModuleNameSpace; function UnitNameSpace(const AModuleName: string): TUnitNameSpace; function LineCountLimit: Integer; function CodePage: Integer; end; TCoverageConfiguration = class(TInterfacedObject, ICoverageConfiguration) constructor Create(const AParameterProvider: IParameterProvider); { ... interface implementation ... } end; EConfigurationException = class(Exception); ``` -------------------------------- ### Source File Reading Pattern Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Reads entire source files into memory for processing; consider streaming for files exceeding 10MB. ```pascal InputFile := TTextFile.Create(SourceFileName); try while not InputFile.EOF do Line := InputFile.ReadLine; finally InputFile.Free; end; ``` -------------------------------- ### Module Namespace Lookup Definition Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Dictionary-based lookup for module namespaces providing O(1) average time complexity. ```pascal FNameSpaceList: TDictionary; ``` -------------------------------- ### Source Directories and XML Reporting Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Generates XML coverage reports including source directories and unit file lists. ```text CodeCoverage -m app.map -e app.exe -sp Source Lib -uf units.txt -xml -xmllines -od output ``` -------------------------------- ### TBreakPoint Implementation Class Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md The concrete implementation of the IBreakPoint interface. ```pascal type TBreakPoint = class(TInterfacedObject, IBreakPoint) public constructor Create(const ADebugProcess: IDebugProcess; const AAddress: Pointer; const AModule: IDebugModule; const ALogManager: ILogManager); { ... interface methods ... } end; ``` -------------------------------- ### Test Coverage Statistics Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Verifies coverage calculation logic by building a mock statistics tree and asserting expected results. ```pascal var RootStats: ICoverageStats; ModuleStats: ICoverageStats; begin RootStats := TCoverageStats.Create('Root', nil); ModuleStats := TCoverageStats.Create('Module1', RootStats); ModuleStats.AddLineCoverage(10, 5); // Line 10, hit 5 times ModuleStats.AddLineCoverage(11, 0); // Line 11, not hit ModuleStats.Calculate; Assert.AreEqual(1, ModuleStats.CoveredLineCount); Assert.AreEqual(2, ModuleStats.LineCount); Assert.AreEqual(50, ModuleStats.PercentCovered); end; ``` -------------------------------- ### HandleUnLoadDLL, HandleOutputDebugString, and HandleRip Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Handles miscellaneous debug events including DLL unloading, debug output strings, and RIP notifications. ```pascal procedure HandleUnLoadDLL(const ADebugEvent: DEBUG_EVENT) procedure HandleOutputDebugString(const ADebugEvent: DEBUG_EVENT) procedure HandleRip(const ADebugEvent: DEBUG_EVENT) ``` -------------------------------- ### Generate XML with JclSimpleXml Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Defines the classes for lightweight XML document creation and file saving. ```pascal type TJclSimpleXMLElem = class public property Name: string read GetName property Items: TJclSimpleXMLElementList read GetItems property Properties: TJclSimpleXMLProps read GetProperties procedure Add(const AName: string): TJclSimpleXMLElem end; type TJclSimpleXML = class public property Root: TJclSimpleXMLElem read GetRoot procedure SaveToFile(const AFileName: string) end; ``` -------------------------------- ### Define IBreakPoint Interface Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/08-api-reference-summary.md Interface for managing individual breakpoints, including activation state and detail tracking. ```pascal TBreakPointDetail = record ModuleName: string; UnitName: string; Line: Integer; end; IBreakPoint = interface procedure Clear(const AThread: IDebugThread); function Activate: Boolean; function DeActivate: Boolean; function BreakCount: integer; procedure IncBreakCount; function Address: Pointer; function Module: IDebugModule; function DetailCount: Integer; function DetailByIndex(const AIndex: Integer): TBreakPointDetail; procedure AddDetails(const AModuleName: string; const AUnitName: string; const ALineNumber: Integer); function IsActive: Boolean; function GetCovered: Boolean; property IsCovered: Boolean read GetCovered; end; TBreakPoint = class(TInterfacedObject, IBreakPoint) constructor Create(const ADebugProcess: IDebugProcess; const AAddress: Pointer; const AModule: IDebugModule; const ALogManager: ILogManager); { ... interface implementation ... } end; ``` -------------------------------- ### IBreakPoint Interface Definition Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md The core interface defining methods for breakpoint activation, execution tracking, and location management. ```pascal type IBreakPoint = interface // Activation/Deactivation function Activate: Boolean; function DeActivate: Boolean; function IsActive: Boolean; // Execution tracking function BreakCount: Integer; procedure IncBreakCount; // Runtime management procedure Clear(const AThread: IDebugThread); // Location information function Address: Pointer; function Module: IDebugModule; // Source location details function DetailCount: Integer; function DetailByIndex(const AIndex: Integer): TBreakPointDetail; procedure AddDetails(const AModuleName: string; const AUnitName: string; const ALineNumber: Integer); // Coverage state function GetCovered: Boolean; property IsCovered: Boolean read GetCovered; end; ``` -------------------------------- ### Define TCommandLineProvider Class Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Implementation of IParameterProvider that wraps standard Delphi ParamStr and ParamCount functions. ```pascal type TCommandLineProvider = class(TInterfacedObject, IParameterProvider) public constructor Create; function Count: Integer function ParamString(const AIndex: Integer): string end; ``` -------------------------------- ### Merge EMMA Coverage Files Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/05-report-generation.md Command-line usage for merging multiple EMMA coverage files using the Java EMMA tool. ```bash java -cp emma.jar emmarun -merge=true file1.es file2.es -out merged.es ``` -------------------------------- ### Configuration Constants Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Constants defined in I_CoverageConfiguration.pas for parameter handling and unit exclusion. ```pascal cESCAPE_CHARACTER = '^' // Escape char for app parameters cDEFULT_DEBUG_LOG_FILENAME = 'Delphi-Code-Coverage-Debug.log' cIGNORE_UNIT_PREFIX = '!' // Prefix unit with ! in -uf file to exclude ``` -------------------------------- ### EMMA Data I/O Interfaces Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Interfaces defining the contract for reading and writing EMMA binary data files (.es, .em, .ec). ```pascal type IEmmaDataInput = interface function ReadInteger: Integer function ReadInt64: Int64 function ReadUTF: string function ReadBooleanArray: TBooleanArray end; type IEmmaDataOutput = interface procedure WriteInteger(Value: Integer) procedure WriteInt64(Value: Int64) procedure WriteUTF(const Value: string) procedure WriteBooleanArray(const Value: TBooleanArray) end; ``` -------------------------------- ### Units Configuration File Format Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Define units to include or exclude by listing one unit per line, using the '!' prefix for exclusions. ```text MyUnit OtherUnit !ExcludedUnit ``` -------------------------------- ### Basic HTML Report Generation Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Generates a basic HTML coverage report for specified map, executable, and units. ```text CodeCoverage -m TestApp.map -e TestApp.exe -u TestUnit TestUnit2 -html -od reports ``` -------------------------------- ### Delphi Project File Parsing Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/02-configuration.md Parses a .dproj file directly to generate coverage reports. ```text CodeCoverage -dproj MyProject.dproj -u MyUnit -html -od coverage ``` -------------------------------- ### Convert between Virtual and Runtime Addresses Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/09-implementation-notes.md Functions to translate between MAP file offsets and actual process memory addresses, accounting for module base addresses. ```pascal function AddressFromVA(const AVA: DWORD; const AModule: HMODULE): Pointer; begin Result := Pointer(AVA + Cardinal(AModule)); end; function VAFromAddress(const AAddr: Pointer; const AModule: HMODULE): DWORD; begin Result := Cardinal(AAddr) - Cardinal(AModule); end; ``` -------------------------------- ### Breakpoint Location Details Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md Methods for managing multiple source locations associated with a single breakpoint. ```pascal procedure AddDetails(const AModuleName: string; const AUnitName: string; const ALineNumber: Integer) function DetailCount: Integer function DetailByIndex(const AIndex: Integer): TBreakPointDetail ``` -------------------------------- ### Define Logging Interfaces and Classes Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/08-api-reference-summary.md Interfaces for logging messages and managing multiple loggers, with file and API-based implementations. ```pascal ILogger = interface procedure Log(const AMessage: string); end; ILogManager = interface procedure Log(const AMessage: string); procedure AddLogger(const ALogger: ILogger); end; function LastErrorInfo: string; // Returns formatted Windows error TLogManager = class(TInterfacedObject, ILogManager) constructor Create; { ... interface implementation ... } end; TLoggerTextFile = class(TInterfacedObject, ILogger) constructor Create(const AFileName: string); { ... interface implementation ... } end; TLoggerAPI = class(TInterfacedObject, ILogger) constructor Create; { ... interface implementation ... } end; ``` -------------------------------- ### Namespace Type Definitions Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/08-api-reference-summary.md Defines classes for managing module and unit namespaces and their associated lists. ```pascal TModuleNameSpace = class property Name: string; property Modules: TStringList; property Count: Integer; constructor Create(const AName: string); destructor Destroy; override; procedure AddModule(const AModuleName: string); function HasModule(const AModuleName: string): Boolean; end; TModuleNameSpaceList = class property Items[const AModuleName: string]: TModuleNameSpace default; constructor Create; destructor Destroy; override; procedure Add(const AModuleNameSpace: TModuleNameSpace); end; TUnitNameSpace = class property ModuleName: string; property Count: Integer; constructor Create(const AModuleName: string); destructor Destroy; override; procedure AddUnit(const AUnitName: string); function HasUnit(const AUnitName: string): Boolean; end; TUnitNameSpaceList = class property Items[const AName: string]: TUnitNameSpace default; constructor Create; destructor Destroy; override; procedure Add(const AUnitNameSpace: TUnitNameSpace); end; ``` -------------------------------- ### Windows API Wrapper Declarations Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Lists core Windows API functions used for debugging, thread management, memory operations, and process enumeration. ```pascal // Debug events WaitForDebugEvent() ContinueDebugEvent() DebugActiveProcess() // Thread context GetThreadContext() SetThreadContext() // Memory operations ReadProcessMemory() WriteProcessMemory() FlushInstructionCache() // Process/Module enumeration EnumProcessModules() GetModuleBaseName() // Error reporting GetLastError() FormatMessage() ``` -------------------------------- ### Define TTextWriter and TTextReader Classes Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Abstractions for handling text I/O operations, used for report generation and source file reading. ```pascal type TTextWriter = class public procedure WriteLine(const ALine: string); procedure Write(const AText: string); end; type TTextReader = class public function ReadLine: string; function ReadAllText: string; end; ``` -------------------------------- ### TDebugThread Constructor Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/06-debugger-execution.md Initializes a thread wrapper with a Windows thread handle and ID. ```pascal constructor TDebugThread.Create( const AThreadHandle: THandle; const AThreadId: DWORD) ``` -------------------------------- ### ICoverageConfiguration Interface Definition Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md Defines the interface for managing configuration settings parsed from command-line parameters. ```pascal type ICoverageConfiguration = interface procedure ParseCommandLine(const ALogManager: ILogManager = nil); function ApplicationParameters: string; function ExeFileName: string; function ExeFileNames: TList; function MapFileName: string; function MapFileNames: TList; function OutputDir: string; function SourceDir: string; function SourcePaths: TStrings; function Units: TStrings; function ExcludedUnits: TStrings; function ExcludedClassPrefixes: TStrings; function DebugLogFile: string; function UseApiDebug: Boolean; function IsComplete(var AReason: string): Boolean; function EmmaOutput: Boolean; function EmmaOutput21: Boolean; function JacocoOutput: Boolean; function SeparateMeta: Boolean; function XmlOutput: Boolean; function XmlLines: Boolean; function XmlMergeGenerics: Boolean; function HtmlOutput: Boolean; function TestExeExitCode: Boolean; function UseTestExePathAsWorkingDir: Boolean; function ModuleNameSpace(const AModuleName: string): TModuleNameSpace; function UnitNameSpace(const AModuleName: string): TUnitNameSpace; function LineCountLimit: Integer; function CodePage: Integer; end; ``` -------------------------------- ### Define TJclFileUtils class Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/07-utilities-and-helpers.md Utility class for file system operations including environment variable expansion and existence checks. ```pascal TJclFileUtils = class public class function FileExists(const AFileName: string): Boolean class function DirectoryExists(const ADirectory: string): Boolean class function ExpandEnvironmentString(const AString: string): string { ... path manipulation, file operations ... } end; ``` -------------------------------- ### Define TUnitNameSpace class Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/04-types.md Defines the structure for grouping units within a specific module. ```pascal type TUnitNameSpace = class private FModuleName: string; FUnits: TStringList; function GetCount: Integer; public property ModuleName: string read FModuleName; property Count: Integer read GetCount; constructor Create(const AModuleName: string); destructor Destroy; override; procedure AddUnit(const AUnitName: string); function HasUnit(const AUnitName: string): Boolean; end; ``` -------------------------------- ### IReport.Generate Source: https://github.com/delphicodecoverage/delphicodecoverage/blob/master/_autodocs/03-core-interfaces.md The Generate method is the primary entry point for creating coverage reports. It processes coverage statistics and module information to produce a report. ```APIDOC ## procedure Generate(const ACoverage: ICoverageStats; const AModuleInfoList: TModuleList; const ALogManager: ILogManager) ### Description Generates a coverage report based on the provided statistics and module information. ### Parameters - **ACoverage** (ICoverageStats) - Required - Root of coverage statistics tree - **AModuleInfoList** (TModuleList) - Required - Hierarchical module, class, method, and line information - **ALogManager** (ILogManager) - Required - Logger for report generation events ### Implementations - TXMLCoverageReport - THTMLCoverageReport - TEmmaCoverageReport - TJacocoCoverageReport ```