1 ; CGEN Debugging support.
2 ; Copyright (C) 2000 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. The user visible procs are:
13 ; (cload #:arch arch #:machs "mach-list" #:isas "isa-list" #:options "options")
15 ; First load fixup.scm to coerce guile into something we've been using.
16 ; Guile is always in flux.
20 (set! %load-path (cons srcdir %load-path))
22 ; Utility to enable/disable compiled-in C code.
24 (define (use-c) (set! CHECK-LOADED? #t))
25 (define (no-c) (set! CHECK-LOADED? #f))
27 ; Also defined in read.scm, but we need it earlier.
28 (define APPLICATION 'UNKNOWN)
30 ; Supply the path name and suffic for the .cpu file and delete the analyzer
31 ; arg from cpu-load to lessen the typing.
32 (define (cload . args)
38 ; Doesn't check if (cadr args) exists or if #:arch was specified, but
39 ; this is a debugging tool!
40 (let loop ((args args))
45 ((#:arch) (set! arch (cadr args)))
46 ((#:machs) (set! keep-mach (cadr args)))
47 ((#:isas) (set! keep-isa (cadr args)))
48 ((#:options) (set! options (cadr args)))
49 (else (error "unknown option:" (car args))))
53 ((UNKNOWN) (error "application not loaded"))
54 ((DESC) (cpu-load (string-append arch ".cpu")
55 keep-mach keep-isa options
59 ((OPCODES) (cpu-load (string-append arch ".cpu")
60 keep-mach keep-isa options
64 ((GAS-TEST) (cpu-load (string-append arch ".cpu")
65 keep-mach keep-isa options
69 ((SIMULATOR) (cpu-load (string-append arch ".cpu")
70 keep-mach keep-isa options
74 ((SIM-TEST) (cpu-load (string-append arch ".cpu")
75 keep-mach keep-isa options
79 (else (error "unknown application:" APPLICATION))))
82 ; Use the debugging evaluator.
83 (if (not (defined? 'DEBUG-EVAL))
84 (define DEBUG-EVAL #t))
86 ; Tell maybe-load to always load the file.
87 (if (not (defined? 'CHECK-LOADED?))
88 (define CHECK-LOADED? #f))
99 (set! verbose-level 3)
100 (set! APPLICATION 'OPCODES)
106 (set! verbose-level 3)
107 (set! APPLICATION 'GAS-TEST)
117 (set! verbose-level 3)
118 (set! APPLICATION 'SIMULATOR)
131 (set! verbose-level 3)
132 (set! APPLICATION 'SIMULATOR)
138 (set! verbose-level 3)
139 (set! APPLICATION 'SIM-TEST)
143 First enable compiled in C code if desired.
147 Then choose the application via one of:
155 (display "(load-sid)\n")
159 Then load the .cpu file with:
161 (cload #:arch \"arch\" #:machs \"keep-mach\" #:isas \"keep-isa\" #:options \"options\")
164 comma separated list of machs to keep or `all'
167 comma separated list of isas to keep or `all'
190 ; If ~/.cgenrc exists, load it.
192 (let ((cgenrc (string-append (getenv 'HOME) "/.cgenrc")))
193 (if (file-exists? cgenrc)