How to look into generic tList during Delphi debugging

前端 未结 1 546
不知归路
不知归路 2021-01-19 16:17

I use Delphi 10.3.1 COMMUNITY version and can\'t look into generic tList while I debug the project.

I know the latest version of Delphi doesn\'t support the old-type

相关标签:
1条回答
  • 2021-01-19 16:53

    Usually it should be possible to see the lists contained array over the List property. Internally there is only a field of type Pointer unlike before 10.3 when it was of type TArray<T>.

    This is what I see when I put a breakpoint into the line where it assigns to Caption and put those two entries into my watches:

    Update: It looks like the Linker is responsible for the issue you are experiencing here. When you uncheck the option to "allow side effects and function calls" in the watch

    the watch window will show this:

    I have seen this behavior before when using generics that are only specified in the implementation part of the unit (FWIW when I tried to repro this the first time I did not put the code you posted into a VCL project but into a console dpr and that one does not have an implementation part so I did not see this behavior).

    To force the linker to not to remove the symbol or the debugger to actually see it (because even if I disable inlining to force the GetList method to stay the watch window will tell me that it got removed) you can simply put some dummy type into the interface part of this or any other unit.

    type TDummy = TList<Integer>;
    

    This will cause the debugger to see the symbol and see the values in the watches window.

    0 讨论(0)
提交回复
热议问题