⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debugging-3.html

📁 cc65 的编译器文档
💻 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 linkerand 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 programsin 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 doneby 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 willthen 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 theassembler, or add "<CODE>.debuginfo on</CODE>" to your source files. Since thegenerated debug info is not appended to the generated executables, it is agood idea to always use <CODE>-g</CODE>. It makes the object files and librariesslightly 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 labelfile. This is done by the <CODE>-L</CODE> switch followed by the name of the labelfile (I'm usually using a <CODE>.lbl</CODE> extension for these files). An example fora 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 inyour program.</P><P><B>Note</B>: The runtime libraries and startup files were generated withdebug 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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -