Recent

Author Topic: Debugger Error - "C:/FPC/3.0.4/demo/text/blackbox.exe": not in executable format  (Read 3263 times)

440bx

  • Hero Member
  • *****
  • Posts: 4063
Hello,

I'm a newbie to FreePascal and Lazarus.  I'm using Windows 7 SP1 64 bit.

Here is what I've done:

1. I installed the 32bit version of FreePascal then
2. I installed the 64bit cross compiling version of FreePascal then
3. I installed the 64bit version of Lazarus

I did this just yesterday so they should all be the latest versions.

I tested that the installations were working properly by doing the following:

1. I compiled the example blackbox.pp in the demo\text directory with the 32bit version of FPC and it worked.
2. I compiled the same example with the 64bit version of FPC (using the cross compiler) and it worked too. :-)

3. I compiled the blackbox.pp example using Lazarus and using the following project options:

Compiler Options/Config and Target: Target OS: Win64
Compiler Options/Config and Target: Target CPU family: x86_64

The project compiled fine and if I select "Run without debugging", it runs just fine.

If I select  "run" (instead of Run without debugging", I get the Debugger error message shown in the title of this post.

I suspect that the 32bit version of GDB is being invoked to debug what is a 64bit program which, if that is the case, it would explain why GDB is unhappy.

I looked everywhere for a setting that would tell Lazarus to use the 64bit version of GDB (I hope there is one) but, I didn't find a setting anywhere that seemed to be the right one.

My question is: 1. what do I have to do to compile and debug a 64bit version of a program ?

and...

The FPC character based IDE doesn't seem to have an option to enable the creation and debugging of 64bit programs.  If there is a way to make the FPC ide compile and debug 64bit programs, I would really like to know how that is done.

Thank you for your help :-)

John.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9907
  • Debugger - SynEdit - and more
    • wiki
Yes looks like you use the wrong gdb.

gdb is configured under menu: Tools > Options
Then go to the "debugger" > general page.

The debugger exe must match the current project. This setting is global, so it does not change per project.
You can however save your different gdb in a way that they can be found.

The default setup provide a path like
$(LazarusDir)\mingw\$(TargetCPU)-$(TargetOS)\bin\gdb.exe

assuming that all GDB versions are found in folders with correct names.

--------------------------
I am not sure why you choose the order of installation that you did?

On the Lazarus download on sourceforge, you can choose either the 64 or 32 bit version.
And then from the same folder install the cross compile that you need.

If you clear your config before install (or use above path) then this works out of the box.

440bx

  • Hero Member
  • *****
  • Posts: 4063
Martin,

Thank you very much :-)

The path you mentioned works great and it makes complete sense to do it that way.

The problem is that I have 1 (that's one) day of experience with FreePascal and Lazarus, as a result, there are a lot of things I have not figured out and I am sure I will be doing things not quite the right way for some time.

I installed FPC as I did because I wanted to have both, the regular command line based environment  and, the IDE based environment.  I usually prefer a command line to get things done but, I thought that for a while, at least, I could use the help of the Lazarus IDE.  That's why I proceeded to install things as I did.

The path you gave me solved the problem when I'm using the Lazarus IDE.   Do you know how to make the regular FPC character mode IDE use the 64bit compiler and debugger ? so far, I haven't seen any way to make it create and debug 64bit app but, that's more likely a result of my ignorance than a limitation of the character mode IDE.

Thanks again,

John.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9907
  • Debugger - SynEdit - and more
    • wiki
Do you know how to make the regular FPC character mode IDE use the 64bit compiler and debugger ?
Unfortunately not. Never used the cmdline-IDE

440bx

  • Hero Member
  • *****
  • Posts: 4063
Unfortunately not. Never used the cmdline-IDE

Thank you.  I appreciate your help.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018