[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt a9e5fbfd7a 028/323: Implement line number par
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt a9e5fbfd7a 028/323: Implement line number parsing for disassembled files |
Date: |
Thu, 9 Mar 2023 10:57:56 -0500 (EST) |
branch: externals/beardbolt
commit a9e5fbfd7a77d8acc83ceae610a1fa1be0607923
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>
Implement line number parsing for disassembled files
---
rmsbolt.el | 34 +++++++++++++++++++++++++---------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/rmsbolt.el b/rmsbolt.el
index effa8170d7..24a7d1f93c 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -310,6 +310,10 @@ int main() {
matches)))
;;;;; Filter Functions
+
+;; Filtering functions were more or less lifted from the godbolt compiler
exporter to maintain compatiblity.
+;; https://github.com/mattgodbolt/compiler-explorer/blob/master/lib/asm.js
+
(defun rmsbolt--has-opcode-p (line)
"Check if LINE has opcodes."
(save-match-data
@@ -385,16 +389,22 @@ int main() {
(not (string-match-p regexp func))
t)))
+;; TODO godbolt does not handle dissasembly with filter=off, but we should.
(cl-defun rmsbolt--process-dissasembled-lines (src-buffer asm-lines)
"Process and filter dissasembled ASM-LINES from SRC-BUFFER."
(let* ((result nil)
- (func nil))
+ (func nil)
+ (source-linum nil))
(dolist (line asm-lines)
(cl-tagbody
(when (> (length result) rmsbolt-binary-asm-limit)
(cl-return-from rmsbolt--process-dissasembled-lines
'("Aborting processing due to exceeding the binary limit.")))
- ;; TODO process line numbers
+ (when (string-match rmsbolt-dissas-line line)
+ (setq source-linum (string-to-number (match-string 2 line)))
+ ;; We are just setting a linum, no data here.
+ (go continue))
+
(when (string-match rmsbolt-dissas-label line)
(setq func (match-string 2 line))
(when (rmsbolt--user-func-p src-buffer func)
@@ -404,7 +414,12 @@ int main() {
(rmsbolt--user-func-p src-buffer func))
(go continue))
(when (string-match rmsbolt-dissas-opcode line)
- (push (concat "\t" (match-string 3 line)) result)
+ (let ((line (concat "\t" (match-string 3 line))))
+ ;; Add line text property if available
+ (when source-linum
+ (add-text-properties 0 (length line)
+ `(rmsbolt-src-line ,source-linum) line))
+ (push line result))
(go continue))
continue))
(nreverse result)))
@@ -431,6 +446,7 @@ int main() {
(match-string 2 line))))
(when (string-match rmsbolt-source-stab line)
(pcase (string-to-number (match-string 1 line))
+ ;; http://www.math.utah.edu/docs/info/stabs_11.html
(68
(setq source-linum (match-string 2 line)))
((or 100 132)
@@ -495,12 +511,12 @@ int main() {
(linum 0))
;; Add lines to hashtable
(dolist (line lines)
- (cl-pushnew
- linum
- (gethash
- (get-text-property
- 0 'rmsbolt-src-line line)
- ht))
+ (when-let ((property
+ (get-text-property
+ 0 'rmsbolt-src-line line)))
+ (cl-pushnew
+ linum
+ (gethash property ht)))
(incf linum))
(with-current-buffer src-buffer
(setq-local rmsbolt-line-mapping ht))
- [elpa] branch externals/beardbolt created (now 06fd5a1eee), ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2626732524 003/323: Add filter for assembler directives, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 43f0eac016 004/323: Add support for changing compiler and flags, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 61ccd7a73e 001/323: Initial commit, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt b6127c7f67 007/323: Fix error when not filtering for labels, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 38649b53f2 018/323: Relicense to affero GPL, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f04df12d28 011/323: Add config facility for object dumping, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 74b773d370 026/323: Fix crash on quit for real, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt a9e5fbfd7a 028/323: Implement line number parsing for disassembled files,
ELPA Syncer <=
- [elpa] externals/beardbolt 3b6bb5bd75 030/323: Add basic overlays to view matched lines, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 5ab75b7f56 014/323: Add stubs for dissasembly, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 0a55783f33 029/323: Add skeleton for font-lock, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 8dcd74b511 031/323: Clean up rmsbolt.c by moving starters into helper files, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt aea0966e9d 035/323: Don't add binary asm line data when viewing different files, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt c066da01c4 052/323: Fix ocaml def, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 83e29706f5 005/323: Work on porting used label finder, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 58c77d90c3 008/323: Add outshine comments, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 1545531849 006/323: Add initial implementation of filter, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt d604adae64 015/323: Add initial functions for processing binary asm, ELPA Syncer, 2023/03/09