Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redebug #1583

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open

Redebug #1583

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4bb2e2d
translate: rearrange
Bike Apr 23, 2024
35ef606
Destroy old compiler debug info mechanism
Bike Apr 23, 2024
6fe8690
define lambda lists for DIBuilder extern defmethods
Bike Apr 24, 2024
4b4df0a
Start on new debug info system
Bike Apr 29, 2024
ef36513
Disable inlining & enable new DWARF generation
Bike Apr 30, 2024
eca6338
integrate arguments processing code into clasp-cleavir more
Bike Apr 30, 2024
24d8feb
arguments processor can use LOOP now
Bike Apr 30, 2024
6a4a437
Delete unused calling convention slot
Bike Apr 30, 2024
3326d48
Allow wrong-number-of-arguments to have just a function's name
Bike Apr 30, 2024
cb6ed18
Move register-save-area handling into translate
Bike May 1, 2024
4571a70
Make the argument processor for-effect
Bike May 1, 2024
1af73df
reorient optional argument processor to not compute nremaining
Bike May 1, 2024
a365f50
Integrate argument processing into clasp-cleavir
Bike May 2, 2024
d30902f
have argument parser return arguments instead of side effecting
Bike May 2, 2024
6fb6158
Have argument processor handle casting
Bike May 4, 2024
6bc98e2
No more separate argument processing for local calls
Bike May 5, 2024
013faca
Add return-type to mangled wrapper names
yitzchak May 5, 2024
41c8c91
Use LLVM's poison instead of undef in most places
Bike May 5, 2024
2f9ed4f
Make backtraces a little better at optimized code
Bike May 8, 2024
d28a1e4
Delete unused code
Bike May 8, 2024
8ef8e97
Move LLVM optimization outside of with-module macro
Bike May 9, 2024
f36d8b6
Make arguments available in optimized function backtraces
Bike May 9, 2024
8f4d012
Actually use LLVM optimizations
Bike May 10, 2024
5fd7f04
Delete inline AST re-sourcing code
Bike May 10, 2024
97617d0
new debuginfo: handle functions with different source files
Bike May 10, 2024
9d37198
Make defaultEntryAddress/arityEntryAddress functions non virtual
Bike May 10, 2024
d3b1ff4
Update Cleavir
Bike May 13, 2024
2a081e7
clasp-cleavir: allow non-object rtypes in come-from
Bike May 13, 2024
64fa5e1
Fix SPI lineno extraction
Bike May 15, 2024
889f73b
Handle logical pathnames in debug info at lower level
Bike May 15, 2024
9a6247f
Use ensure-difile uniformly
Bike May 15, 2024
119fe7e
Remove unused parameters
Bike May 15, 2024
6bce0d9
Restore install path debug info for reproducible builds, hopefully
Bike May 15, 2024
5b40490
Output DWARF info for local variables
Bike May 16, 2024
9d9e41e
Clean up unused code for source pos infos
Bike May 17, 2024
ad39129
Define direct pathname reader for SPIs
Bike May 17, 2024
abd44ac
More source pos info cleanup
Bike May 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Handle logical pathnames in debug info at lower level
rather than explicitly specifying :source or w/e
  • Loading branch information
Bike committed May 16, 2024
commit 889f73b0bf15bbfe57f464e7089ddea82cdbedad
30 changes: 19 additions & 11 deletions src/lisp/kernel/cleavir/debuginfo.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@
(defun make-dibuilder (module)
(llvm-sys:make-dibuilder module))

