From 89ca918a951fa777d15fc541e9748e1d7a1cc679 Mon Sep 17 00:00:00 2001 From: Philippe Ferreira De Sousa Date: Fri, 22 Sep 2023 15:09:42 -0700 Subject: [PATCH 1/4] Support debug in buidl target --- compiler/compiler.stanza | 2 +- compiler/proj-reader.stanza | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/compiler.stanza b/compiler/compiler.stanza index ae9f5046..826bd61e 100644 --- a/compiler/compiler.stanza +++ b/compiler/compiler.stanza @@ -67,7 +67,7 @@ defn compute-build-settings (projenv:StandardProjEnv, ;Compute build optimization level val build-optimization = optimize?(settings) or optimize(s) ;Compute build optimization level - val build-debug = debug?(settings) + val build-debug = debug?(settings) or debug(s) ;Compute assembly val build-asm = string-or?(original-asm(settings), value?(assembly(s))) ;Compute output diff --git a/compiler/proj-reader.stanza b/compiler/proj-reader.stanza index 2c3e50ca..1d218e3a 100644 --- a/compiler/proj-reader.stanza +++ b/compiler/proj-reader.stanza @@ -126,7 +126,8 @@ defsyntax stanza-projfile : entry?(bs, `ccfiles) entry?(bs, `ccflags) entry?(bs, `flags) - entry?(bs, `optimize, false)) + entry?(bs, `optimize, false) + entry?(bs, `debug, false)) defrule projstmt = (var ?name:#symbol! = ?v:#projvalue!) : VarStmtS0(closest-info(), name, v) @@ -201,6 +202,7 @@ defsyntax stanza-projfile : defrule build-option! = (ccflags #:! ?v:#projvalue!) : `ccflags => v defrule build-option! = (flags #:! ?v:#projvalue!) : `flags => v defrule build-option! = (optimize) : `optimize => true + defrule build-option! = (optimize) : `debug => true ;---------------------------------------------------------- ;--------------------- Error Productions ------------------ From aafb872839613c109ec2aa7718cd72cbe96dfc5f Mon Sep 17 00:00:00 2001 From: Philippe Ferreira De Sousa Date: Mon, 25 Sep 2023 09:54:04 -0700 Subject: [PATCH 2/4] Missing BuildStmt field --- compiler/proj-field-types.stanza | 6 ++++-- compiler/proj-ir.stanza | 1 + compiler/proj-stage0.stanza | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/proj-field-types.stanza b/compiler/proj-field-types.stanza index c5568592..8ffb0ea9 100644 --- a/compiler/proj-field-types.stanza +++ b/compiler/proj-field-types.stanza @@ -161,7 +161,8 @@ defmethod map-fields (s:BuildStmtS0, mapper:Mapper) : map-field(mapper, ccfiles(s), MULTIPLE-PATHS) map-field(mapper, ccflags(s), MULTIPLE-FLAGS) map-field(mapper, flags(s), MULTIPLE-SYMBOLS) - optimize(s)) + optimize(s) + debug(s)) defmethod convert (s:BuildStmtS0, extractor:Extractor) : BuildStmt( name(s) @@ -175,7 +176,8 @@ defmethod convert (s:BuildStmtS0, extractor:Extractor) : extract-tuple(extractor, ccfiles(s), MULTIPLE-PATHS) extract-tuple(extractor, ccflags(s), MULTIPLE-FLAGS) extract-tuple(extractor, flags(s), MULTIPLE-SYMBOLS) - optimize(s)) + optimize(s) + debug(s)) defmethod map-fields (s:SyntaxPackagesDefinedInStmtS0, mapper:Mapper) : SyntaxPackagesDefinedInStmtS0( diff --git a/compiler/proj-ir.stanza b/compiler/proj-ir.stanza index 0b658870..48999fcd 100644 --- a/compiler/proj-ir.stanza +++ b/compiler/proj-ir.stanza @@ -79,6 +79,7 @@ public defstruct BuildStmt <: ProjStmt : ccflags: Tuple> flags: Tuple optimize: True|False + debug: True|False with: printer => true diff --git a/compiler/proj-stage0.stanza b/compiler/proj-stage0.stanza index 9c755d16..f43021f8 100644 --- a/compiler/proj-stage0.stanza +++ b/compiler/proj-stage0.stanza @@ -311,7 +311,7 @@ public defn map (f:ProjItem -> ProjItem, x:?T&ProjItem) -> T : h(dependencies(x)), h(foreign-packages(x)), h(commands(x))) (x:BuildStmtS0) : BuildStmtS0(info(x), name(x), type(x), h(inputs(x)), h(supported-vm-packages(x)), h(pkg(x)), h(output(x)), h(assembly(x)), h(external-dependencies(x)), - h(ccfiles(x)), h(ccflags(x)), h(flags(x)), optimize(x)) + h(ccfiles(x)), h(ccflags(x)), h(flags(x)), optimize(x), debug(x)) (x:SyntaxPackagesDefinedInStmtS0) : SyntaxPackagesDefinedInStmtS0(info(x), packages(x), h(filename(x))) (x:VarStmtS0) : VarStmtS0(info(x), name(x), h(value(x))) (x:ForeignPackageParamsStmtS0) : ForeignPackageParamsStmtS0(info(x), package-manager(x), h(projdir(x)), h(entries(x))) From ce758864fd387945cfbe7ba1ea95d954a8f9b652 Mon Sep 17 00:00:00 2001 From: Philippe Ferreira De Sousa Date: Mon, 25 Sep 2023 11:56:48 -0700 Subject: [PATCH 3/4] Add missing field in BuildStmtS0 --- compiler/proj-stage0.stanza | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/proj-stage0.stanza b/compiler/proj-stage0.stanza index f43021f8..54fa492b 100644 --- a/compiler/proj-stage0.stanza +++ b/compiler/proj-stage0.stanza @@ -81,6 +81,7 @@ public defstruct BuildStmtS0 <: ProjStmt : ccflags: Maybe flags: Maybe optimize: True|False + debug: True|False with: (printer => true) ;Example: From 0b58eeaf33c8cee608382b29c9a640217a7256b6 Mon Sep 17 00:00:00 2001 From: Philippe Ferreira De Sousa Date: Mon, 25 Sep 2023 12:58:37 -0700 Subject: [PATCH 4/4] Fix typo --- compiler/proj-reader.stanza | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/proj-reader.stanza b/compiler/proj-reader.stanza index 1d218e3a..1af11f50 100644 --- a/compiler/proj-reader.stanza +++ b/compiler/proj-reader.stanza @@ -202,7 +202,7 @@ defsyntax stanza-projfile : defrule build-option! = (ccflags #:! ?v:#projvalue!) : `ccflags => v defrule build-option! = (flags #:! ?v:#projvalue!) : `flags => v defrule build-option! = (optimize) : `optimize => true - defrule build-option! = (optimize) : `debug => true + defrule build-option! = (debug) : `debug => true ;---------------------------------------------------------- ;--------------------- Error Productions ------------------