delorie.com is funded by banner ads.
  www.delorie.com/djgpp/v2faq/faq097.html   search  

| Previous | Next | Up | Top |

12.4 GDB would not debug unless it sees COFF output

Q: I try invoking GDB on my program, but it says: "not in executable format: File format not recognized." Huh?


A: Most probably, you've invoked GDB from DJGPP v2.0 on a .exe program. That version of GDB needs to be called with the name of un-stubbed COFF executable as its argument. To get both a .exe and a COFF file, you should make your link command line look this way:
      gcc -o foo foo.o

instead of
      gcc -o foo.exe foo.o

(the latter will only produce foo.exe, while the former produces both foo, the COFF executable which gdb needs, and foo.exe).

To produce a COFF file from a .exe program, use the EXE2COFF program which comes with DJGPP, like this:

      exe2coff foo.exe

Debuggers which come with DJGPP v2.01 can debug COFF and .exe programs alike, so upgrading to v2.01 should solve this problem.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright ⌐ 1998   by Eli Zaretskii     Updated Sep 1998  

Powered by Apache!

You can help support this site by visiting the advertisers that sponsor it! (only once each, though)