Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2020-07

Console problem in Lazarus trunk

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

J. Gareth Moreton

Hi everyone,

This is likely due to something peculiar in my configuration that I haven't found yet, but I can't be sure.  I'm having problems in that the latest Lazarus trunk won't create a console window when I'm running the compiler source in the debugger.  I tried to jury-rig it to create its own using the AllocConsole() Windows API function as a temporary workaround, but it failed with an "access denied" error.  The little I could find on that error implies that the application already has a console, but it's not displayed. Anyone got any ideas?

Gareth aka. Kit

This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Ozz Nixon
to J. Gareth Moreton

Probably not your issue - but, if you have Avasta Anti-Virus - it can foobar Lazarus and Delphi console apps - where the Console is showing, but you cannot find it. Not on Taskbar, not in TaskList, etc. If you put an exclusion on your binary folder, then it works. Took me about 2 days to figure this out.

PM J. Gareth Moreton wrote 22 lines
Hi everyone, This is likely due to something peculiar in my configuration that I haven't found yet, but I can't be sure. I'm having problems in that the latest Lazarus trunk won't create a console window when I'm running the compiler source in the debugger. I tried to jury-rig it to create its own using the AllocConsole() Windows API function as a temporary workaround, but it failed with an "access denied" error. The little I could find on that error implies that the application already has a console, but it's not displayed. Anyone got any ideas? Gareth aka. Kit -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Werner Pamler
to J. Gareth Moreton: This is likely due to something peculiar in my configuration that I haven't found yet,…
J. Gareth Moreton wrote
I'm having problems in that the latest Lazarus trunk won't create a console window when I'm running the compiler source in the debugger.

I have the same issue. A simple CLI program like

program Project1;
begin
   WriteLn('Test');
   ReadLn;
end.

does no longer open a console in Windows to show the output, just tested on an absolutely fresh Laz-trunk installation with FPC 3.2.0. No issues when I run the program within the IDE but without debugger (Run > Run without debugging), and, of course, also outside the IDE. The very same code performs well on Laz-trunk with FPC 3.0.4, also no problems on Laz 2.0.10/FPC 3.2.0

Werner

Reply by email

J. Gareth Moreton
to Ozz Nixon: Probably not your issue - but, if you have Avasta Anti-Virus - it can foobar Lazarus and…

Unfortunately this one didn't work for me.  I do have Avast Antivirus, but adding Lazarus both as an exception and as an allowed app failed to fix the problem.  I've kept the entries present though.

Gareth aka. Kit

Ozz Nixon wrote 40 lines
Probably not your issue - but, if you have Avasta Anti-Virus - it can foobar Lazarus and Delphi console apps - where the Console is showing, but you cannot find it. Not on Taskbar, not in TaskList, etc. If you put an exclusion on your binary folder, then it works. Took me about 2 days to figure this out. On Sat, Jul 25, 2020 at 1:41 PM J. Gareth Moreton < > wrote: Hi everyone, This is likely due to something peculiar in my configuration that I haven't found yet, but I can't be sure.  I'm having problems in that the latest Lazarus trunk won't create a console window when I'm running the compiler source in the debugger.  I tried to jury-rig it to create its own using the AllocConsole() Windows API function as a temporary workaround, but it failed with an "access denied" error.  The little I could find on that error implies that the application already has a console, but it's not displayed. Anyone got any ideas? Gareth aka. Kit -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus _______________________________________________ fpc-devel maillist  - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Pascal Riekenberg
to Werner Pamler: I have the same issue. A simple CLI program like program Project1; begin  …
Show quoted text 22 lines
Werner Pamler hat am 25. Juli 2020 um 21:06 geschrieben: Am 25.07.2020 um 20:40 schrieb J. Gareth Moreton: > I'm having problems in that the latest Lazarus trunk won't create a > console window when I'm running the compiler source in the debugger. I have the same issue. A simple CLI program like program Project1; begin   WriteLn('Test');   ReadLn; end. does no longer open a console in Windows to show the output, just tested on an absolutely fresh Laz-trunk installation with FPC 3.2.0. No issues when I run the program within the IDE but without debugger (Run > Run without debugging), and, of course, also outside the IDE. The very same code performs well on Laz-trunk with FPC 3.0.4, also no problems on Laz 2.0.10/FPC 3.2.0

