Visual D debugging messed up

Rainer Schuetze r.sagitario at gmx.de
Mon Jun 11 17:50:42 UTC 2018



On 11/06/2018 09:04, DigitalDesigns wrote:
> On Sunday, 3 June 2018 at 07:03:08 UTC, Rainer Schuetze wrote:
>>
>>
>> On 03/06/2018 03:14, DigitalDesigns wrote:
>>> I'd like to make a similar request if you don't mind:
>>>
>>> When using nested functions, only the types local to the function are 
>>> shown in the locals. It would be nice if higher up variables would be 
>>> shown. There is a this pointer but the value is invalid.
>>>
>>> void foo(int x)
>>> {
>>>     int y;
>>>     void bar(int z)
>>>     {
>>>       int c;
>>>     }
>>> }
>>>
>>> When debugging bar all I see is c and z but not x and y. This would 
>>> work for all nested functions which are functions that have a "this 
>>> pointer". foo itself might be nested.
>>>
>>
>> Unfortunately, no debug information is emitted by dmd for the function 
>> closure. LDC works better in that regard.
> 
> Could a stack trace not work? It might require some slueth work but if 
> one can determine that the function was nested then one knows the the 
> caller was the parent function... then backtrack and get the locals of 
> that function. Would be tricky to be able to do it precisely.

Looking at the stack might work in some cases, but the closure can be 
allocated on the heap, too. dmd should just emit that information as LDC 
and GDC do.


More information about the Digitalmars-d-ide mailing list