module: dfmc-browser-support Synopsis: Debug Info browsing routines Author: Tony Mann Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND /// Support define function context-back-end (context :: dfmc-) => (back-end) let name = dfmc-library-description-compiler-back-end-name(context); let os = dfmc-library-description-os-name(context); let arch = dfmc-library-description-processor-name(context); find-back-end-object(name, arch, os) end function; define function not-yet-implemented (api :: ) error("Debug lookup protocol error: the function %s is not yet implemented", api); end function; define function no-default-error (api :: ) error("Debug lookup protocol error: the function %s has no default implementation", api); end function; define macro apply-to-arg-spec { apply-to-arg-spec ?fn:expression, ?arg-spec:* end } => { ?fn(?arg-spec) } arg-spec: { } => { } { \#key ?key-spec:* } => { ?key-spec } { ?:name :: ?type:expression, ... } => { ?name, ... } key-spec: { } => { } { ?:name = ?init:expression, ... } => { ?#"name", ?name, ... } { ?:name, ... } => { ?#"name", ?name, ... } end macro; define macro back-ended-function-definer { define back-ended-function ?:name (?context:name :: ?type:expression, ?args:*) => (?vals:*) ?default-body:body end } => { define open generic "back-end-" ## ?name (back-end :: dfmc-, ?context :: ?type, ?args) => (?vals); define method "back-end-" ## ?name (back-end :: dfmc-, ?context :: ?type, ?args) => (?vals) ?default-body end; define function ?name (?context :: ?type, ?args) => (?vals) let back-end = ?context . context-back-end; apply-to-arg-spec "back-end-" ## ?name, back-end, ?context, ?args end; end } end macro; define macro defaulted-generic-definer { define defaulted-generic ?:name (?args:*) => (?vals:*) ?:body end } => { define open generic ?name (?args) => (?vals); define method ?name (?args) => (?vals) ?body end } end macro; /// symbolic names define defaulted-generic source-form-symbolic-name (context :: dfmc-, source-form :: ) => (name :: false-or()) not-yet-implemented("source-form-symbolic-name"); end defaulted-generic; define function symbolic-name-source-form (context :: dfmc-, name :: ) => (sf :: false-or()) not-yet-implemented("symbolic-name-source-form"); end function; define function variable-symbolic-name (context :: dfmc-, variable :: ) => (name :: false-or()) not-yet-implemented("variable-symbolic-name"); end function; define function symbolic-name-variable (context :: dfmc-, name :: ) => (variable :: false-or()) not-yet-implemented("symbolic-name-variable"); end function; define defaulted-generic compiled-lambda-symbolic-name (context :: dfmc-, compiled-lambda :: ) => (name :: false-or()) #f; end defaulted-generic; define back-ended-function symbolic-name-compiled-lambda (context :: dfmc-, name :: , #key file-name) => (compiled-lambda :: false-or()) #f; end back-ended-function; define function symbolic-name-component-name (context :: dfmc-, name :: ) => (component-name :: false-or()) not-yet-implemented("symbolic-name-component-name"); end function; define function component-name-context (context :: dfmc-, debug-target, name :: ) => (context :: false-or(dfmc-)) let name = as-lowercase(name); block (found) local method return-if-ok (ld :: dfmc-) if (ld.compilation-context-component-name = name) found(library-execution-context(ld, debug-target)); end if; end method; return-if-ok(context); do(return-if-ok, context.dfmc-all-used-library-descriptions); #f; end block; end function; define function library-name-context (context :: dfmc-, debug-target, name :: ) => (context :: false-or(dfmc-)) let name = as-lowercase(name); block (found) local method return-if-ok (ld :: dfmc-) if (ld.compilation-context-library-name = name) found(library-execution-context(ld, debug-target)); end if; end method; return-if-ok(context); do(return-if-ok, context.dfmc-all-used-library-descriptions); #f; end block; end function; define method library-execution-context (context :: dfmc-, debug-target) => (execution-context :: dfmc-) context; end method; define method library-execution-context (context :: dfmc-, debug-target) => (execution-context :: dfmc-) dfmc-lookup-interactive-context(debug-target, context, default: context); end method; define back-ended-function source-position-compiled-lambda (context :: dfmc-, sr :: dfmc-, line-no :: , #key interactive-only? = #t) => (compiled-lambda :: false-or(), code-offset :: false-or()) values(#f, #f); end back-ended-function; define back-ended-function source-form-compiled-lambda (context :: dfmc-, source-form :: ) => (compiled-lambda :: false-or()) not-yet-implemented("source-form-compiled-lambda"); end back-ended-function; define defaulted-generic compiled-lambda-source-form (context :: dfmc-, compiled-lambda :: ) => (source-form :: false-or()) not-yet-implemented("compiled-lambda-source-form"); end defaulted-generic; define back-ended-function source-form-compiled-lambda-symbolic-name (context :: dfmc-, source-form :: ) => (name :: false-or()) not-yet-implemented("source-form-compiled-lambda-symbolic-name"); end back-ended-function; define back-ended-function compiled-lambda-symbolic-name-source-form (context :: dfmc-, name :: ) => (source-form :: false-or()) not-yet-implemented("compiled-lambda-symbolic-name-source-form"); end back-ended-function; /// source mapping define defaulted-generic compiled-lambda-source-location (compiled-lambda :: , code-offset :: , #key exact? = #t, line-only? = #t, interactive-only? = #t) => (source-location :: false-or(), exact? :: ) values(#f, #f); end defaulted-generic; define defaulted-generic compiled-lambda-code-offset (compiled-lambda :: , source-location :: , #key exact? = #t, line-only? = #t, interactive-only? = #t) => (code-offset :: false-or()) #f; end defaulted-generic; define defaulted-generic compiled-lambda-mapped-source-locations (compiled-lambda :: , #key line-only? = #t, interactive-only? = #t) => (locations :: ) #[] end defaulted-generic; define defaulted-generic compiled-lambda-mapped-code-offsets (compiled-lambda :: , #key line-only? = #t, interactive-only? = #t) => (code-offsets :: ) #[] end defaulted-generic; /// local variables define defaulted-generic local-variable-argument? (context :: dfmc-, var :: ) => (variable? :: ) #f; // The conservative answer end defaulted-generic; define open generic local-variable-debug-name (context :: dfmc-, var :: ) => (name :: ); define back-ended-function local-variable-debug-name-dylan-name (context :: dfmc-, symbolic-name :: ) => (dylan-name :: ) symbolic-name; end back-ended-function; define defaulted-generic local-variable-type (context :: dfmc-, var :: ) => (type) #t; // indicates canonical Dylan representation. end defaulted-generic; define open generic local-variable-location (context :: dfmc-, var :: ) => (base-reg :: , indirections :: ); define defaulted-generic compiled-lambda-local-variables (compiled-lambda :: , code-offset :: ) => (local-variables :: ) #[]; end defaulted-generic; define defaulted-generic compiled-lambda-frame-boundaries (compiled-lambda :: ) => (start-offsets :: , stop-offsets :: ) values(#[], #[]); end defaulted-generic; /// components define back-ended-function compilation-context-initializer-symbolic-name (context :: dfmc-) => (symbolic-name :: , component-name :: ) no-default-error("compilation-context-initializer-symbolic-name"); end back-ended-function; define function compilation-context-library-name (context :: dfmc-) => (component-name :: false-or()) let name = context.dfmc-library-description-emit-name; if (name) as-lowercase(as(, name)) else #f end; end function; define function settings-executable (#key executable = #f, #all-keys) => (executable :: false-or()) executable end function; define function compilation-context-component-name (context :: dfmc-) => (component-name :: false-or()) apply(settings-executable, context.dfmc-library-description-build-settings) | context.compilation-context-library-name; end function; define function compilation-context-dylan-component-name (context :: dfmc-) => (component-name :: ) let dyl = context.dfmc-library-description-dylan-library; if (dyl) dyl.compilation-context-component-name; else "dylan"; end if; end function; define function compilation-context-runtime-component-name (context :: dfmc-) => (component-name :: ) context.compilation-context-dylan-component-name; end function;