www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMD crash! and JSON files

reply Regan Heath <regan netmail.co.nz> writes:
I just installed VisualD and enabled JSON output on my project and to my 
delight F12 took me to my own symbols.  Yay.  Next, I thought it would 
be grand if I could jump around phobos/druntime code the same way so I 
went looking for JSON files for these.  Sadly, they're not included in 
the DMD release zip.  Not to be foiled so easily I figured I'd try my 
hand at building druntime and phobos.

So.. attempt #1, the naive approach.  I cracked open the win32.mak files 
for each and added -X to DFLAGS.


For druntime...

I did a "make -fwin32.mak clean" then "make -fwin32.mak" only to get:
   Target 'target' is up to date

It seems that 'clean' doesn't clean everything, it gave an error:
   The system cannot find the file specified.

for one of the myriad files included in the del command.  I modified 
win32.mak for druntime to perform a seperate del command for each item, eg.

clean:
	del $(DOCS)
	del $(IMPORTS)
	del $(DRUNTIME)
	del $(OBJS_TO_DELETE)
	del $(GCSTUB)

this isn't perfect as I suspect if any file in any of those lists is 
missing the delete will stop dead, but this does at least clean enough 
to get me going again.

** (Walter, might be worth making a similar change to the master copy?)

I then repeated the make steps and managed to produce a druntime.lib 
plus these JSON file..
   bitop.json
   gcstub.json

that's less than I was expecting.. is this because the dmd command to 
build druntime.lib is a -lib and -X is not compatible/meaningful with it?


Ignoring that for now I moved on to phobos itself...

"make -fwin32.mak clean" worked, but "make -fwin32.mak" failed until I 
added:  "-I% P%\..\..\src\druntime\src" to my sc.ini

** (Walter, should that be there by default? .. perhaps not as you only 
need it to rebuild phobos and most ppl don't do that).

Now "make -fwin32.mak" gets as far as the big dmd -lib command but this 
time it crashes ***!

I do however have a few JSON files from the make:
   c_stdio.json
   Czlib.json
   Dzlib.json
   oldsyserror.json

It seems I am going to need to get smarter with the makefiles, instead 
of attempting to piggy-back the lib build process I should build each 
file seperately to produce a JSON...
Apr 21 2010
next sibling parent reply Don <nospam nospam.com> writes:
Regan Heath wrote:
 I just installed VisualD and enabled JSON output on my project and to my 
 delight F12 took me to my own symbols.  Yay.  Next, I thought it would 
 be grand if I could jump around phobos/druntime code the same way so I 
 went looking for JSON files for these.  Sadly, they're not included in 
 the DMD release zip.  Not to be foiled so easily I figured I'd try my 
 hand at building druntime and phobos.

[snip]
 Now "make -fwin32.mak" gets as far as the big dmd -lib command but this 
 time it crashes ***!

bug 4809 ? BTW, I don't need to modify paths in order to build on Windows (except note that you need to touch druntime/minit.obj because of a problem with the download). So you shouldn't need to modify sc.ini.
Apr 21 2010
next sibling parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
Don wrote:
 Regan Heath wrote:
 
 [snip]
 
 Now "make -fwin32.mak" gets as far as the big dmd -lib command but 
 this time it crashes ***!

bug 4809 ?

You need the patches to bugs #4089 and #3415 to create sensible JSON output. I just added another diff to #4089 for an issue that I hit recently. With these patches to DMD, I used JSON output for druntime and phobos successfully. But it would be nice if these would be part of the DMD distribution, so you don't need to build them manually first. The installer for Visual D could then automatically configure them for lookup. Before letting the IDE dive deep into semantic analysis, my current plan is to use the information found in the json files for parameter info tooltips aswell. For this, pre-installed files would be really convenient.
Apr 21 2010
next sibling parent Regan Heath <regan netmail.co.nz> writes:
Rainer Schuetze wrote:
 With these patches to DMD, I used JSON output for druntime and phobos 
 successfully. But it would be nice if these would be part of the DMD 
 distribution, so you don't need to build them manually first. The 
 installer for Visual D could then automatically configure them for lookup.

That is exactly what I was hoping for :) R
Apr 22 2010
prev sibling next sibling parent reply Regan Heath <regan netmail.co.nz> writes:
Rainer Schuetze wrote:
 You need the patches to bugs #4089 and #3415 to create sensible JSON 
 output. I just added another diff to #4089 for an issue that I hit 
 recently.
 
 With these patches to DMD, I used JSON output for druntime and phobos 
 successfully. 

Ok, I've applied those 3 patches and rebuilt dmd.exe. It can now produce JSON for variant.d which was previously causing a crash. I modified the win32.mak files for druntime and phobos to produce JSON files in a tree matching the source trees, but output to <dmd2>\json. I've added that json path to the VisualD global JSON paths setting, eg. $(DMDInstallDir)\json (I tried specifying the path without the $() var but it makes no difference) I highlight BufferedFile and press F12, or right-click and choose "Go To Definition" and it doesn't work :( Any ideas? Here is a listing of my JSON files for reference... <dmd>\json\core <dmd>\json\crc32.json <dmd>\json\gc <dmd>\json\json.txt <dmd>\json\object_.json <dmd>\json\rt <dmd>\json\std <dmd>\json\core\bitop.json <dmd>\json\core\cpuid.json <dmd>\json\core\dll_helper.json <dmd>\json\core\exception.json <dmd>\json\core\memory.json <dmd>\json\core\runtime.json <dmd>\json\core\sync <dmd>\json\core\thread.json <dmd>\json\core\thread_helper.json <dmd>\json\core\vararg.json <dmd>\json\core\sync\barrier.json <dmd>\json\core\sync\condition.json <dmd>\json\core\sync\config.json <dmd>\json\core\sync\exception.json <dmd>\json\core\sync\mutex.json <dmd>\json\core\sync\rwmutex.json <dmd>\json\core\sync\semaphore.json <dmd>\json\gc\gc.json <dmd>\json\gc\gcalloc.json <dmd>\json\gc\gcbits.json <dmd>\json\gc\gcstats.json <dmd>\json\gc\gcx.json <dmd>\json\rt\aaA.json <dmd>\json\rt\aApply.json <dmd>\json\rt\aApplyR.json <dmd>\json\rt\adi.json <dmd>\json\rt\arrayassign.json <dmd>\json\rt\arraybyte.json <dmd>\json\rt\arraycast.json <dmd>\json\rt\arraycat.json <dmd>\json\rt\arraydouble.json <dmd>\json\rt\arrayfloat.json <dmd>\json\rt\arrayint.json <dmd>\json\rt\arrayreal.json <dmd>\json\rt\arrayshort.json <dmd>\json\rt\cast_.json <dmd>\json\rt\cover.json <dmd>\json\rt\dmain2.json <dmd>\json\rt\invariant.json <dmd>\json\rt\invariant_.json <dmd>\json\rt\lifetime.json <dmd>\json\rt\llmath.json <dmd>\json\rt\memory.json <dmd>\json\rt\memset.json <dmd>\json\rt\obj.json <dmd>\json\rt\qsort.json <dmd>\json\rt\switch_.json <dmd>\json\rt\trace.json <dmd>\json\rt\typeinfo <dmd>\json\rt\util <dmd>\json\rt\typeinfo\ti_AC.json <dmd>\json\rt\typeinfo\ti_Acdouble.json <dmd>\json\rt\typeinfo\ti_Acfloat.json <dmd>\json\rt\typeinfo\ti_Acreal.json <dmd>\json\rt\typeinfo\ti_Adouble.json <dmd>\json\rt\typeinfo\ti_Afloat.json <dmd>\json\rt\typeinfo\ti_Ag.json <dmd>\json\rt\typeinfo\ti_Aint.json <dmd>\json\rt\typeinfo\ti_Along.json <dmd>\json\rt\typeinfo\ti_Areal.json <dmd>\json\rt\typeinfo\ti_Ashort.json <dmd>\json\rt\typeinfo\ti_byte.json <dmd>\json\rt\typeinfo\ti_C.json <dmd>\json\rt\typeinfo\ti_cdouble.json <dmd>\json\rt\typeinfo\ti_cfloat.json <dmd>\json\rt\typeinfo\ti_char.json <dmd>\json\rt\typeinfo\ti_creal.json <dmd>\json\rt\typeinfo\ti_dchar.json <dmd>\json\rt\typeinfo\ti_delegate.json <dmd>\json\rt\typeinfo\ti_double.json <dmd>\json\rt\typeinfo\ti_float.json <dmd>\json\rt\typeinfo\ti_idouble.json <dmd>\json\rt\typeinfo\ti_ifloat.json <dmd>\json\rt\typeinfo\ti_int.json <dmd>\json\rt\typeinfo\ti_ireal.json <dmd>\json\rt\typeinfo\ti_long.json <dmd>\json\rt\typeinfo\ti_ptr.json <dmd>\json\rt\typeinfo\ti_real.json <dmd>\json\rt\typeinfo\ti_short.json <dmd>\json\rt\typeinfo\ti_ubyte.json <dmd>\json\rt\typeinfo\ti_uint.json <dmd>\json\rt\typeinfo\ti_ulong.json <dmd>\json\rt\typeinfo\ti_ushort.json <dmd>\json\rt\typeinfo\ti_void.json <dmd>\json\rt\typeinfo\ti_wchar.json <dmd>\json\rt\util\console.json <dmd>\json\rt\util\ctype.json <dmd>\json\rt\util\hash.json <dmd>\json\rt\util\string.json <dmd>\json\rt\util\utf.json <dmd>\json\std\algorithm.json <dmd>\json\std\array.json <dmd>\json\std\atomics.json <dmd>\json\std\base64.json <dmd>\json\std\bigint.json <dmd>\json\std\bind.json <dmd>\json\std\bitmanip.json <dmd>\json\std\boxer.json <dmd>\json\std\c <dmd>\json\std\compiler.json <dmd>\json\std\concurrency.json <dmd>\json\std\contracts.json <dmd>\json\std\conv.json <dmd>\json\std\cpuid.json <dmd>\json\std\cstream.json <dmd>\json\std\ctype.json <dmd>\json\std\date.json <dmd>\json\std\datebase.json <dmd>\json\std\dateparse.json <dmd>\json\std\demangle.json <dmd>\json\std\encoding.json <dmd>\json\std\file.json <dmd>\json\std\format.json <dmd>\json\std\functional.json <dmd>\json\std\getopt.json <dmd>\json\std\internal <dmd>\json\std\iterator.json <dmd>\json\std\json.json <dmd>\json\std\loader.json <dmd>\json\std\math.json <dmd>\json\std\md5.json <dmd>\json\std\metastrings.json <dmd>\json\std\mmfile.json <dmd>\json\std\numeric.json <dmd>\json\std\outbuffer.json <dmd>\json\std\path.json <dmd>\json\std\perf.json <dmd>\json\std\process.json <dmd>\json\std\random.json <dmd>\json\std\range.json <dmd>\json\std\regex.json <dmd>\json\std\regexp.json <dmd>\json\std\signals.json <dmd>\json\std\socket.json <dmd>\json\std\socketstream.json <dmd>\json\std\stdarg.json <dmd>\json\std\stdint.json <dmd>\json\std\stdio.json <dmd>\json\std\stdiobase.json <dmd>\json\std\stream.json <dmd>\json\std\string.json <dmd>\json\std\system.json <dmd>\json\std\traits.json <dmd>\json\std\typecons.json <dmd>\json\std\typetuple.json <dmd>\json\std\uni.json <dmd>\json\std\uri.json <dmd>\json\std\utf.json <dmd>\json\std\windows <dmd>\json\std\xml.json <dmd>\json\std\zip.json <dmd>\json\std\__fileinit.json <dmd>\json\std\c\math.json <dmd>\json\std\c\process.json <dmd>\json\std\c\stdarg.json <dmd>\json\std\c\stddef.json <dmd>\json\std\c\stdlib.json <dmd>\json\std\c\string.json <dmd>\json\std\c\time.json <dmd>\json\std\c\windows <dmd>\json\std\c\windows\com.json <dmd>\json\std\c\windows\stat.json <dmd>\json\std\c\windows\windows.json <dmd>\json\std\c\windows\winsock.json <dmd>\json\std\internal\math <dmd>\json\std\internal\math\biguintcore.json <dmd>\json\std\internal\math\biguintnoasm.json <dmd>\json\std\internal\math\biguintx86.json <dmd>\json\std\windows\charset.json <dmd>\json\std\windows\iunknown.json <dmd>\json\std\windows\registry.json <dmd>\json\std\windows\syserror.json
Apr 22 2010
parent reply Regan Heath <regan netmail.co.nz> writes:
Regan Heath wrote:
 I highlight BufferedFile and press F12, or right-click and choose "Go To 
 Definition" and it doesn't work :(

Ok, my mistake was creating the JSON files in a tree, a flat structure works. :) R
Apr 22 2010
parent Rainer Schuetze <r.sagitario gmx.de> writes:
Hi,

you don't need to create json-files per d-file. I added the -Xf option 
to the lib-generating line in druntime/win32.mak:

################### Library generation #########################

$(DRUNTIME): $(OBJS) $(SRCS) win32.mak
	$(DMD) -lib -Xf..\json\druntime.json -of$(DRUNTIME) $(DFLAGS) $(SRCS) 
$(OBJS)

and the same to phobos/win32.mak:

phobos.lib : $(OBJS) $(SRCS) \
	etc\c\zlib\zlib.lib $(DRUNTIMELIB) win32.mak
	$(DMD) -lib -ofphobos.lib -Xf..\json\phobos.json $(DFLAGS) $(SRCS) 
$(OBJS) \
		etc\c\zlib\zlib.lib $(DRUNTIMELIB)

and you will get only two json files. (This will leave out files in 
$(OBJS), but i think, their separate compilation seems not be necessary 
with the compile-everything-command above).


Regan Heath wrote:
 Regan Heath wrote:
 I highlight BufferedFile and press F12, or right-click and choose "Go 
 To Definition" and it doesn't work :(

Ok, my mistake was creating the JSON files in a tree, a flat structure works. :) R

Apr 22 2010
prev sibling next sibling parent reply BCS <none anon.com> writes:
Hello Rainer,

 But it would be nice if these would be part of the DMD distribution,

vote++; -- ... <IXOYE><
Apr 22 2010
parent reply Walter Bright <newshound1 digitalmars.com> writes:
BCS wrote:
 Hello Rainer,
 
 But it would be nice if these would be part of the DMD distribution,

vote++;

I kinda hate to do that because the distribution file is getting so large. I've even considered removing the docs from it (as these are just fine online).
Apr 26 2010
next sibling parent Robert Clipsham <robert octarineparrot.com> writes:
On 26/04/10 18:12, Walter Bright wrote:
 I kinda hate to do that because the distribution file is getting so
 large. I've even considered removing the docs from it (as these are just
 fine online).

Perhaps the archive could be split up into multiple archives? It shouldn't be too hard to split up the release archive into windows/linux/osx/freebsd specific archives, and for the latter 3 you could switch to a better compression algorithm to save more space. Without splitting the archive up: 9.7M dmd.2.042.zip (.042 was what I happened to have to hand) 6.3M dmd.2.042.tar.xz 7.8M dmd.2.042.tar.bz2 9.2M dmd.2.042.tar.gz Removing the windows/osx directories, (I'm on linux, seemed the right thing to test): 3.2M dmd.2.042.tar.xz 3.8M dmd.2.042.tar.bz2 4.7M dmd.2.042.tar.gz So by splitting up the archives/using different methods of compression you can save a lot of space. It shouldn't be too hard to automate the process to save effort. All this said, this is the 21st century, we can live with a few extra MB here and there :) Compared to other compilers this distribution is tiny ;) All this said, I'd love to see a mirror for the dmd archives, ftp.digitalmars.com is incredibly slow :/
Apr 26 2010
prev sibling next sibling parent Michel Fortin <michel.fortin michelf.com> writes:
On 2010-04-26 13:37:40 -0400, "Steven Schveighoffer" 
<schveiguy yahoo.com> said:

 This is the way it should be anyways -- I shouldn't have to download  
 Windows or MAC binaries/libs to compile on Linux.  Or have to mark the  
 Linux bins as executable (not necessary if the distribution was a  
 tarball), which is kinda unfriendly for newbies/annoying for 
 experienced  coders.

I agree about the executable bits. That's fairly annoying when installing manually. You'd think that just replacing the old folder with the new one would be enough, but no: you have to go change permissions all over the place. Zip files can store the executable bit too, you just have to use the right tool to create the archive. If I create a zip file using the 'zip' command on Mac OS X, the executable bit is preserved when I later use 'unzip'. It's probably the same on Linux. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Apr 26 2010
prev sibling parent Rainer Schuetze <r.sagitario gmx.de> writes:
The zip with the json-files, that I posted the other day, is 129kB. 
Maybe not the worst thing to add to the archive.

