[MLton-devel] debugging native assembly and line numbers

Matthew Fluet fluet@CS.Cornell.EDU
Wed, 31 Jul 2002 19:12:51 -0400 (EDT)


> When compiling -debug true, the native codegen emits .s files instead
> of .S files and hence doesn't use __LINE__ for feeding reasonable line
> numbers to the GC.  Why?  Wouldn't it be better to still generate the
> .S, use the preprocessor, and debug the .s?  Won't the line numbers
> still be close?

The problem is that -Wa,--gstabs option applies to gcc's underlying call
to as.  When you pass gcc a .S file, it runs cpp on the .S to produce a
temporary .s file (with __LINE__ expanded), which is what is passed to as. 
So, you end up with an executable whose debugging info is tied to the (now
deleted) temporary .s file.  If you compile a .S file with gcc -S, it
pipes the cpp-ed version to stdout (as opposed to producing a .s file). 

I don't know of any way of fooling as or gcc into doing what we want.
If your stuck, you could try compiling with -debug false -stop g, run each
.S file through gcc -S > .s, then finish compiling with 
-debug true X.c X.s.  Then you ought to be able to debug (relative to the
.s file).




-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel