rochus-keller / VerilogCreator

VerilogCreator is a QtCreator based IDE for Verilog 2005
GNU General Public License v2.0
165 stars 23 forks source link

Version 0.6.3 is crashing on many cases #3

Closed pravog closed 5 years ago

pravog commented 5 years ago

Trying to add word "endmodule" in the end of following code

module Processor ( input in );

localparam STATE0 = 3'd0; localparam STATE1 = 3'd1; reg[2:0] state = STATE0;

always @ (posedge in) begin case(state) STATE0: begin end

default:  begin
end

endcase end

and VerilogCreator crashes somewhere in the middle of writing the word

rochus-keller commented 5 years ago

Oops, sorry for that. I'm not able to reproduce it on my Linux machine, neither in the release build nor in the debugger. On what OS are you? You wrote "on many cases"; do you mean "whenever I type endmodule" or does it crash with other syntax elements too?

pravog commented 5 years ago

On Windows 8.1x64 (executable downloaded from your site). Many cases mean that crash is happening in inserting other things. It is just hard to extract small cases becase it falls and do not save current pos and text May be this detail can help to find issue: If I paste "en" in the end of sample - program does not crash. If in end of file I copy or press first "e" and then paste or press "n" then it crashes May be problem is in some details of file itself (like line ending or formating or ...) ... do not know how to attach the files to issues here on github ... shared it here https://dropmefiles.com/rfBjE

rochus-keller commented 5 years ago

Ok, thanks. I manually entered your example on my Windows 10 x64 machine and also tried different versions of copy/paste. I also downloaded your provided file and manually changed and copy/pasted it.

I still don't manage to crash it and can't reproduce your findings.

So at least on my machine there doesn't seem to be a difference to Linux. Will do some other tests on an old Window 8.1 machine (but unfortunately this machine is only x86, not x64).

pravog commented 5 years ago

I manually entered your example on my Windows 10 x64 Did you tried your local latest dev version or downloaded http://software.rochus-keller.info/QtcVerilog_win32.zip Do not know what to say about reasons. Previous version is working on Test.v without crashes

rochus-keller commented 5 years ago

Did you tried your local latest dev version or downloaded http://software.rochus-keller.info/QtcVerilog_win32.zip

Yes; I tested on both Linux and Windows with the published binaries of QtcVerilog 3.6.3 and VerilogCreator plugin 0.6.3

Do not know what to say about reasons. Previous version is working on Test.v without crashes.

Which previous version are you refering to? With which version of VerilogCreator did the crashes start? I have no idea yet what it could be because it doesn't happen on my machines. Usually these kind of bugs are caused by race conditions. I added new views in 0.6.3 which concurrently access the code model. You could try to close the Outline view and try if it still crashes.

pravog commented 5 years ago

With troubles and munall fixes I build Debug version of QtcVerilog. It seems that crash is in line if( file.isEmpty() || file == i.value()->tok().d_sourcePath ) inside the Verilog/VlCrossRefModel.cpp

pravog commented 5 years ago

"You could try to close the Outline view and try if it still crashes." Interesting idea ... and it actually matters. But in reverse way ;) WITH outline turned on it is working. And if something else is selected (Projec, OpenDocs or FileSys) - QtCV crashes. Probably you have Outline turned on and you miss the crash

pravog commented 5 years ago

I also tried if multiple views are opened ... if one of views is Outline then everything is good. Otherwise - crash. Default option for QtCV is to use only one View and it is not Outline. That is why I did not had Outline view turn on. Who could imagine it matters?! ;)

pravog commented 5 years ago

"Which previous version are you refering to?" Previous for me is 0.5.4. I missed that 0.6.0-0.6.2 were released. Sorry "With which version of VerilogCreator did the crashes start?" Do not know if you need this answer any more but I do not know how to test versions which I missed P.S. It would be helpfull if new versions of build binaries are renamed to something before new QtcVerilog_win32.zip file overwrites them ... whatever you like ... may be http://software.rochus-keller.info/QtcVerilog_win32_0.6.2.zip for testing and probably temporaly using "not-latest" versions (if latest one is doing something bad ... crashing or anything else).

rochus-keller commented 5 years ago

Thank you very much for your investigations. I was indeed able to reproduce the crash when I closed the outline view; didn't expect that either. Now I'm in the debugger and try to find out what happens. I assume to be able to fix the bug tonight and will release a new version. You're right I should somehow keep the old binaries so people could go back in cases like this one. I prefer the version less name for the full downloads because otherwise I have to update all links with each version. But I will add the plugin binaries only to the VerilogCreator release record; this saves me upload time and people can just download the QtcVerilog binary and replace the plugin with whatever version they want.

rochus-keller commented 5 years ago

I think I've found the reason. As it seems the old version of the code model was not completely erased when updating a file so some objects with dangling pointers remained in the global namespace. Here is the full updated IDE: http://software.rochus-keller.info/QtcVerilog_win32.zip Here you find just the updated plugin: https://github.com/rochus-keller/VerilogCreator/releases/tag/v0.6.4 Can you please confirm that the issue has gone?

pravog commented 5 years ago

Thanks for support of sharing plugin binaries for every version. Building the QtCV from QtCreator 4 IDE is not working ... so hard to debug. May be you know about this problem and it is how it should be, no?

rochus-keller commented 5 years ago