Are you sure? I use laz trunk and fpc trunk and for me the issue arises when run within the IDE without debugging. This also applies to Windows apps with option -WC.

Pascal

Reply by email

Werner Pamler
to Pascal Riekenberg
Pascal Riekenberg wrote
Are you sure? I use laz trunk and fpc trunk and for me the issue arises when run within the IDE without debugging. This also applies to Windows apps with option -WC.

Strange... But I checked it again (with the simple WriteLn program above) and confirm the result reported earlier:

- Laz trunk / fpc 3.2.0 / 32 bit --> does NOT show console if run with debugger. Does show it if "run without debugger" (both inside and outside the IDE).
- Laz trunk / fpc 3.2.0 / 64 bit --> same
- Laz trunk / fpc trunk / 32 bit --> same

BUT

- Laz 2.0.10 / fpc 3.2.0 / 32 bit --> does show console if run with or without debugger (as expected)
- Laz 2.0.10 / fpc 3.2.0 / 64 bit --> does show console if run with or without debugger (as expected)
- Laz fixes / fpc fixes / 32 bit --> same

The debugger in each case is the gdb which is distributed with the Lazarus 2.0.10 installation.

Reply by email

Martin Frb
to J. Gareth Moreton: This is likely due to something peculiar in my configuration that I haven't found yet,…
J. Gareth Moreton wrote 10 lines
Hi everyone, This is likely due to something peculiar in my configuration that I haven't found yet, but I can't be sure.  I'm having problems in that the latest Lazarus trunk won't create a console window when I'm running the compiler source in the debugger.  I tried to jury-rig it to create its own using the AllocConsole() Windows API function as a temporary workaround, but it failed with an "access denied" error.  The little I could find on that error implies that the application already has a console, but it's not displayed. Anyone got any ideas?

I did a bit of testing.

Using FpDebug => fine
Using GDB:
- IDE compiled with console => fine
- IDE compiled without console => app in debugger does not open console.

I tried other Process.Opitons in
components\lazdebuggergdbmi\cmdlinedebugger.pp
function TCmdLineDebugger.CreateDebugProcess(const AOptions: String):
Boolean;
       FDbgProcess.Options:= [poUsePipes, poNoConsole, poStdErrToOutPut,
poNewProcessGroup];

poNewConsole instead of poNoConsole made no diff.
Adding poRunIdle => no diff

       FDbgProcess.ShowWindow := swoNone;
swoNormal made no diff.

Besides those would affect gdb, but maybe they also are seen by Windows when launching the target.
- One possibility is that TProcess changed, and hands something different to windows.
- Another option is, that the change is in how the debugged app communicates to windows that it wants a console.
But I do not know.....

One thing I found
components\lazdebuggergdbmi\gdbmidebugger.pp
line 3545
  // for win32, turn off a new console otherwise breaking gdb will fail   // ignore the error on other platforms
  FSuccess := ExecuteCommand('-gdb-set new-console off', R);

Make that "on" and it works (only tested if IDE has no console).

But it is there, because at the time of creating it, it caused issues. So changing it would likely cause issues on some older systems. There are countless combinations of
- Windows version/bitness
- gdb version
- fpc version
- app and/or ide has console or not
And no idea how many of them may break. Maybe its just some Win95. Maybe its some still supported versions.

So for now, anyone wanting to test this can change that line. If you do, please report your experience, and all versions in your setup.

Reply by email

Pascal Riekenberg
to Martin Frb
Show quoted text 18 lines
Martin Frb hat am 28. Juli 2020 um 01:52 geschrieben: On 25/07/2020 20:40, J. Gareth Moreton wrote: > Hi everyone, > > This is likely due to something peculiar in my configuration that I > haven't found yet, but I can't be sure.  I'm having problems in that > the latest Lazarus trunk won't create a console window when I'm > running the compiler source in the debugger.  I tried to jury-rig it > to create its own using the AllocConsole() Windows API function as a > temporary workaround, but it failed with an "access denied" error.  > The little I could find on that error implies that the application > already has a console, but it's not displayed. Anyone got any ideas? I did a bit of testing. Using FpDebug => fine

Didn't noticed that the console window of the IDE was used when run without debugger. I use fpDebug. So everything is fine here. Sorry for the confusion!

