www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/20/15:07:14

From: Dave Bird <dave AT xemu DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: GDB to debug Masm/Nasn output?
Date: Sat, 20 Feb 1999 19:52:46 +0000
Organization: very little
Message-ID: <rmo4sDAOKxz2Ewuu@xemu.demon.co.uk>
NNTP-Posting-Host: xemu.demon.co.uk
X-NNTP-Posting-Host: xemu.demon.co.uk:158.152.196.209
X-Trace: news.demon.co.uk 919540777 nnrp-03:19385 NO-IDENT xemu.demon.co.uk:158.152.196.209
X-Complaints-To: abuse AT demon DOT net
MIME-Version: 1.0
X-Newsreader: Turnpike (32) Version 4.01 <dQumtnY$x4rJ2u5tL5fS$n2vuP>
Lines: 63
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

  Dear People,

  I have a large Intel-style assembler program shared with other users,
  who are very unlikely to mess with different assemblers than MASM
  (or I could get them NASM) or with high level. This is a given.
  It needs to start using protected mode or "unreal mode" for very big 
  data structures.

  Can I debug MASM (or NASM) output with GDB or similar?  I can't use
  CodeView because it will reset large segment limits back to 64K or
  TubboDebug because it won't let me allocate loads of memory;
  apparently if I use masm's LINK /CO then I am producing COFF output.
  I have the latest DJGPP2.2 package from DJ's website.

  However, GDB says "wrong file format" -- even though according to
  the FAQ it should run EXE as well as COFF -- and exe2coff equally
  says that the file hasn't got a COFF section.  Help!  This may be
  a MASM problem as much as anything; maybe I need a different 
  Intel-style assembler which will produce output GDB can eat?

  Regards,

  DAVE.


BEGIN FAQ QUOTE=======================================================[

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. 

========================================================]END FAQ QUOTE.



-- 
Dave[XEMU]             ________________(....=^¬¬^=______   ---<,,"> 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019