Viitor_cc65/usr/share/doc/cc65/webdoc/debugging-3.html
kueller 223cc6685e Neue Version V963
git-svn-id: svn://svn.compuextreme.de/Viitor/V963/Viitor_cc65@5933 504e572c-2e33-0410-9681-be2bf7408885
2011-01-03 10:48:06 +00:00

73 lines
2.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
<TITLE>Using VICE with cc65: How to prepare your programs</TITLE>
<LINK HREF="debugging-4.html" REL=next>
<LINK HREF="debugging-2.html" REL=previous>
<LINK HREF="debugging.html#toc3" REL=contents>
</HEAD>
<BODY>
<A HREF="debugging-4.html">Next</A>
<A HREF="debugging-2.html">Previous</A>
<A HREF="debugging.html#toc3">Contents</A>
<HR>
<H2><A NAME="s3">3.</A> <A HREF="debugging.html#toc3">How to prepare your programs</A></H2>
<P>VICE support is mostly done via a label file that is generated by the linker
and that may be read by the VICE monitor, so it knows about your program.
Source level debugging is <CODE>not</CODE> available, you have to debug your programs
in the assembler view.</P>
<P>The first step is to generate object files that contain information about
<EM>all</EM> labels in your sources, not just the exported ones. This can be done
by several means:</P>
<P>
<UL>
<LI>Use the -g switch on the assembler command line.
</LI>
<LI>Use the
<BLOCKQUOTE><CODE>
<PRE>
.debuginfo +
</PRE>
</CODE></BLOCKQUOTE>
command in your source.
</LI>
<LI>Use the <CODE>-g</CODE> switch when invoking the compiler. The compiler will
then place a <CODE>.debuginfo</CODE> command into the generated assembler source.
</LI>
</UL>
</P>
<P>So, if you have just C code, all you need is to invoke the compiler with
<CODE>-g</CODE>. If you're using assembler code, you have to use <CODE>-g</CODE> for the
assembler, or add "<CODE>.debuginfo on</CODE>" to your source files. Since the
generated debug info is not appended to the generated executables, it is a
good idea to always use <CODE>-g</CODE>. It makes the object files and libraries
slightly larger (~30%), but this is usually not a problem.</P>
<P>The second step is to tell the linker that it should generate a VICE label
file. This is done by the <CODE>-L</CODE> switch followed by the name of the label
file (I'm usually using a <CODE>.lbl</CODE> extension for these files). An example for
a linker command line would be:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
ld65 -t c64 -L hello.lbl -m hello.map -o hello crt0 hello.o c64.lib
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>This will generate a file named hello.lbl that contains all symbols used in
your program.</P>
<P><B>Note</B>: The runtime libraries and startup files were generated with
debug info, so you don't have to care about this.</P>
<HR>
<A HREF="debugging-4.html">Next</A>
<A HREF="debugging-2.html">Previous</A>
<A HREF="debugging.html#toc3">Contents</A>
</BODY>
</HTML>