Difference: CS255Spring09DebugCC1 (5 vs. 6)

Revision 62009-01-27 - BinBao

Line: 1 to 1
 
META TOPICPARENT name="CS255Spring09ProjectHome"

CS255/455 Spring 2008 How to Debug your compiler

  • Build a debuggable compiler
Line: 11 to 11
  After getting the command sequence by using gcc -v, you can write a gdb command file to save the typing when starting gdb. Here is an example of such file (your file location and parameters may be different).
      file /localdisk/bao/gcc/obj/gcc/cc1
      b rest_of_handle_cs255
Changed:
<
<
r -quiet -v ab.c -quiet -dumpbase ab.c -mtune=generic -auxbase-strip ab.o -O2 -version -fcs255 -fdump-tree-gimple -fdump-cs255-tree-gimple -o /tmp/cceaerqF.s
>
>
r -quiet -v ab.c -quiet -dumpbase ab.c -mtune=generic -auxbase-strip ab.o -O2 -version -fcs255 -fdump-tree-gimple -fdump-cs255-tree-gimple -o /tmp/cceaerqF.s
 Let's name this file as gdbfile, and then you can run gdb -x gdbfile to start debugging.

  • Get familiar with gdb commands
Line: 30 to 29
 
    1. gdb --annotate=3 cc1.
    2. gdb has been started, so you can use it normally.
Changed:
<
<
* Dump gimple tree node tree-dump.c.
>
>
  • Dump gimple tree node in gdb
    Definitions of dump functions can be found in tree-dump.c and tree-pretty-print.c. Let node be a gimple tree node,
    • p debug_tree(node) can print some basic information about node;
    • p print_generic_stmt(stdout, node, 2) can print the generic form of node if it is a statement node, where 2 is the value of the macro TDF_SLIM;
    • p dump_node(node, 2, stdout) can dump details about node and its children.
 
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding URCS? Send feedback