Welcome. Could you already try the new version 0.6.4? Any crashes left?

In case you are interested: the reason of the crash was the code model data structure in VlCrossRefModel which is incrementally updated/deleted by one thread and read by many threads. Since the incremental delete did not properly remove all relevant parts (design error in clearFile method) with each update a dangling pointer was left at an arbitrary time.

Building the QtCV from QtCreator 4 IDE is not working

If you mean the VerilogCreator plugin with the QtCreator 4 source: yes, that does not work, primarily because the API and even the architecture of QtCreator changes with each version. See https://github.com/rochus-keller/VerilogCreator/issues/1. That's why I switched to my own QtcVerilog. Use that one. It's straight forward to compile it. The result can then be used to compile an run the VerilogCreator plugin.

pravog commented 5 years ago

VerilogCreator plugin with the QtCreator 4 source

No. I mean "Building the QtCV from QtCreator 4". Building. Not using. And "QtCV" is the whole QtcVerilog program (not just VerilogCreator plugin) ... is can not be used with QtCreator. Project description about problems with QtC is more than clear. I totally understand your reasons and quite agree with your solution. I saw several Qt plugins which became unvalid for use with recent versions of QtC because of how devs treated QtC interfaces with plugins. Building from QtCV from QtC4 probably needs some other actions not described but still important. What compiler and Qt version you use to produce QtC binaries?

Could you already try the new version 0.6.4? Any crashes left?

I closed the issue only after I tested 0.6.4 ... which is how I see it should be done :) Did not found any crashes yet. Thanks! Now I can try to start using the QtCV.

rochus-keller commented 5 years ago

Building from QtCV from QtC4 probably needs some other actions not described but still important.

I briefly tried with Qt Creator 4.5.2 and Qt 5.7 on my Windows 10 machine. I had no problems opening the QtcVerilog.pro file and configuring and building the project. Can you be more specific what issues you get when trying to do that on your machine?

pravog commented 5 years ago

What compiler and Qt version you use to produce QtC binaries?

Qt Creator 4.5.2 and Qt 5.7 on my Windows 10 machine

And what compiler you are using for windows?

rochus-keller commented 5 years ago

VisualStudio Express 2013

pravog commented 5 years ago

So as I get the root of problem ... I need to set "../QtcVerilogBuild" as build folder for QtcVerilog project. QtCreator asks where you want build folderr to be ... and I said "../Build". I was wrong. Silly me.

pravog commented 5 years ago

If this is true and I did not misunderstood anything ... may be it is worth directly say this recomendation in readme. Like instead of " Instead of using qmake and make you can open VerilogCreator.pro using QtCreator and build it there. " write " Instead of using qmake and make you can open and build VerilogCreator.pro and QtcVerilog.pro using QtCreator. The easiest way is to set build folder for QtcVerilog.pro to be "../QtcVerilogBuild". Otherwise you will have to tweak VerilogCreator.pro file or set environment variable QTC_BUILD before opening QtCreator " or something like that

pravog commented 5 years ago

Build procdure alreay have quite stable folder structure defined. So probably it is not a problem to defined also the name of build folder for QtcVerilog project :)

pravog commented 5 years ago

And there is also a need to manually copy "share" subfolder from QtcVerilog folder to QtcVerilogBuild folder. I do not know if this can be made an automatic part of building the QtcVerilog.pro project.

rochus-keller commented 5 years ago

It's actually only relevant when building VerilogCreator. QtcVerilog itself doesn't care where it is unpacked and built. VerilogCreator though needs to know both places - where the source of QtcVerilog resides and where the compiled libraries are and the resulting plugin should be put.

I use the original concept which is automatically generated when you let Qt Creator create a new plugin project. The necessary configuration settings are described in https://github.com/rochus-keller/VerilogCreator/blob/master/README.md Build Step 7. I don't think this can be automated without an external script.

I will add a line to the QtcVerilog readme mentioning that the share subfolder has to be copied to the deployment folder.

pravog commented 5 years ago

It's actually only relevant when building VerilogCreator

Totally agree. The quote "Instead of using qmake and make you can open VerilogCreator.pro using QtCreator and build it there." is from VerilogCreator project ... not from "QtcVerilog" I am against changing anything in quote "Instead of using qmake and make you can open QtcVerilog.pro using QtCreator and build it there." which is from QtcVerilog. Because QtcVerilog really does not care about that. I do not know qmake syntax very well ... so it was quite a challenge for me to understand why required Core.lib is not found.

I will add a line to the QtcVerilog readme mentioning that the share subfolder has to be copied to the deployment folder.

I also faced problem of copying correct files from Qt folder ... quite a lot of them are needed. How you assemble each new version of QtCV by youself? Manually copy each time files which you remember?!

rochus-keller commented 5 years ago

I also faced problem of copying correct files from Qt folder

That's a bit tricky indeed. Qt provides some helpers like macdeployqt or windeployqt (see https://doc.qt.io/qt-5/deployment.html), but in case of QtcVerilog I also had to run these tools on some subordinate pro files and assemble the result myself until it worked.

pravog commented 5 years ago

OK. So quite a lot of manuall work.

rochus-keller commented 5 years ago

That's one of the reasons why I offer binary deployments on all platforms. People can just download and use and don't have to bother with libraries or Qtc incompatibilities. And it's still much leaner and easier to install than all other Verilog IDEs I'm aware of.