delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/05/05:51:52

From: sterten AT aol DOT com (Sterten)
To: djgpp AT delorie DOT com
Newsgroups: comp.os.msdos.djgpp
Date: 05 Aug 2001 09:49:14 GMT
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010722135558 DOT 6415D-100000 AT is>
Organization: AOL http://www.aol.com
Subject: Re: assembly translation of a single C-command
Message-ID: <20010805054914.26718.00002587@ng-fj1.aol.com>
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii wrote:

 >On Sat, 21 Jul 2001 Sterten AT aol DOT com wrote:
 >
 >>  >If you want to see the C code together with the assembly it was converted
to,
 >>  >use a command line like this:
 >>  >
 >>  >      gcc -c -Wa,-a,-ad [other GCC options] foo.c > foo.lst
 >>  >
 >>  >which will output the combined C/assembly listing to the file `foo.lst'.
 >> 
 >> not with GCC 2.03 on my computer.

BTW. , is 2.03 the most recent version for DOS ?

 >> The C-code is not in it.
 >
 >Sorry, the FAQ fails to tell that you need to use -g as well:
 >
 >  gcc -c -g -Wa,-a,-ad [other GCC options] foo.c > foo.lst
 >
 >Without -g, the assembler won't have enough info to output the source
 >lines.
 >
 >I will fix that in the next release of the FAQ.
 >
 >(In general, whenever you have problems like that, it is advisable to
 >look up the relevant switches in the docs.  In this case, the node in
 >the Gas manual ("info as") which describes the -a switch tells you
 >that -g is required.)

I see. 
I also found, that I have to type *.exe -h  for help ,
and not  /?  as I'm used to.
I have a large file with all files in all GCC subdirectories now,
which I can search for keywords  :-)


However, for that "assembly and C-code together" problem 
I'm disappointed. With the -g switch I do get the C-code ,
although not the included .h files ,
but sometimes I have many C-lines (upto 500) followed by many
assembly lines (upto thousands). 
It's still very difficult to figure out how a special C-line
is translated into assembly.
It worked (rather) well for my small test programs , but not for large
programs.


Guenter

- Raw text -


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