I don't think letting a beginner create the json files himself is an 
option, so the alternative would be to create a separate archive (which 
might also include the docs). But this might easily get out of date when 
the user updates to a new version of dmd.

Walter Bright wrote:
 BCS wrote:
 Hello Rainer,

 But it would be nice if these would be part of the DMD distribution,

vote++;

I kinda hate to do that because the distribution file is getting so large. I've even considered removing the docs from it (as these are just fine online).

Apr 26 2010
prev sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Mon, 26 Apr 2010 13:12:15 -0400, Walter Bright  
<newshound1 digitalmars.com> wrote:

 BCS wrote:
 Hello Rainer,

 But it would be nice if these would be part of the DMD distribution,


I kinda hate to do that because the distribution file is getting so large. I've even considered removing the docs from it (as these are just fine online).

Not that it matters to me whether you include the JSON files or not, but you could easily cut the distribution into 1/3 by having separate distributions for each platform. This is the way it should be anyways -- I shouldn't have to download Windows or MAC binaries/libs to compile on Linux. Or have to mark the Linux bins as executable (not necessary if the distribution was a tarball), which is kinda unfriendly for newbies/annoying for experienced coders. -Steve
Apr 26 2010
prev sibling parent Regan Heath <regan netmail.co.nz> writes:
Don wrote:
 Regan Heath wrote:
 I just installed VisualD and enabled JSON output on my project and to 
 my delight F12 took me to my own symbols.  Yay.  Next, I thought it 
 would be grand if I could jump around phobos/druntime code the same 
 way so I went looking for JSON files for these.  Sadly, they're not 
 included in the DMD release zip.  Not to be foiled so easily I figured 
 I'd try my hand at building druntime and phobos.

[snip]
 Now "make -fwin32.mak" gets as far as the big dmd -lib command but 
 this time it crashes ***!

bug 4809 ? BTW, I don't need to modify paths in order to build on Windows (except note that you need to touch druntime/minit.obj because of a problem with the download). So you shouldn't need to modify sc.ini.

Ahh.. I've figured out why I got the error. It was a combination of things. 1. My modified druntime win32.mak: clean: del $(DOCS) del $(IMPORTS) del $(DRUNTIME) del $(OBJS_TO_DELETE) del $(GCSTUB) without this change "make -fwin32.mak clean" will error before cleaning the imports, because none of the docs exist, they're not included in the zip. With this change the *imports* are deleted. 2. The default druntime "make -fwin32.mak" does not build the imports, you have to do that as a seperate step "make -fwin32.mak import". So, as I had #1 and didn't perform #2 it meant that my phobos build needed to find the druntime source, instead of using the imports, thus why it failed with: dmd -c -O -release -nofloat -w -d etc\c\zlib.d -ofCzlib.obj dmd -c -O -release -nofloat -w -d std\zlib.d -ofDzlib.obj std\stdio.d(24): Error: module memory cannot read file 'core\memory.d' import path[0] = D:\Development\D\dmd2\windows\bin\..\..\src\phobos import path[1] = D:\Development\D\dmd2\windows\bin\..\..\src\druntime\import --- errorlevel 1 My understanding of what 'make' does is limited to doing what I've previously needed to do, which isn't much, but I prefer the default make target to at least build "everything", so I've added the following target to the top of the win32.mak for druntime: all : target import doc Is that a sensible default for the distributed file? Perhaps? I think the change I made to clean is. R
Apr 22 2010
prev sibling parent reply BCS <none anon.com> writes:
Did anyone make it work? If so could they post the result?
Apr 22 2010
parent Rainer Schuetze <r.sagitario gmx.de> writes:
I've uploaded my json-files here:

http://www.dsource.org/projects/visuald/browser/downloads/phobos-2.043-json.zip?format=raw

I'm using a patched version of druntime, so not everything in there 
might be matching your sources. The phobos file is the more interesting 
part anyway.


BCS wrote:
 Did anyone make it work? If so could they post the result?
 
 

Apr 23 2010