This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: hacking gcc - avoiding bootstrap?


> From: brent@rcfile.org
> Date: Fri, 29 Sep 2000 17:07:20 -0400
> To: Phil Edwards <pedwards@disaster.jaj.com>
> Cc: gcc@gcc.gnu.org

> maybe just a list of tools that the pros use to get around the code,

The human brain (memory), emacs, grep, TAGS (M-.) and gdb account of 90% of
the way I get around.

> a document on how to use gdb to debug a compiler (admitting my lack
> of knowledge of gdb), or is the (apparent) lack of help significant
> of the lack of demand for this sort of info?

Run gdb in emacs, M-x gdb.  Set a breakpoint on expand_expr,
make_insn_raw, emit_insn and friends, and your off and running.  :-)
Neat variables are things like lineno, cur_insn_uid, INSN_UID (note),
current_function_decl.  Interesting things to call include,
p decl
pt
p x
pr
p insn
pr
call debug_rtx_list(insn, -50)
call debug_rtx_list(insn, 50)

neat debugger commands include:
x/10i $pc
si
ni
up
down
p variable
C-x space in file.c
M-n in debugger

Fun emacs commands:
M-x grep
M-x gdb
M-. (and M-,)
C-` (M-x next-error)
M-x compile

You wanna do up some documentation?  Start it, and others may tell you
even more useful and more interesting tricks of the trade.  The above
is a 5 second overview.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]