Last update November 13, 2012

D Tutorial /
Bug Reports

Firstly, it should be mentioned that Digital Mars has an official statement on Bug Reports. Read it; believe it. Once you've followed the directions here, the appropriate place to submit bug reports is D Issue Tracking System.

You can also use desktop version of Bugzilla called Deskzilla Lite (see the Download page). After installing, set up a new bugzilla connection and use for the URL, and input your login and password (you'll have to register first). You can press F3 to get a list of all bugs or query specific ones. When you want to create a custom query you have to click the AND/OR/NOT buttons when adding constraints.

This material endeavors to provide more detail on the best methods for created a good bug report.

Give 'em the info they need

  • Describe your operating system: WinXP, WinME, Win98, WinNT, Linux, etc.
  • Describe your compiler: DMD, GDC, etc. (what version? any special patches applied?)
  • Describe how the bug appears
  • If it's not obvious, describe what you expected to happen
  • Include a small self-contained snippet of code that creates the problem.

Less is more!

Submit the smallest set of code that you can get to cause the problem!

If you submit a large set of code to Walter, he'll ask you to shorten it if he even responds to your message.

The idea is to shorten the code into the briefest set of code that produces the error. If it only takes 10 lines of code to create the error, that's what Walter wants you to send to him. It's very unlikely that the error would require 20 or more lines of code, so if you post 20 files with 1000 lines each, Walter will immediately ask you to break it into something smaller.

If it's 3 files but you can get it to produce the error in 2 files, make it two files. If it's 100 lines, but there are only a dozen lines that are involved in the problem, trim it down!

If you have a set of 50 files that are producing an obscure error, odds are that a compiler writer doesn't want to touch it. I've got some tips at how to work on whittling this down.

Hints for shortening the code

(From the beginning, you should probably be removing existing documentation comments that are in the code so that they don't get in the way of the commenting-out of trial code.)

One important thing to remember is that if the error disappears or a new error message appears, you've failed in creating code for a bug report. Right away, back up to get the error back! Remove something else instead.

Test removal first by commenting out sections (probably easiest using /+ +/) first before you actually remove it. If the same error still appears it's a success, you can now delete this section. It's best to only do one or a few "comment-outs" at a time, so if the error message change, you remember how to get it back.

I've found that a good place to try to eliminate unnessary code is void function bodies. Just try commenting out the whole thing at once. A similiar method can be used for functions that return values, just remember to leave "return something;". (If it wants a number, use "return 0;" if it wants an object use "return null;" if it wants a bit, use "return false;" it doesn't matter what you return as long as the bug still manifests.) If the error changes, uncomment the trial code and leave it in. You can come back to it later.

Once you've made good progress getting rid of function bodies, you can try removing class bodies. you can also get rid of struct bodies, enum bodies, etc. In fact, any time you see a pair of curly braces {}, you can try to remove the contents. If the same buggy behavior remains, it's a success.

This is an art not a science. If the code works (or doesn't in the case of a bug), then it's good.

Automatic minimization

DustMite is a tool designed to minimize D source code given certain criteria:

"DustMite will parse the source code into a simple hierarchy, and attempt to shrink it by deleting fragments iteratively, as long as the result satisfies a user-specified condition."

Tips on working with the D Issue Tracking System

FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: November 13, 2012 21:28 (diff))