1 ; CGEN Debugging support.
2 ; Copyright (C) 2000, 2009 Red Hat, Inc.
3 ; This file is part of CGEN.
4 ; See file COPYING.CGEN for details.
6 ; This file is loaded in during an interactive guile session to
7 ; develop and debug CGEN.
9 ; First load guile.scm to coerce guile into something we've been using.
10 ; Guile is always in flux.
13 (load "dev-utils.scm")
15 ; Also defined in read.scm, but we need it earlier.
16 (define APPLICATION 'UNKNOWN)
18 (define dev-verbose-level 2)
20 ; Supply the path name and suffic for the .cpu file and delete the analyzer
21 ; arg from cpu-load to lessen the typing.
23 (define (cload . args)
24 (set! verbose-level dev-verbose-level)
31 (diagnostic-options ""))
33 ; Doesn't check if (cadr args) exists or if #:arch was specified, but
34 ; this is a debugging tool!
35 (let loop ((args args))
40 ((#:arch) (set! cpu-file (cadr args)))
41 ((#:machs) (set! keep-mach (cadr args)))
42 ((#:isas) (set! keep-isa (cadr args)))
43 ((#:options) (set! options (cadr args)))
44 ((#:trace) (set! trace-options (cadr args)))
45 ((#:diag) (set! diagnostic-options (cadr args)))
46 (else (error "unknown option:" (car args))))
50 ((UNKNOWN) (error "application not loaded"))
51 ((DESC) (cpu-load cpu-file
52 keep-mach keep-isa options
53 trace-options diagnostic-options
57 ((DOC) (cpu-load cpu-file
58 keep-mach keep-isa options
59 trace-options diagnostic-options
63 ((OPCODES) (cpu-load cpu-file
64 keep-mach keep-isa options
65 trace-options diagnostic-options
69 ((GAS-TEST) (cpu-load cpu-file
70 keep-mach keep-isa options
71 trace-options diagnostic-options
75 ((SIMULATOR) (cpu-load cpu-file
76 keep-mach keep-isa options
77 trace-options diagnostic-options
81 ((SID-SIMULATOR) (cpu-load cpu-file
82 keep-mach keep-isa options
83 trace-options diagnostic-options
87 ((SIM-TEST) (cpu-load cpu-file
88 keep-mach keep-isa options
89 trace-options diagnostic-options
93 ((TESTSUITE) (cpu-load cpu-file
94 keep-mach keep-isa options
95 trace-options diagnostic-options
99 (else (error "unknown application:" APPLICATION))))
102 ; Use the debugging evaluator.
103 (if (not (defined? 'DEBUG-EVAL))
104 (define DEBUG-EVAL #t))
106 ; Tell maybe-load to always load the file.
107 (if (not (defined? 'CHECK-LOADED?))
108 (define CHECK-LOADED? #f))
112 First choose the application via one of:
122 (display "(load-sid)\n")
126 Then load the .cpu file with:
128 (cload #:arch \"path-to-cpu-file\" #:machs \"keep-mach\" #:isas \"keep-isa\"
129 #:options \"options\" #:trace \"trace-options\" #:diag \"diagnostic-options\")
131 Only the #:arch parameter is mandatory, the rest are optional.
134 comma separated list of machs to keep or `all'
137 comma separated list of isas to keep or `all'
139 #:options specifies a list of application-specific options
146 Remember to call (set-opc-file-path! \"/path/to/cpu.opc\").
167 trace-options: (comma-separated list of options)
168 commands - trace cgen command invocation
169 pmacros - trace pmacro expansion
170 all - trace everything
174 diagnostic-options: (comma-separated list of options)
175 iformat - do more diagnostics on instruction formats
176 all - do all diagnostics
179 ; If ~/.cgenrc exists, load it.
181 (let ((cgenrc (string-append (getenv "HOME") "/.cgenrc")))
182 (if (file-exists? cgenrc)