Recent

Author Topic: IDE crashes and takes so much code with it  (Read 1681 times)

munair

  • Hero Member
  • *****
  • Posts: 884
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: IDE crashes and takes so much code with it
« Reply #15 on: May 21, 2025, 04:27:25 pm »
At the moment, I use a Win 7 VM.
...
Win 7 may be the problem. But as well, there can be a problem with VMWare or the graphic-driver. Windows has some very nasty and very fuzzy issues. They are indeed rare, this is why it is so hard to catch them. All in all it is a really good operating system. However, I will say bye bye to it because I refuse Win 11.

I also use Lazarus on Windows 7 (next to Linux), but on a dedicated machine and not in a VM. I have no problems.
It's only logical.

munair

  • Hero Member
  • *****
  • Posts: 884
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: IDE crashes and takes so much code with it
« Reply #16 on: May 21, 2025, 04:32:23 pm »
At the moment, I use a Win 7 VM.
...
Win 7 may be the problem. But as well, there can be a problem with VMWare or the graphic-driver. Windows has some very nasty and very fuzzy issues. They are indeed rare, this is why it is so hard to catch them. All in all it is a really good operating system. However, I will say bye bye to it because I refuse Win 11.

I also use Lazarus on Windows 7 (next to Linux), but on a dedicated machine and not in a VM. I have no problems. However, I do most of the coding on Linux. I can't say I've been heavy testing on W7.
« Last Edit: May 21, 2025, 04:35:43 pm by munair »
It's only logical.

Nicole

  • Hero Member
  • *****
  • Posts: 1182
Re: IDE crashes and takes so much code with it
« Reply #17 on: May 21, 2025, 04:33:20 pm »
I am not sure, what codetools means. However the word suggests, that it may be similar to a situation I came across several times:

I like developing by using existing code. For this, I copy whole methods and paste them to create something new with their lines. There is a lot to be aware of: Give them a new name, care for a not existing name, place it somewhere into context with other functions within the class. Be aware of begin and end in every loop. Very helpful is that I made the IDE drawing a line under every method. If the "end;" is under this line, it is a severe warning of messed loop.

In this work, it happens frequently that anything gets messed. e.g. I forget to delete a
functiion TMyClass.myMethod: TmyIdea; or a begin end block is lost. Or the click-event from one button shall be copied to the event for another button and this is messed.

Sure, in this case the compiler is puzzled.  Worse, if I try to double-click a button to jump to its click-event to fix it. In the best case, the IDE says "I cannot hop there". In the worst case, ... bye bye IDE, bye bye all changes of the last hour... How to file it? It is gone!

Logging it all and every tiny second does not pay.
So I hit "save" every some minutes. The prize is, that the build-in backup function of Lazarus is worthless, because I save too often for it.

Nicole

  • Hero Member
  • *****
  • Posts: 1182
Re: IDE crashes and takes so much code with it
« Reply #18 on: May 21, 2025, 04:58:10 pm »
in the best case this is helpful or anybody is familiar with it:

 This was my situation:
 I had a line reading
Code: Pascal  [Select][+][-]
  1.  jsonText, s: string;

 if should read:
Code: Pascal  [Select][+][-]
  1.  jsonText: string;

 my mistake, i deleted more than ",s and the line ended up:
Code: Pascal  [Select][+][-]
  1.  jsonText;
(as you see it on the screenshot)
 
 The compiler says it and it is easy to fix.
BUT:  I did not see it in time.

I clicked at designtime to ANY click event of a speed button.
 This click event has nothing in common with the messed method.
 
 This is such a case of bye bye.

 Be aware: I do not expect to be able to reproduce this by myself.
 I am not quite sure, which circumstances must meet. It hits me when I do not expect it.
 This screenshot is what I can provide and hoping anybody finds it helpful.
 

 

munair

  • Hero Member
  • *****
  • Posts: 884
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: IDE crashes and takes so much code with it
« Reply #19 on: May 21, 2025, 05:51:54 pm »
Codetools pops up frequently here, but it's on Linux and I can't remember it crashing the IDE. It seems like this is a Windows thing or VM related.
« Last Edit: May 21, 2025, 06:01:45 pm by munair »
It's only logical.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11361
  • Debugger - SynEdit - and more
    • wiki
Re: IDE crashes and takes so much code with it
« Reply #20 on: May 21, 2025, 06:26:16 pm »
I am not sure, what codetools means. However the word suggests, that it may be similar to a situation I came across several times:
Most features that need to "understand" pascal.

Most well known: code completion (the drop down, but also creating local vars...).
It also does refactoring from the menu.
And it does automatic insertion of "end" if you press return after a new "begin".
And it can do some indent, if set up to do...

Quote

I like developing by using existing code. For this, I copy whole methods and paste them to create something new with their lines.
When you paste, does your code get re-indented?

That would be codetools (first page of codetools options).

And quite a few people may have that "smart indent" turned off. So that would be a feature only some (not sure how many, could be half, could be 75% or 25%....) users would use.

It then may also depend on what that code contains.

There are a few known issue (albeit not sure about crashes) when codetool encounters generics...


Quote
There is a lot to be aware of: Give them a new name, care for a not existing name, place it somewhere into context with other functions within the class. Be aware of begin and end in every loop. Very helpful is that I made the IDE drawing a line under every method. If the "end;" is under this line, it is a severe warning of messed loop.
The lines are the highlighter / that is not codetools.

The highlighter is the 2nd part of the IDE that understands Pascal.


Quote
In this work, it happens frequently that anything gets messed. e.g. I forget to delete a
functiion TMyClass.myMethod: TmyIdea; or a begin end block is lost. Or the click-event from one button shall be copied to the event for another button and this is messed.

In which case you probably start getting errors from codetools when you try to "jump to declaration/implementation", or complete code. Watch the IDE's messages window.

Mind that this also may severely affect the designer, especially when you try to create new events (OnClick, etc).

Quote
Sure, in this case the compiler is puzzled.  Worse, if I try to double-click a button to jump to its click-event to fix it. In the best case, the IDE says "I cannot hop there". In the worst case, ... bye bye IDE, bye bye all changes of the last hour... How to file it? It is gone!

Yes, that be a complicated case.

Because it may not just be the state immediately before. It may be which other states the IDE has been in. There are caches that can go wrong.

But a first point is trying to get a stack trace.
That might at least allow to circumvent the crash, and have an error instead.  (At least it improves chances that can be done)


If the IDE runs with a logfile, it may still be able to write that trace.
If it does not, it will be more work. It would mean to run the IDE in the debugger, until it crashes.



You are on Windows?

In the lazarus folder open "cmd.exe"
(In the windows explorer, while looking at the folder replace the directory in the edit with "cmd.exe" and press return)

Then run  (you need full path to gdb which is inside lazarus install mingw\gdb)
    gdb  -ex r -ex bt ./lazarus

You may need to confirm "Enable debuginfod for this session? (y or [n]) " with N if it asks.

When lazarus crashes it should show a stacktrace.

You can put that in a .bat file (but someone needs to check how to disable the debuginfod quesiton)


 

TinyPortal © 2005-2018