Some Bugs:


(SH) #1

IDE: Visual Studio 15
Version: 10.0.0.0.2255
Target Island

Description:

  1. Require Bug
  2. Memory allocation bug
  3. Not such useful Debugger
  4. (3) + Pointer’s content not evaluateable

Expected Behavior:

  1. position should be always the same, as it is written in the parameter
  2. memory allocation should always allocate the same to 100%
  3. Debuuger should be IMO be able to evaluate expressions at runtime, of any kind.
  4. Pointers content should be evaluateable

Actual Behavior:

  1. when the Program reaches any require line, like for example this here:

    method TArray.Write(const position: TIndex; const Value: T);
    require
    0 <= position <= fCount: ‘Out of Bounds’;
    AssignedPtr((f_first + position));

    it suddenly changes the correct “position” to some weird position value

  2. Memory allocation works in as class definition but not as record definition

  3. Debugger, doesnt really evaluate that much.

  4. The content of a pointer is not evaluateable, it prints: “children cannot be evaluated

here the bugged.zip (8.9 MB)

Best regards

Shpend


(SH) #2

Ah yes, the screenshot, sry:


(SH) #3


(Carlo Kok) #4

What does that mean?


(SH) #5

I mean, when I do:

TArray<T> = record  
    //..stuff...
end;

f_first := ^TBlock<T>(malloc(sizeOf(TBlock<T>) * cnt)); //gives always nil back, nvm if I use it from CRUNTIME or from rtl.

when I do this:

 TArray<T> = class
    //..stuff...
end;

    f_first := ^TBlock<T>(malloc(sizeOf(TBlock<T>) * cnt)); //gives a valid pointer back to the allocated memory!

(SH) #6

And could you so far reproduce the bugs I mentioned above?


(Carlo Kok) #7

You mean when tblock is a class Vs struct? Because that makes sense. You can’t cast random pointers to a class.

Haven’t tried yet.


(SH) #8

No no^^, when TArray is class and do this “f_first := ^TBlock(malloc(sizeOf(TBlock) * cnt));” , I get a valid pointer, when I change:TArray to record, I get with the same line, always nil ptr, this should nothing have to do whether I pick class or record as type-definition :open_mouth:

BTW: f_first is a variable of TBlock!


(SH) #9

Sry for the repeat, but could you reproduce this errors, because they seem relatively important, at least the first 2


(Carlo Kok) #10

It’s on my list to look into this issue somewhere this week, but not today or tomorrow.


(Carlo Kok) #11

It’s perfectly fine actually, seems the debugger just gets confused when the exception gets thrown. You never set fCount, so it’s always 0 so always fails.

When I make array a class it still allocates fine:


(SH) #12

Yes you are right, that was my bad, it should be: 0<=position<=f_currenct_capacity

Change it to record, because I said that it works pretty fine with class, but the moment you make Tarray a record, it gives {0} back

And unfortunately, I have to say, that the Debugger isn’t 100% useful, as it should be in this stage, because I really cant watch any of the variables or other expressions, that makes debugging really hard, when I cant inspect the values in the watch-window :confused:


(Carlo Kok) #13

yes i know; we’re looking into the debugger.


(SH) #14

Ok, and did u change the class to record as proposed?


(Carlo Kok) #15

Yes; and it wasn’t really null; there was a bug in try/finally on win32 that I fixed that triggred an exception in the invariants code though.


(SH) #16

On my project I get: f_first : {0} :confused:

when I compile with : TArray = record


(Carlo Kok) #17

Debugger should be a lot better in the next build.


(SH) #18

Thanx!!

I dont want to anoy the shit out of you, but just for summarization-reason, I want to add, that currently, I cant even see any local-variable in the debug-window, so, no watch-window nor localvariable-window.


(Carlo Kok) #19

DEBUG profile right?

Is this in every function or only some? The project attached above?


(SH) #20

What I can currently say is, in my real, handmadehero-project, I cannot see it anywhere

BUT!
In this project, I can see the primitive values in the locals-window, but not in handmadehero :open_mouth:

I send it to you