summaryrefslogtreecommitdiff
path: root/.config/nyxt/objdump.lisp
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-10-16 20:45:23 +0300
committerThanos Apollo <[email protected]>2023-10-16 20:45:23 +0300
commitfdd11abce2a0205bbc96077ca9c4cf1e85e8b98e (patch)
tree3edfe8ed0e07d3c3951676c2543a2f9d2894d0c1 /.config/nyxt/objdump.lisp
parentfe9b8acaa2c05665d51695f3b3ce10b5a6fcc2d7 (diff)
Remove nyxt
Diffstat (limited to '.config/nyxt/objdump.lisp')
-rw-r--r--.config/nyxt/objdump.lisp52
1 files changed, 0 insertions, 52 deletions
diff --git a/.config/nyxt/objdump.lisp b/.config/nyxt/objdump.lisp
deleted file mode 100644
index 341e2ce..0000000
--- a/.config/nyxt/objdump.lisp
+++ /dev/null
@@ -1,52 +0,0 @@
-(in-package #:nyxt-user)
-
-(define-internal-page-command-global objdump (&key (file (uiop:native-namestring
- (prompt1 :prompt "File to disassemble"
- :input (uiop:native-namestring (uiop:getcwd))
- :sources 'nyxt/mode/file-manager:file-source))))
- (buffer (format nil "Objdump of ~a" file))
- "Show disassembly of code sections and contents of data sections in FILE."
- (spinneret:with-html-string
- (let* ((disassembly
- (uiop:run-program (list "objdump" "--demangle" "--debugging" "--disassemble"
- "--line-numbers" "--source" "--visualize-jumps" "--wide" file)
- :output '(:string :stripped t)))
- (lines (member-if (lambda (elem) (uiop:string-prefix-p "Disassembly" elem))
- (mapcar #'str:trim (str:split "
-
-" disassembly :omit-nulls t))))
- (sections (mapcar
- (lambda (string)
- (multiple-value-bind (start end starts ends)
- (ppcre:scan "(\\d+)\\s*([^\\s]*).*" string)
- (subseq string (elt starts 1) (elt ends 1))))
- (remove-if-not
- (lambda (str) (digit-char-p (elt str 0)))
- (remove-if #'uiop:emptyp
- (mapcar #'str:trim
- (serapeum:lines
- (uiop:run-program (list "objdump" "-h" file)
- :output '(:string :stripped t))))))))
- (code-sections (loop for (section code) on lines by #'cddr
- collect (if (uiop:string-prefix-p "Disassembly of section " section)
- (serapeum:slice section 23 -1)
- section)))
- (data-sections (set-difference sections code-sections :test #'string-equal)))
- (loop for (section code) on lines by #'cddr
- collect (:nsection
- :id (prini-to-string (new-id))
- :title (if (uiop:string-prefix-p "Disassembly of section " section)
- (subseq section 23)
- section)
- (:pre code)))
- (loop for data in data-sections
- collect (:nsection
- :id (prini-to-string (new-id))
- :title data
- (:pre (cadr (mapcar
- #'str:trim
- (str:split "
-
-" (uiop:run-program (list "objdump" "--section" data "--full-contents" file)
- :output '(:string :stripped t))
-:omit-nulls t)))))))))