Code Search for Developers
 
 
  

dev.scm from Gdb at Krugle


Show dev.scm syntax highlighted

; CGEN Debugging support.
; Copyright (C) 2000 Red Hat, Inc.
; This file is part of CGEN.
; See file COPYING.CGEN for details.

; This file is loaded in during an interactive guile session to
; develop and debug CGEN.  The user visible procs are:
;
; (use-c)
; (load-opc)
; (load-sim)
; (load-sid)
; (cload #:arch arch #:machs "mach-list" #:isas "isa-list" #:options "options")

; First load guile.scm to coerce guile into something we've been using.
; Guile is always in flux.
(load "guile.scm")

(define srcdir ".")
(set! %load-path (cons srcdir %load-path))

; Utility to enable/disable compiled-in C code.

(define (use-c) (set! CHECK-LOADED? #t))
(define (no-c) (set! CHECK-LOADED? #f))

; Also defined in read.scm, but we need it earlier.
(define APPLICATION 'UNKNOWN)

; Supply the path name and suffic for the .cpu file and delete the analyzer
; arg from cpu-load to lessen the typing.
(define (cload . args)
  (let ((arch #f)
	(keep-mach "all")
	(keep-isa "all")
	(options ""))

    ; Doesn't check if (cadr args) exists or if #:arch was specified, but
    ; this is a debugging tool!
    (let loop ((args args))
      (if (null? args)
	  #f ; done
	  (begin
	    (case (car args)
	      ((#:arch) (set! arch (cadr args)))
	      ((#:machs) (set! keep-mach (cadr args)))
	      ((#:isas) (set! keep-isa (cadr args)))
	      ((#:options) (set! options (cadr args)))
	      (else (error "unknown option:" (car args))))
	    (loop (cddr args)))))

    (case APPLICATION
      ((UNKNOWN) (error "application not loaded"))
      ((DESC) (cpu-load (string-append "./cpu/" arch ".cpu")
			keep-mach keep-isa options
			desc-init!
			desc-finish!
			desc-analyze!))
      ((DOC) (cpu-load (string-append "./cpu/" arch ".cpu")
			keep-mach keep-isa options
			doc-init!
			doc-finish!
			doc-analyze!))
      ((OPCODES) (cpu-load (string-append "./cpu/" arch ".cpu")
			   keep-mach keep-isa options
			   opcodes-init!
			   opcodes-finish!
			   opcodes-analyze!))
      ((GAS-TEST) (cpu-load (string-append "./cpu/" arch ".cpu")
			    keep-mach keep-isa options
			    gas-test-init!
			    gas-test-finish!
			    gas-test-analyze!))
      ((SIMULATOR) (cpu-load (string-append "./cpu/" arch ".cpu")
			     keep-mach keep-isa options
			     sim-init!
			     sim-finish!
			     sim-analyze!))
      ((SID-SIMULATOR) (cpu-load (string-append "./cpu/" arch ".cpu")
			     keep-mach keep-isa options
			     sim-init!
			     sim-finish!
			     sim-analyze!))
      ((SIM-TEST) (cpu-load (string-append "./cpu/" arch ".cpu")
			    keep-mach keep-isa options
			    sim-test-init!
			    sim-test-finish!
			    sim-test-analyze!))
      (else (error "unknown application:" APPLICATION))))
)

; Use the debugging evaluator.
(if (not (defined? 'DEBUG-EVAL))
    (define DEBUG-EVAL #t))

; Tell maybe-load to always load the file.
(if (not (defined? 'CHECK-LOADED?))
    (define CHECK-LOADED? #f))

(define (load-doc)
  (load "read")
  (load "desc")
  (load "desc-cpu")
  (load "html")
  ; ??? Necessary for the following case, dunno why.
  ; bash$ guile -l dev.scm
  ; guile> (load-doc)
  ; guile> (cload #:arch "m32r")
  (set! APPLICATION 'DOC)
)

(define (load-opc)
  (load "read")
  (load "desc")
  (load "desc-cpu")
  (load "opcodes")
  (load "opc-asmdis")
  (load "opc-ibld")
  (load "opc-itab")
  (load "opc-opinst")
  (set! verbose-level 3)
  (set! APPLICATION 'OPCODES)
)

(define (load-gtest)
  (load-opc)
  (load "gas-test")
  (set! verbose-level 3)
  (set! APPLICATION 'GAS-TEST)
)

(define (load-sid)
  (load "read")
  (load "utils-sim")
  (load "sid")
  (load "sid-cpu")
  (load "sid-model")
  (load "sid-decode")
  (set! verbose-level 3)
  (set! APPLICATION 'SID-SIMULATOR)
)

(define (load-sim)
  (load "read")
  (load "desc")
  (load "desc-cpu")
  (load "utils-sim")
  (load "sim")
  (load "sim-arch")
  (load "sim-cpu")
  (load "sim-model")
  (load "sim-decode")
  (set! verbose-level 3)
  (set! APPLICATION 'SIMULATOR)
)

(define (load-stest)
  (load-opc)
  (load "sim-test")
  (set! verbose-level 3)
  (set! APPLICATION 'SIM-TEST)
)

(display "
First enable compiled in C code if desired.

(use-c)

Then choose the application via one of:

(load-doc)
(load-opc)
(load-gtest)
(load-sim)
(load-stest)
")

(display "(load-sid)\n")

(display "\

Then load the .cpu file with:

(cload #:arch \"arch\" #:machs \"keep-mach\" #:isas \"keep-isa\" #:options \"options\")

keep-mach:
comma separated list of machs to keep or `all'

keep-isa:
comma separated list of isas to keep or `all'

opcode options:
[none yet]

gas test options:
[none yet]
\n")

(display "\
sim options:
with-scache
with-profile=fn

sim test options:
[none yet]
\n")

(display "\
sid options:
[wip]
\n")

; If ~/.cgenrc exists, load it.

(let ((cgenrc (string-append (getenv "HOME") "/.cgenrc")))
  (if (file-exists? cgenrc)
      (load cgenrc))
)




See more files for this project here

Gdb

GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it executes -- or what another program was doing at the moment it crashed.

Project homepage: http://sources.redhat.com/gdb/
Programming language(s): Assembly,C,C++,Expect
License: other

  cpu/
    arm.cpu
    arm.sim
    arm7.cpu
    fr30.cpu
    fr30.opc
    i960.cpu
    i960.opc
    ia32.cpu
    ia64.cpu
    ip2k.cpu
    ip2k.opc
    iq10.cpu
    iq2000.cpu
    iq2000.opc
    iq2000m.cpu
    m32r.cpu
    m32r.opc
    m68k.cpu
    openrisc.cpu
    openrisc.opc
    play.cpu
    powerpc.cpu
    sh-sid.cpu
    sh-sim.cpu
    sh.cpu
    sh.opc
    sh64-compact.cpu
    sh64-media.cpu
    simplify.inc
    sparc.cpu
    sparc.opc
    sparc32.cpu
    sparc64.cpu
    sparccom.cpu
    sparcfpu.cpu
    thumb.cpu
    xc16x.cpu
    xc16x.opc
    xstormy16.cpu
    xstormy16.opc
  doc/
    Makefile.am
    Makefile.in
    app.texi
    cgen.texi
    credits.texi
    glossary.texi
    internals.texi
    intro.texi
    notes.texi
    opcodes.texi
    pmacros.texi
    porting.texi
    rtl.texi
    running.texi
    sim.texi
    stamp-vti
    version.texi
  slib/
    genwrite.scm
    logical.scm
    pp.scm
    random.scm
    sort.scm
  AUTHORS
  COPYING.CGEN
  ChangeLog
  INSTALL
  Makefile.am
  Makefile.in
  NEWS
  README
  aclocal.m4
  attr.scm
  cgen-doc.scm
  cgen-gas.scm
  cgen-opc.scm
  cgen-sid.scm
  cgen-sim.scm
  cgen-stest.scm
  configure
  configure.in
  cos-pprint.scm
  cos.scm
  decode.scm
  desc-cpu.scm
  desc.scm
  dev.scm
  enum.scm
  gas-test.scm
  gen-all-doc
  gen-all-opcodes
  gen-all-sid
  gen-all-sim
  guile.scm
  hardware.scm
  html.scm
  ifield.scm
  iformat.scm
  insn.scm
  mach.scm
  minsn.scm
  mode.scm
  model.scm
  opc-asmdis.scm
  opc-ibld.scm
  opc-itab.scm
  opc-opinst.scm
  opcodes.scm
  operand.scm
  pgmr-tools.scm
  pmacros.scm
  pprint.scm
  profile.scm
  read.scm
  rtl-c.scm
  rtl-traverse.scm
  rtl.scm
  rtx-funcs.scm
  sem-frags.scm
  semantics.scm
  sid-cpu.scm
  sid-decode.scm
  sid-model.scm
  sid.scm
  sim-arch.scm
  sim-cpu.scm
  sim-decode.scm
  sim-model.scm
  sim-test.scm
  sim.scm
  stamp-h.in
  types.scm
  utils-cgen.scm
  utils-gen.scm
  utils-sim.scm
  utils.scm