Debugging strings and arrays in D

May 3, 2012 at 1:57 PM

Hi Christian!

I was trying to use Zero debugging D1 applications again, but the decoding of strings and dynamic arrays does not work as a I expected. E.g. I have a char[] foo; that according to Zero has the type "unsigned long long volatile", and the value read out is accordingly. As far as I can see this apply to all strings and dynamic arrays.


My system is Ubuntu 12.04, 32 bit (yes, yes, old fashioned, I know).

My version of Zero is  1.22.140, built from the latest zip afaict.


Notes on building (FYI, it isn't really important):

 * gtksourceviewmm is 3.0 in Ubuntu 12.04 (but I was able to find 2.0 packages)

 * I haven't looked into why, but for some reason the makefile do/did things in the wrong order, failing to create zero due to missing dependencies (some of the top level libraries). I built those manually first, and everything seems to have worked fine after that.



Lars Ivar Igesund

May 6, 2012 at 2:30 AM

Hi Lars,

I suspect the issue is with the D1 compiler emitting incorrect DWARF symbols -- this can be verified by debugging with gdb (I suppose) and seeing if the data types are shown correctly or not. If you send me a small repro (a small a.out program compiled in debug mode, along with its source code) I can take a look.

I heard that Andrei and Walter intend to deprecate D1 after 2012, so I am not sure how much effort should go into debugging D1 issues. But send me the repro and I will take a quick look anyway ;)

I will also look into the build issue, sounds like there's a bug in computing the dependencies.

Best regards,


May 6, 2012 at 11:32 AM

I can say already now that gdb seems to make the same "mistake", but I wasn't certain of exactly how much D gdb supported.

Yes, I know dmd for D1 will be deprecated, but I won't make the move to D2, so I'm kinda at the mercy of whatever else I find. GDC hasn't been entirely helpful either. Anyway, I don't suggest that you should make big efforts to support a broken dmd, if that is the problem. I'll create an example program and send it to you though.



Lars Ivar

May 6, 2012 at 4:15 PM

I sent the test program to your mail address.

Lars Ivar