trapped debugger :(

 

I defined a struct:

struct TradeStr {
        int Cnt;
        string TrdCat, Symb, Descr, Full, OrdCmt;
};

and in my EA I define a tmp-var of that:

TradeStr tmpStr;

If now the debugger is on its step by step mode comes to that line it jumps at the line of the definition of that struct and seems to to be able to leave it ...

 
gooly:

I defined a struct:

and in my EA I define a tmp-var of that:

If now the debugger is on its step by step mode comes to that line it jumps at the line of the definition of that struct and seems to to be able to leave it ...




I miss your point...where is the problem ?
 

ok, try this:


struct TradeStr {
	int Magic;
	string TrdCat, NwsCur, Symb, Descr, Full, OrdCmt;
};
TradeStr ArrStr[];

struct TradeVal {
	double IniTgt, IniStp, LstTrl, StpLev,  
			 IniTrl,  IniLots, PTS, PIP, BuCheck, SeCheck,
			 BuTrl, SeTrl, BuHigh, SeLow, PrSlipp, TrdRisk,
			 LotStep, MinLot, MaxLot, BaseLot, MaxDD,
			 TckVal, TckSze, PntVal;
	datetime TmeOpn, TmeHi, TmeLo; 
	int Magic, DIG,  Mode, TrdCat, 
		 SeTckt, BuTckt, myIdx, Slipp; // 4 bytes 32 bit
	bool UseMM, UseHiLo, TrdSet; // 1 byte
};
TradeVal ArrVal[];


int OnInit()
//int init()
  {
//---
   int a = 1;
	TradeStr tmpE;
	ArrayResize(ArrVal,100);
	TradeVal tmpA;
	ArrayResize(ArrStr,100);
	TradeStr tmpF;
//---
   return(INIT_SUCCEEDED);
  }

I would expect the debugger-behaviour of ArrayResize(ArrStr,100); to be the same as ArrayResize(ArrVal,100); (1 step of F11).

Gooly

 
The debugger button Shift-F11 "junp out of the function" doesn't work as well as it not a function..
 
gooly:

ok, try this:

I would expect the debugger-behaviour of ArrayResize(ArrStr,100); to be the same as ArrayResize(ArrVal,100); (1 step of F11).

Gooly


Ok I see. The problem is that your struct with a string is automatically assigned a constructor, see documentation :

If a structure contains variables of the string type and/or object of a dynamic array, the compiler assigns an implicit constructor to such a structure. This constructor resets all the structure members of string type and correctly initializes objects of the dynamic array.

So the constructor is called for the 100 elements of your array.

You can use F10 to step over this.

 

I have read the reverence I think too that it this might be the reason - but despite that:

1) the explanation can't explain both: step in like into a user-function but Shift-F11 'steps' out of the user-function where ArrayResize is placed - not just the 'trap'.

2) If you accidentally have missed to step over you are trapped and Shift-F11 puts you where you don't want to be :(

Gooly

 
gooly:

I have read the reverence I think too that it this might be the reason - but despite that:

1) the explanation can't explain both: step in like into a user-function but Shift-F11 'steps' out of the user-function where ArrayResize is placed - not just the 'trap'.

2) If you accidentally have missed to step over you are trapped and Shift-F11 puts you where you don't want to be :(

Gooly

If you are trapped you can place a new breakpoint on the line following the call then press F5.
Reason: