Hi FPC team,
I'm using FPC 3.2.2 as installed with Lazarus 2.2.4.
I'm using the debugserver/dbugintf for some time and implemented some
small changes to improve this duo.
The files are attached.
Changes to debugserver:
- The name of the executable file is fpcdebugserver as this is the name
dbugint uses as default.
- A few small changes to the user interface. The tray icon can be disabled.
Changes dbugintf:
- All Send... procedures converted to functions Send... : Boolean
returning true on success.
- Added a new variable RaiseExceptionOnSendError : Boolean (false by
default) to control error handling.
Is this the right way to handover or shall I follow some other instructions?
BR
Rolf
{
This file is part of the Free Component library.
Copyright (c) 2005 by Michael Van Canneyt, member of
the Free Pascal development team
Debugserver client interface, based on SimpleIPC
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**}
{$mode objfpc}
{$h+}
unit dbugintf;
interface
uses dbugmsg;
Type
TDebugLevel = (dlInformation,dlWarning,dlError);
TErrorLevel = Array[TDebugLevel] of integer;
//Result is true on success. See RaiseExceptionOnSendError.
function SendBoolean(const Identifier: string; const Value: Boolean) :
Boolean;
//Result is true on success. See RaiseExceptionOnSendError.
function SendDateTime (const Identifier: string; const Value: TDateTime) :
Boolean;
//Result is true on success. See RaiseExceptionOnSendError.
function SendInteger(const Identifier: string; const Value: Integer;
HexNotation: Boolean = False) : Boolean;
//Result is true on success. See RaiseExceptionOnSendError.
function SendPointer(const Identifier: string; const Value: Pointer) :
Boolean;
//Result is true on success. See RaiseExceptionOnSendError.
function SendDebugEx(const Msg: string; MType: TDebugLevel) : Boolean;
//Result is true on success. See RaiseExceptionOnSendError.
function SendDebug (const Msg: string) : Boolean;
//Result is true on success. See RaiseExceptionOnSendError.
function SendMethodEnter(const MethodName: string) : Boolean;
//Result is true on success. See RaiseExceptionOnSendError.
function SendMethodExit (const MethodName: string) : Boolean;
//Result is true on success. See RaiseExceptionOnSendError.
function SendSeparator : Boolean;
//Result is true on success. See RaiseExceptionOnSendError.
function SendDebugFmt (const Msg: string; const Args: array of const) :
Boolean;
//Result is true on success. See RaiseExceptionOnSendError.
function SendDebugFmtEx (const Msg: string; const Args: array of const;
MType: TDebugLevel) : Boolean;
procedure SetDebuggingEnabled(const AValue : boolean);
function GetDebuggingEnabled : Boolean;
{ low-level routines }
//Start the debug server and return its ProcessID.
function StartDebugServer(const ADebugServerExe : String = '';
const ARaiseExceptionOnSendError : Boolean = true;
const aLogFilename : String = '') : integer;
//Initialize the debug client and start the server.
function InitDebugClient : Boolean;
//Initialize the debug client and start the server.
function InitDebugClient(const ShowPID: Boolean; const ADebugServerExe : String
= '';
const ARaiseExceptionOnSendError : Boolean = true;
const ServerLogFilename: String = ''): Boolean;
procedure FreeDebugClient;
ResourceString
SProcessID = '%d Process %s (PID=%d)';
SEntering = '> Entering ';
SExiting = '< Exiting ';
SSeparator = '>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<';
SServerStartFailed = 'Failed to start debugserver (%s). (%s)';
Var
DebugServerExe: String = ''; { We can override this global var.
in our compiled IPC client, with DefaultDebugServer a.k.a.
dbugmsg.DebugServerID, or something else }
DefaultDebugServer: String = DebugServerID ; { A "last ressort"
simplier compiled IPC server's name, called in command line by your client
a.k.a. the compiler's target file "-o" }
//Last error message of a Send... function. Not cleared on a new call!
SendError : String = '';
//Raise an exception if a Send... function fails.
//Otherwise the Send... functions will return false without an exception in
case of an error.
RaiseExceptionOnSendError : Boolean = false;
implementation
Uses
SysUtils, classes, process, simpleipc;
Const
DmtInformation = lctInformation;
DmtWarning = lctWarning;
DmtError = lctError;
ErrorLevel : TErrorLevel
= (dmtInformation,dmtWarning,dmtError);
IndentChars= 2;
var