Show quoted text 50 lines
Using GDB: - IDE compiled with console => fine - IDE compiled without console => app in debugger does not open console. I tried other Process.Opitons in components\lazdebuggergdbmi\cmdlinedebugger.pp function TCmdLineDebugger.CreateDebugProcess(const AOptions: String): Boolean;       FDbgProcess.Options:= [poUsePipes, poNoConsole, poStdErrToOutPut, poNewProcessGroup]; poNewConsole instead of poNoConsole made no diff. Adding poRunIdle => no diff       FDbgProcess.ShowWindow := swoNone; swoNormal made no diff. Besides those would affect gdb, but maybe they also are seen by Windows when launching the target. - One possibility is that TProcess changed, and hands something different to windows. - Another option is, that the change is in how the debugged app communicates to windows that it wants a console. But I do not know..... One thing I found components\lazdebuggergdbmi\gdbmidebugger.pp line 3545   // for win32, turn off a new console otherwise breaking gdb will fail   // ignore the error on other platforms   FSuccess := ExecuteCommand('-gdb-set new-console off', R); Make that "on" and it works (only tested if IDE has no console). But it is there, because at the time of creating it, it caused issues. So changing it would likely cause issues on some older systems. There are countless combinations of - Windows version/bitness - gdb version - fpc version - app and/or ide has console or not And no idea how many of them may break. Maybe its just some Win95. Maybe its some still supported versions. So for now, anyone wanting to test this can change that line. If you do, please report your experience, and all versions in your setup. _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

J. Gareth Moreton
to Pascal Riekenberg

Thanks for the investigation everyone.  I still haven't solved the issue on my end, and I forgot to mention my configuration (not very good for a former test engineer!)

Lazarus trunk, FPC 3.2.0, x86-64_win64.

Gareth aka. Kit

Pascal Riekenberg wrote 75 lines
> Martin Frb hat am 28. Juli 2020 um 01:52 geschrieben: > > > On 25/07/2020 20:40, J. Gareth Moreton wrote: >> Hi everyone, >> >> This is likely due to something peculiar in my configuration that I >> haven't found yet, but I can't be sure.  I'm having problems in that >> the latest Lazarus trunk won't create a console window when I'm >> running the compiler source in the debugger.  I tried to jury-rig it >> to create its own using the AllocConsole() Windows API function as a >> temporary workaround, but it failed with an "access denied" error. >> The little I could find on that error implies that the application >> already has a console, but it's not displayed. Anyone got any ideas? > I did a bit of testing. > > Using FpDebug => fine Didn't noticed that the console window of the IDE was used when run without debugger. I use fpDebug. So everything is fine here. Sorry for the confusion! > Using GDB: > - IDE compiled with console => fine > - IDE compiled without console => app in debugger does not open console. > > I tried other Process.Opitons in > components\lazdebuggergdbmi\cmdlinedebugger.pp > function TCmdLineDebugger.CreateDebugProcess(const AOptions: String): > Boolean; >       FDbgProcess.Options:= [poUsePipes, poNoConsole, poStdErrToOutPut, > poNewProcessGroup]; > > poNewConsole instead of poNoConsole made no diff. > Adding poRunIdle => no diff > >       FDbgProcess.ShowWindow := swoNone; > swoNormal made no diff. > > Besides those would affect gdb, but maybe they also are seen by Windows > when launching the target. > - One possibility is that TProcess changed, and hands something > different to windows. > - Another option is, that the change is in how the debugged app > communicates to windows that it wants a console. > But I do not know..... > > One thing I found > components\lazdebuggergdbmi\gdbmidebugger.pp > line 3545 >   // for win32, turn off a new console otherwise breaking gdb will fail >   // ignore the error on other platforms >   FSuccess := ExecuteCommand('-gdb-set new-console off', R); > > Make that "on" and it works (only tested if IDE has no console). > > But it is there, because at the time of creating it, it caused issues. > So changing it would likely cause issues on some older systems. > There are countless combinations of > - Windows version/bitness > - gdb version > - fpc version > - app and/or ide has console or not > And no idea how many of them may break. Maybe its just some Win95. Maybe > its some still supported versions. > > So for now, anyone wanting to test this can change that line. > If you do, please report your experience, and all versions in your setup. > > _______________________________________________ > fpc-devel maillist - > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email