[dmd-beta] dmd 1.060 and 2.045 beta

Robert Clipsham robert at octarineparrot.com
Mon May 3 12:45:27 PDT 2010


On 03/05/10 19:49, Walter Bright wrote:
> No surprise, as in my build process I inadvertently copied over the new
> dwarf.c with the old one. I've fixed that with a new upload of the beta's.
>
> The real problem, though, is I don't have a good way to automatically
> test the integrity of the dwarf output.

The following should do the trick:
----
for f in `find debug_tests -name \*.d`; do
  exe="debug_tests/`basename "$f" .d`"
  dmd -gc "$f" "-of$exe"
  if [ "`gdb -ex "b _Dmain" --batch $exe |& wc -l`" != "0" ]; then
   echo fail gdb: $exe;
  fi
  if [ "`objdump --dwarf $exe >/dev/null |& wc -l`" != "0" ]; then
   echo fail objdump: $exe;
  fi
done
----
If you have dwarfdump installed you can use the --verify switch too to 
test these too (and I advise you do this in addition to them, I don't 
have it installed to adapt the script for you though). There's probably 
a more elegant way to test this, this was just a quick hack to get it 
working/automated. Here's a set of test files for your debug_tests dir 
to get you started (I hereby release the following and previous code 
under Boost or any other license you wanna distribute them under):

fptr1.d:
----
void function() a;
void main()
{
   a();
}
----

fptr2.d:
----
void function(void function(int, string)) a;
void main()
{
   a(null);
}
----

fptr3.d:
----
void function(void function(void function())) a;
void main()
{
   a(null);
}
----

fptr4.d:
----
string function(ref int) a;
void main()
{
  int mi;
  a(mi);
}
----

wchr.d:
----
void main()
{
  wchar mwc;
}
----

These test cases cover most, if not all of the debug issues I've fixed, 
I've undoubtedly missed a few though. Hope this helps :)

Robert



More information about the dmd-beta mailing list