OSDN Git Service

Patch for sid/cgen setter error.
[pf3gnuchains/pf3gnuchains4x.git] / cgen / dev.scm
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.
5
6 ; This file is loaded in during an interactive guile session to
7 ; develop and debug CGEN.
8
9 ; First load guile.scm to coerce guile into something we've been using.
10 ; Guile is always in flux.
11 (load "guile.scm")
12
13 (load "dev-utils.scm")
14
15 ; Also defined in read.scm, but we need it earlier.
16 (define APPLICATION 'UNKNOWN)
17
18 (define dev-verbose-level 2)
19
20 ; Supply the path name and suffic for the .cpu file and delete the analyzer
21 ; arg from cpu-load to lessen the typing.
22
23 (define (cload . args)
24   (set! verbose-level dev-verbose-level)
25
26   (let ((cpu-file #f)
27         (keep-mach "all")
28         (keep-isa "all")
29         (options "")
30         (trace-options "")
31         (diagnostic-options ""))
32
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))
36       (if (null? args)
37           #f ; done
38           (begin
39             (case (car 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))))
47             (loop (cddr args)))))
48
49     (case APPLICATION
50       ((UNKNOWN) (error "application not loaded"))
51       ((DESC) (cpu-load cpu-file
52                         keep-mach keep-isa options
53                         trace-options diagnostic-options
54                         desc-init!
55                         desc-finish!
56                         desc-analyze!))
57       ((DOC) (cpu-load cpu-file
58                         keep-mach keep-isa options
59                         trace-options diagnostic-options
60                         doc-init!
61                         doc-finish!
62                         doc-analyze!))
63       ((OPCODES) (cpu-load cpu-file
64                            keep-mach keep-isa options
65                            trace-options diagnostic-options
66                            opcodes-init!
67                            opcodes-finish!
68                            opcodes-analyze!))
69       ((GAS-TEST) (cpu-load cpu-file
70                             keep-mach keep-isa options
71                             trace-options diagnostic-options
72                             gas-test-init!
73                             gas-test-finish!
74                             gas-test-analyze!))
75       ((SIMULATOR) (cpu-load cpu-file
76                              keep-mach keep-isa options
77                              trace-options diagnostic-options
78                              sim-init!
79                              sim-finish!
80                              sim-analyze!))
81       ((SID-SIMULATOR) (cpu-load cpu-file
82                              keep-mach keep-isa options
83                              trace-options diagnostic-options
84                              sim-init!
85                              sim-finish!
86                              sim-analyze!))
87       ((SIM-TEST) (cpu-load cpu-file
88                             keep-mach keep-isa options
89                             trace-options diagnostic-options
90                             sim-test-init!
91                             sim-test-finish!
92                             sim-test-analyze!))
93       ((TESTSUITE) (cpu-load cpu-file
94                              keep-mach keep-isa options
95                              trace-options diagnostic-options
96                              testsuite-init!
97                              testsuite-finish!
98                              testsuite-analyze!))
99       (else (error "unknown application:" APPLICATION))))
100 )
101
102 ; Use the debugging evaluator.
103 (if (not (defined? 'DEBUG-EVAL))
104     (define DEBUG-EVAL #t))
105
106 ; Tell maybe-load to always load the file.
107 (if (not (defined? 'CHECK-LOADED?))
108     (define CHECK-LOADED? #f))
109
110 (display "
111
112 First choose the application via one of:
113
114 (load-doc)
115 (load-opc)
116 (load-gtest)
117 (load-sim)
118 (load-stest)
119 (load-testsuite)
120 ")
121
122 (display "(load-sid)\n")
123
124 (display "\
125
126 Then load the .cpu file with:
127
128 (cload #:arch \"path-to-cpu-file\" #:machs \"keep-mach\" #:isas \"keep-isa\"
129        #:options \"options\" #:trace \"trace-options\" #:diag \"diagnostic-options\")
130
131 Only the #:arch parameter is mandatory, the rest are optional.
132
133 keep-mach:
134 comma separated list of machs to keep or `all'
135
136 keep-isa:
137 comma separated list of isas to keep or `all'
138
139 #:options specifies a list of application-specific options
140
141 doc options:
142 [none yet]
143
144 opcode options:
145 [none yet]
146 Remember to call (set-opc-file-path! \"/path/to/cpu.opc\").
147
148 gas test options:
149 [none yet]
150 \n")
151
152 (display "\
153 sim options:
154 with-scache
155 with-profile=fn
156
157 sim test options:
158 [none yet]
159 \n")
160
161 (display "\
162 sid options:
163 [wip]
164 \n")
165
166 (display "\
167 trace-options: (comma-separated list of options)
168 commands - trace cgen command invocation
169 pmacros - trace pmacro expansion
170 all - trace everything
171 \n")
172
173 (display "\
174 diagnostic-options: (comma-separated list of options)
175 iformat - do more diagnostics on instruction formats
176 all - do all diagnostics
177 \n")
178
179 ; If ~/.cgenrc exists, load it.
180
181 (let ((cgenrc (string-append (getenv "HOME") "/.cgenrc")))
182   (if (file-exists? cgenrc)
183       (load cgenrc))
184 )