Recent

Author Topic: strange behavior under debug  (Read 10527 times)

angman

  • Jr. Member
  • **
  • Posts: 55
strange behavior under debug
« on: March 16, 2007, 03:06:16 pm »
I have a console application that call some functoin on a c dll.

The application works good out of the ide, but if I execute it in the lazarus ide, it work or depending on a value setted in a record field.

The environment is Debian sarge, lazarus 0.9.18
this is the code:

begin
     errorParams.ErrCode := 0;
     errorParams.errstring := '';
     
     vdscb := 0;
     sample := 0;
     voltage := 0.0;
     

 
   //=========================================================================
   // I. DRIVER INITIALIZATION
   //
   //    Initializes the DSCUD library.
   //
   //=========================================================================
        result := dscInit(DSC_VERSION);
        writeln('Init Status = ' + IntToStr(result));
   if result <> DE_NONE then
    begin
        dscGetLastError(errorParams);
        writeln(format('dscInit error: %s %s', [dscGetErrorString(errorParams.ErrCode), intToStr(errorParams.ErrCode)] ));
      //  exit;
   end;
 
 
        //Board initialization
   writeln('PROM BOARD INITIALIZATION:');

        FillChar(vdsccb, sizeOf(vdsccb), $0);
   vdsccb.base_address := $280;

   vdsccb.int_level := 5; //with values 0-2 works with values > 3 when I call dscInitBoard I get a sigSegv


        DsccbSize := SizeOf(vdsccb);
        DsccbSize := SizeOf(MyDsccb);

   if dscInitBoard(DSC_PROM, vdsccb, vdscb) <> DE_NONE then
//   if dscInitBoard(DSC_PROM, MyDsccb, vdscb) <> DE_NONE then
        begin
        dscGetLastError(errorParams);
        writeln(format('dscInitBoard error: %s %s', [dscGetErrorString(errorParams.ErrCode), errorParams.errstring]));
             exit;
        end;
Some idea on this?

Thanks,  angman :?:

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
RE: strange behavior under debug
« Reply #1 on: March 19, 2007, 01:53:56 pm »
what doesn't work ? what record do you have the values to ?
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

angman

  • Jr. Member
  • **
  • Posts: 55
strange behavior under debug
« Reply #2 on: March 21, 2007, 10:58:02 am »
the record definition is:

     DSCCB = record
          boardtype : BYTE;
          boardnum : DSCB;
          base_address : WORD;
          int_level : BYTE;
          RMM_external_trigger : BOOL;
          RMM_external_trigger_c3 : BOOL;
          EMM_IOAddr : array[0..7] of WORD;
          EMM_Interrupt : array[0..7] of WORD;
          clkfrq0 : BYTE;
          clkfrq1 : BYTE;
          clksel1 : BYTE;
          address_space : WORD;
          clock_freq : LONG;
          dma_level : BYTE;
          int_level1 : BYTE;
          int_level2 : BYTE;
          int_level3 : BYTE;
          fpga : WORD;
          SMM_AD_resolution : BYTE;
          RMM_mode_16bit : BOOL;
          RMM_DAC_0_3_external_enable : BOOL;
          RMM_DAC_4_7_external_enable : BOOL;
       end;

when I set the vdscb.Int_level if set it to values less than 3 works
but with values > 2 calling dscInitBoard I get a sigSegv .
This happen only running in the ide, the console appllcation  launched outside the ide works good.

Thanks, angman

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
strange behavior under debug
« Reply #3 on: March 21, 2007, 02:39:36 pm »
intlevel is some trigger level the card starts to do something ?
Maybe the driver has some problems when it is debugger, or another posibility is that the Segv is handled in the dll, but when debugging it gets triggered there first. What happens if you continue ?
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

angman

  • Jr. Member
  • **
  • Posts: 55
strange behavior under debug
« Reply #4 on: March 23, 2007, 03:54:25 pm »
well, going on I get a dialog that show the address and the procedure name (i think this id in dll) and then going on an other dialog thet says run error(216).

thanks, angman  :roll:

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
strange behavior under debug
« Reply #5 on: March 23, 2007, 05:27:38 pm »
Iv'e no idea what can cause this, Especially since i've no clue what "vdsccb.int_level" has for effects on your library
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

angman

  • Jr. Member
  • **
  • Posts: 55
strange behavior under debug
« Reply #6 on: March 26, 2007, 12:48:10 pm »
Yes, but doo you have some thinking about the fact that the sigsegv happen only using the lazarus ide while running the program outside, all seems work good?

Thanks, angman

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
strange behavior under debug
« Reply #7 on: March 27, 2007, 01:58:25 pm »
A few things: different environment, different loading location, different exception handling
All things which shouldn't affect a normal program, but I don't know how this dll is coded (and I've seen bad ones)
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

angman

  • Jr. Member
  • **
  • Posts: 55
strange behavior under debug
« Reply #8 on: March 27, 2007, 04:53:09 pm »
I am not compleatiy shure but I think that is a c dll.

However, thanks very much for time that you spent to give help.

angman

 

TinyPortal © 2005-2018