Recent

Author Topic: Lazarus always uses a 32 bit debugger  (Read 362 times)

KeesBl

  • Newbie
  • Posts: 2
Lazarus always uses a 32 bit debugger
« on: September 13, 2024, 02:20:43 pm »
When I hit F9 I get:
Note on Windows it is not possible to debug a 64 bit application with a 32 bit debugger.
Ik get this warning when I run a basic 64 bits application on Windows 64 bits with debug information. It run's fine without debug information.
I tried al kind of debugger settings, but lazarus always says I'am using a 32 bit debugger.
IDE options : Fpdebug internal Dwarf-debugger (just like the application options).
Target OS = Win64
Target CPU = x86_64
Optimization = 0
Win32 GUI application checked
Linking: debugging -> Automatic -g
When I start the app I get the choice Dwarf2 with set and a few other options. It doesn't matter.
I'am using Lazarus 3.99 and fpc version 3.3.1.

On the same computer Delphi 5 is installed. I remember having problem installing other programming language IDE's complaining that it needs something that D5 uses (vague, I know but I don't remember). Maybe this is the problem..?

What can I do?


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10293
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus always uses a 32 bit debugger
« Reply #1 on: September 13, 2024, 02:37:27 pm »
What IDE did you install?

1) A native 64 bit IDE (You can check in the Windows Taskmanager if the IDE is marked as 32bit)
2) The 32 bit IDE and a cross compiler to 64 bit?

When using FpDebug, the debugger is part of the IDE. So if your IDE is build as 32 bit app, then the debugger is too, and that cannot be changed. (Well you can select to use a GDB based debugger, and then this works as gdb is an external app, and the 32 bit IDE can start a 64 bit gdb / but the gdb based debugger is generally not as good as FpDebug)

If you do have a 64 bit IDE and you get that error, then there may be something else.
The message is displayed for "GetLastError=50"
https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
Which is a "not supported" by Windows error. The 64/32 bit mixup is one common reason for this.

KeesBl

  • Newbie
  • Posts: 2
Re: Lazarus always uses a 32 bit debugger
« Reply #2 on: September 14, 2024, 10:40:10 am »
Indeed. Lazarus.exe was 32 bits. Your explanation made it clear to me. Thanks!

I had installed the 32 bits version (with ghcupdeluxe) because of a warning saying that cross compiling does not work very well in the 64 bits version.
Now I installed the 64 bits version and everything works fine.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10293
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus always uses a 32 bit debugger
« Reply #3 on: September 14, 2024, 11:24:09 am »
because of a warning saying that cross compiling does not work very well in the 64 bits version.
Now I installed the 64 bits version and everything works fine.

I don't know exactly which warning you saw. And I don't know how fpcupdeluxe builds the cross compiler for "generating 32 bit exe from a 64bit IDE"....

Background (afaik):

64bit on Windows does not have an 80bit extended float type. This limit is enforced by Windows itself (i.e. the Hardware could do it, under Linux it should work, but on Windows it is not supported).

That means, if the compiler pre-computes (at compile time, rather than generating code to do it at runtime) something like
Code: Pascal  [Select][+][-]
  1. extended(1/7)*extended(1/11)
then the result may differ by a tiny tiny fraction.

Most of the cases that does not matter. But on principal it could.

Just to be clear, that is only what the compiler pre-computes (compile time constant evaluation). If the generate 32 bit exe does that calculation at runtime, it will use the full 80bit extended float. Never mind if the compiler was a native 32bit or a 64bit cross compiler.


For that reason (not sure if there are more, but afaik that is it):
- Fpc does not release such a cross compiler
- FpcUpDeluxe: I don't know....
- The Lazarus add-on to cross-compile to a 32bit target: It is actually a native 32bit compiler in disguise

So if you use that addon, then you should not have that issue at all. But the add-on only comes for the released version.

With FpcUpDeluxe you could build 2 native compilers. A native 64bit, and a native 32bit. Then in the IDE you use, instead switching the Target between 64/32 bit, you would need to change the compiler. (Mind that may need a bit of knowledge in how FpcUpDeluxe installs them).

You can also have FpcUpDeluxe build you the 32bit compiler (and IDE) and a 64 bit cross compiler, and then afterwards recompile the IDE to 64 bit yourself. The 64bit IDE can still use the 32bit compiler and the cross-to-64-bit compiler.


If you don't use extended float, then it does not matter.
If you do, then it depends on how much you rely on precomputed constants being exact to the full 80 bits.

That is, if FpcUpDeluxe actually builds a 64bit cross-to-32-bit compiler. I don't know that.

 

TinyPortal © 2005-2018