Visual D return BP

Bert Bert at gmail.com
Sun Aug 11 09:47:30 UTC 2019


if (x)
     return

do()

putting a BP on return will cause the BP to hit jump to do on 
execution no matter the value of x. This is very annoying ;/

I know this has been brought up before and supposedly it is an 
issue with D itself.

Can anything be done about it? It is not sane. No programming 
language I have ever used works this way.

00007FF6BEC8FC6C  cmp         rcx,rax
00007FF6BEC8FC6F  je          foo+48h (07FF6BEC8FC78h)
00007FF6BEC8FC71  pop         rsi
00007FF6BEC8FC72  pop         rbx
00007FF6BEC8FC73  mov         rsp,rbp
00007FF6BEC8FC76  pop         rbp
00007FF6BEC8FC77  ret
				return;
		
			Do();
00007FF6BEC8FC78  mov         rcx,qword ptr [this]
00007FF6BEC8FC7C  sub         rsp,20h
00007FF6BEC8FC80  mov         rax,qword ptr [rcx]
00007FF6BEC8FC83  call        qword ptr [rax+78h]
00007FF6BEC8FC87  add         rsp,20h


There is definitely assembly code that should be able to have a 
BP put at it to make it all work. The way it works, one is forced 
to add junk code simply to get a BP to work correctly in to a 
very common programming semantic.

It seems more like a bug to me, like somehow the BP gets added 
after the return rather than before it.

I'm not sure how it couldn't work, you mentioned something about 
the D language, optimizations, and Walter refusing to allow it to 
work. Surely there is some way to get this to function correctly?

Thanks



More information about the Digitalmars-d-ide mailing list