Recent

Author Topic: GDB Debugger with ZEOS components - exception 'External: SIGSEGV'  (Read 2410 times)

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Hi, I am trying to debug a class (excerpt below) where I am connecting to an Oracle database with ZEOS DB components.
Please advise on some example that worked for you and what would be the settings for the GDB debugger successfully running inside code using ZEOS components.
The application runs with no exception if not in debugging mode.

Thank you
 
Code: [Select]
unit run_task;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, sql_utils, ZConnection, ZDataset, fpspreadsheet;

type
  Task = class
  private
    {DB Objects}
    ZConnOracle  : TZConnection;
    ZQryOracle  : TZQuery;
    {Utils}
    function SpecialChrFix(const S : string; OldPattern : array of string; NewPattern : string): string;
  public
    function  connectOracle(AUser, APassword, ADatabase : string): boolean;
    procedure runSQL(AQuery : string);
    procedure SpoolResults(AQueryName, AQueryDescription, ATaskID, TheFolder: string);
    function  disconnectOracle(): boolean;
  end;

 const
   OUTPUT_FORMAT  =  sfExcel8;

implementation

 function  Task.connectOracle(AUser, APassword, ADatabase : string): boolean;
 begin
   ZConnOracle          := TZConnection.Create(nil);
   ZConnOracle.Protocol := 'oracle';
   ZConnOracle.ReadOnly := true;

   ZConnOracle.User     := AUser;
   ZConnOracle.Password := APassword;
   ZConnOracle.Database := ADatabase;

   try
    ZConnOracle.Connect;
   finally
     Result := ZConnOracle.Connected;
   end;
 end;

 function  Task.disconnectOracle(): boolean;
 begin
   try
    ZQryOracle.Close;
    ZQryOracle.FreeInstance;
    ZConnOracle.Disconnect;
   finally
     Result := not ZConnOracle.Connected;
     ZConnOracle.FreeInstance;
   end;
 end;

 procedure Task.runSQL(AQuery : string);

  begin
    ZQryOracle := TZQuery.Create(nil);
    ZQryOracle.Connection := ZConnOracle;
    ZQryOracle.ReadOnly:= true;
    ZQryOracle.SQL.Text:= AQuery;
    ZQryOracle.Open;
  end;                                   

(Lazarus 1.2.6 32 bit, Windows 7 64 bit, ZEOS 7.1, GDB 7.6.1)

« Last Edit: October 31, 2014, 02:02:06 am by tudi_x »
Lazarus 2.0.2 64b on Debian LXDE 10

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: GDB Debugger with ZEOS components - exception 'External: SIGSEGV'
« Reply #1 on: November 02, 2014, 03:46:43 am »
As last update I have moved from the main (form) unit all the remaining database (direct) calls and the ZEOS units to other units.
Also doing a CleanupInstance on the release of ZEOS objects.
The debugging now works (on dwarf with sets option), maybe the above helped.

Lazarus 2.0.2 64b on Debian LXDE 10

 

TinyPortal © 2005-2018