(defun make-difile (pathname &key (source ";;"))
(let ((filename (file-namestring pathname))
(directory
(namestring
(make-pathname :name nil :type nil :defaults pathname))))
(defun make-difile (pathname)
(let* ((physical (translate-logical-pathname pathname))
(source (if (core:logical-pathname-p pathname)
(format nil ";; LOGICAL-PATHNAME=~a~%"
(namestring pathname))
;; LLVM expects that either all locations have
;; a SOURCE or none of them do, so we always
;; put in something.
";;"))
(filename (file-namestring physical))
(directory
(namestring
(make-pathname :name nil :type nil :defaults physical))))
(llvm-sys:dibuilder/create-file *dibuilder* filename directory
nil source)))

Expand All @@ -30,10 +38,10 @@
;;; pretty important.
(defvar *difile-cache*)

(defun ensure-difile (pathname &key (source ";;"))
(defun ensure-difile (pathname)
(or (gethash pathname *difile-cache*)
(setf (gethash pathname *difile-cache*)
(make-difile pathname :source source))))
(make-difile pathname))))

(defun add-module-di-flags (module)
;; add the flag that defines the Dwarf Version
Expand Down Expand Up @@ -61,7 +69,7 @@
;;; also bind *dbg-current-scope* to a new DIFile.
;;; Afterwords finalize the DIBuilder, and add debug flags to the module.
(defmacro with-debuginfo ((llvm-ir-module
&key (file nil filep) (source ";;"))
&key (path nil pathp))
&body body)
(let ((gbody (gensym "BODY"))
(gmodule (gensym "MODULE")))
Expand All @@ -72,9 +80,9 @@
(*dibuilder* (make-dibuilder ,gmodule))
(*difile-cache* (make-hash-table :test #'equal)))
(unwind-protect
,(if filep
,(if pathp
`(let ((*dbg-current-scope*
(ensure-difile ,file :source ,source)))
(ensure-difile ,path)))
(install-compile-unit *dibuilder*
*dbg-current-scope*)
(,gbody))
Expand Down Expand Up @@ -123,7 +131,7 @@
&key scope (alignment 64))
;; These types are used by the runtime rather than being defined
;; anywhere, so the file spec is a little dumb.
(let ((file (make-difile "-implicit-")) (lineno 0))
(let ((file (make-difile #p"-implicit-")) (lineno 0))
(llvm-sys:create-struct-type
dibuilder scope name file lineno
;; WARNING: This may not work in general,
Expand Down
13 changes: 6 additions & 7 deletions src/lisp/kernel/cleavir/translate.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1871,14 +1871,13 @@ COMPILE-FILE will use the default *clasp-env*."
(pathname
(let ((origin (origin-source (bir:origin bir))))
(if origin
(namestring
(core:file-scope-pathname
(core:file-scope
(core:source-pos-info-file-handle origin))))
"repl-code"))))
(core:file-scope-pathname
(core:file-scope
(core:source-pos-info-file-handle origin)))
#p"repl-code"))))
(cmp::with-module (:module module)
(multiple-value-bind (ordered-raw-constants-list constants-table startup-shutdown-id)
(with-debuginfo (module :file pathname)
(with-debuginfo (module :path pathname)
(multiple-value-prog1
(literal:with-rtv
(translate bir :linkage linkage :abi abi))
Expand Down Expand Up @@ -1952,7 +1951,7 @@ COMPILE-FILE will use the default *clasp-env*."
(eclector.reader:*client* cmp:*cst-client*)
(cst-to-ast:*compiler* 'cl:compile-file))
(with-debuginfo (cmp:*the-module*
:file (namestring cmp::*compile-file-source-debug-pathname*))
:path cmp::*compile-file-source-debug-pathname*)
(loop
;; Required to update the source pos info. FIXME!?
(peek-char t source-sin nil)
Expand Down
2 changes: 1 addition & 1 deletion src/lisp/kernel/cmp/compile-file-parallel.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
(core:*current-source-pos-info* (ast-job-source-pos-info job)))
(with-module (:module module)
(with-make-new-run-all (run-all-function (format nil "module~a" (ast-job-form-index job)))
(clasp-cleavir::with-debuginfo (module :file (namestring cmp::*compile-file-source-debug-pathname*))
(clasp-cleavir::with-debuginfo (module :path cmp::*compile-file-source-debug-pathname*)
(with-literal-table (:id (ast-job-form-index job))
(core:with-memory-ramp (:pattern 'gctools:ramp)
(literal:arrange-thunk-as-top-level
Expand Down