[MLton-devel] stabs vs dwarf2

Matthew Fluet fluet@CS.Cornell.EDU
Thu, 31 Oct 2002 14:51:24 -0500 (EST)


>    Compile C starting
>       gcc -S -gdwarf-2 -I/home/sweeks/mlton/src/build/bin/../lib/self/include \
>           -O1 -o /tmp/fileEbMRCn.s z.c
>    Compile C finished in 0.17 + 0.00 (0% GC)
>    Assemble starting
>       gcc -gdwarf-2 -c -o z.o /tmp/fileEbMRCn.s
>       gcc -Wa,--gdwarf2 -c -o z.0.o z.0.s
>    Assemble finished in 0.08 + 0.00 (0% GC)
>    Link starting
>       gcc -gdwarf-2 -o z z.o z.0.o \
>           -L/home/sweeks/mlton/src/build/bin/../lib/self -lmlton-gdb -lm \
>           /usr/lib/libgmp.a
>    Link finished in 0.09 + 0.00 (0% GC)
> 
> After this, when I run gdb, I can set breakpoints in z.c, but not in
> z.0.s.  Any ideas on what I might be doing wrong?

I'd say that that looks right.  I get the same problems of not being able
to set debugging points in the assembly when using the above commands.
Note, that if you change the gcc invocations of -gdwarf-2 to -gdwarf2 (or,
equivalently (at least on gcc 2.96), -g2), then you can set break points
in both.  Likewise, when you remove all the -gdwarf-2 options.  

Ahh, here's something interesting.  Take the z executable produced above
and try setting a breakpoint in z.0.s _first_, before setting a break
point at main in z.c.  That works for me, but then if I try to set a
break point in z.0.s after breaking in z.c, I get 
""F_0" is not a function."

My guess is that there is a bug in gdb's interpretation of gcc's dwarf2
debugging information.  (Seems like it could be either gcc producing bad
dwarf2 or a bug in gdb when working with somthing that is in gcc's dwarf2
and not in as's dwarf2 info.)

Note that if you use "gcc -Wa,--gstabs -c -o z.0.o z.0.s" and -gdwarf-2
everywhere else, then I get the same phenomenon: "not a function" errors
when breaking in assembly after a break in z.c. I can still break in
mlton-gdb functions, even though they were compiled -g and not -gdwarf-2.




-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel