delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/21/09:22:27

From: Dave Bird <dave AT xemu DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GDB to debug Masm/Nasn output?
Date: Sun, 21 Feb 1999 02:11:25 +0000
Organization: very little
Message-ID: <JRIAhXANt2z2Ew4H@xemu.demon.co.uk>
References: <rmo4sDAOKxz2Ewuu AT xemu DOT demon DOT co DOT uk>
<36cf4632 DOT 80880437 AT news DOT cso DOT uiuc DOT edu>
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 919606500 nnrp-07:13676 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: 50
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <36cf4632 DOT 80880437 AT news DOT cso DOT uiuc DOT edu>, Peter Johnson writes:
>Dave Bird wrote:
>>
>>  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.
>>  However, GDB says "wrong file format" -- even though according to
>>  the FAQ it should run EXE as well as COFF --
>
>The problem is that specifying the /CO option to MASM does produce
>COFF object files, 

 erm, that's "to LINK" (LINK /CO).

>but they don't contain sections named ".text",
>".data", etc.  Also, you won't be able to debug programs unless they
>were linked with ld (the DJGPP/GNU linker).  I have been able to get
>MASM-assembled code to link successfully with ld by hexediting the
>section names in the object file.  However, in general, I think you'll
>have more success with NASM, as long as you link with ld!

 OK, I'll get NASM, as that seems a fairly straightforward solution.

 It might be worth a note in the FAQ -- eventually -- though, fair do's,
 what I am trying is a bit non-standard and not all that frequent. 

>>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.
>>Debuggers which come with DJGPP v2.01 can debug COFF and .exe programs
>>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>alike, so upgrading to v2.01 should solve this problem. 

  INSERT: (though probably not for files produced by MASM and LINK
  or even LINK /CO -- you would need to use NASM and LD instead).

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

-- 
   ^-^-^-@@-^-;-^   http://www.xemu.demon.co.uk/
        (..)__u     news:alt.smoking.mooses

       happy as a clam at high tide -. <_" .-._.-.

- Raw text -


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