Blog post about printing associative arrays from GDB

Johannes Riecken johannes.riecken at gmail.com
Thu Oct 24 08:17:09 UTC 2019


On Wednesday, 23 October 2019 at 21:07:24 UTC, Dennis wrote:
> Thanks for spitting through the GDB manual so I don't have to!
> I would've guessed something like this was possible with GDB, 
> but never bothered until now.
>
> On Wednesday, 23 October 2019 at 20:52:55 UTC, Johannes Riecken 
> wrote:
>> is there a Phobos function to automatically print expected and 
>> actual values for failed assertions? In our company we use 
>> ocean's test!("==").
>
> Not a phobos function, a compiler switch. In recent LDC and 
> DMD, you can use -checkaction=context and an attempt is made to 
> print the actual values involved in the assertion. It is still 
> young so you might still encounter bugs or limitations, but it 
> does the job really well for most asserts.

That looks promising. In the version I have installed (dmd 
2.087.0) compilation crashes when using the flag and also 
stdio.writeln, but playing around with the newest version in 
run.dlang.io, it seems to work well with the cases I've tried, 
cool!


More information about the Digitalmars-d-announce mailing list