[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt 85d24d69f1 286/323: Add bb-kill-symbol-re opt
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt 85d24d69f1 286/323: Add bb-kill-symbol-re option |
Date: |
Thu, 9 Mar 2023 10:58:42 -0500 (EST) |
branch: externals/beardbolt
commit 85d24d69f14e3da500b3e7acee92e581b624ae23
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Add bb-kill-symbol-re option
* beardbolt.el (bb-kill-symbol-re): New option.
(bb-preserve-weak-symbols): Remove.
(bb-ignore-binary-limit): Remove.
(bb-defines-weak): Remove.
(bb--get): New helper.
(bb--sweeping): Use new helper.
(bb--process-asm): Use bb-kill-symbol-re.
---
beardbolt.el | 71 ++++++++++++++++++++++++--------------------------
starters/beardbolt.cpp | 1 +
2 files changed, 35 insertions(+), 37 deletions(-)
diff --git a/beardbolt.el b/beardbolt.el
index b0b1c3f702..3ee2924292 100644
--- a/beardbolt.el
+++ b/beardbolt.el
@@ -49,6 +49,19 @@
:safe 'booleanp
:group 'beardbolt)
+(defcustom bb-kill-symbol-re nil
+ "Regular expression matching assembly symbols to ignore.
+Currently, this matches on **mangled** symbols.
+
+A somewhat useful value could be
+
+ \\(^_Z[^0-9]*[SP]\\|__gnu\\)
+
+in quotes, of course."
+ :type 'string
+ :safe (lambda (v) (or (booleanp v) (stringp v)))
+ :group 'beardbolt)
+
(defcustom bb-command nil
"The base command to run beardbolt from."
:type 'string
@@ -58,13 +71,7 @@
(defcustom bb-asm-format 'att
"Which output assembly format to use.
-
-The supported values depend highly on the exporter, but typical
-values are: `intel', `att' or nil (for using tool defaults).
-Invalid values will be passed onto the disassembly tools, which
-may throw errors.
-
-If you are not on x86, you most likely want to set this to nil."
+Passed directly to compiler or disassembler."
:type 'string
:safe (lambda (v) (or (booleanp v) (symbolp v) (stringp v)))
:group 'beardbolt)
@@ -78,21 +85,11 @@ If you are not on x86, you most likely want to set this to
nil."
:type 'boolean
:safe 'booleanp
:group 'beardbolt)
-(defcustom bb-preserve-weak-symbols t
- "Whether to preserve library function."
- :type 'boolean
- :safe 'booleanp
- :group 'beardbolt)
(defcustom bb-preserve-comments nil
"Whether to filter comment-only lines."
:type 'boolean
:safe 'booleanp
:group 'beardbolt)
-(defcustom bb-ignore-binary-limit nil
- "Whether to ignore the binary limit. Could hang emacs..."
- :type 'boolean
- :safe 'booleanp
- :group 'beardbolt)
(defcustom bb-demangle t
"Whether to attempt to demangle the resulting assembly."
:type 'boolean
@@ -156,11 +153,6 @@ Useful if you have multiple objdumpers and want to select
between them")
(opt "a") "l" (0+ space)
(group (any ".a-zA-Z_")
(0+ (any "a-zA-Z0-9$_.")))))
-
-(defvar bb-defines-weak (rx bol (0+ space) ".weak"
- (0+ space)
- (group (any ".a-zA-Z_")
- (0+ (any "a-zA-Z0-9$_.")))))
(defvar bb-label-reference (rx (any ".a-zA-Z_")
(0+
(any "a-zA-Z0-9$_."))))
@@ -304,15 +296,15 @@ Returns a list (SPEC ...) where SPEC looks like (WHAT FN
CMD)."
(let* ((regexp bb--hidden-func-c))
(if regexp (not (string-match-p regexp func)) t)))
+(defmacro bb--get (sym) `(buffer-local-value ',sym bb--source-buffer))
+
(defmacro bb--sweeping (&rest forms)
(declare (indent 0)
(debug (&rest (form &rest form))))
(let ((lbp (cl-gensym "lbp-")) (lep (cl-gensym "lep-"))
(preserve-directives (cl-gensym "preserve-directives-"))
(linum (cl-gensym "linum-")))
- `(let ((,preserve-directives (buffer-local-value
- 'bb-preserve-directives
- bb--source-buffer))
+ `(let ((,preserve-directives (bb--get bb-preserve-directives))
(,linum 1))
(goto-char (point-min))
(while (not (eobp))
@@ -361,15 +353,20 @@ Returns a list (SPEC ...) where SPEC looks like (WHAT FN
CMD)."
:preserve))))
(defun bb--process-asm ()
- (let ((used-labels (obarray-make))
- (src-file-name "<stdin>")
- (source-file-map (make-hash-table :test #'eq))
- source-linum
- global-label
- reachable-label
- (preserve-comments (buffer-local-value 'bb-preserve-comments
bb--source-buffer))
- (preserve-labels (buffer-local-value 'bb-preserve-labels
bb--source-buffer))
- (_preserve-weak-symbols (buffer-local-value 'bb-preserve-weak-symbols
bb--source-buffer)))
+ (let* ((used-labels (obarray-make))
+ (maybe-mark-used (lambda (s)
+ (unless (and (bb--get bb-kill-symbol-re)
+ (string-match
+ (bb--get bb-kill-symbol-re)
+ s))
+ (intern s used-labels))))
+ (src-file-name "<stdin>")
+ (source-file-map (make-hash-table :test #'eq))
+ source-linum
+ global-label
+ reachable-label
+ (preserve-comments (bb--get bb-preserve-comments))
+ (preserve-labels (bb--get bb-preserve-labels)))
(bb--sweeping ; first pass
((not (eq (char-after) ?\t))
(cond ((match bb-label-start)
@@ -381,11 +378,11 @@ Returns a list (SPEC ...) where SPEC looks like (WHAT FN
CMD)."
(cond ((match bb-has-opcode)
(when global-label
(while (match bb-label-reference)
- (intern (match-string 0) used-labels)))
+ (funcall maybe-mark-used (match-string 0))))
:preserve)
((and (not preserve-comments) (match bb-comment-only)) :kill)
((match bb-defines-global bb-defines-function-or-object)
- (intern (match-string 1) used-labels))
+ (funcall maybe-mark-used (match-string 1)))
((match bb-source-file-hint)
(puthash (string-to-number (match-string 1))
(or (match-string 3) (match-string 2))
@@ -539,7 +536,7 @@ Argument STR compilation finish status."
(set-window-start output-window old-window-start)
(set-window-point output-window old-point))
(setq bb--line-mappings (reverse bb--line-mappings))
- (when (buffer-local-value 'bb-demangle bb--source-buffer)
+ (when (bb--get bb-demangle)
(shell-command-on-region (point-min) (point-max) "c++filt"
(current-buffer) 'no-mark))
(bb--rainbowize src-buffer))
diff --git a/starters/beardbolt.cpp b/starters/beardbolt.cpp
index 3051771bec..0c425d90c1 100644
--- a/starters/beardbolt.cpp
+++ b/starters/beardbolt.cpp
@@ -5,6 +5,7 @@
// Local Variables:
// beardbolt-command: "g++ -O3"
// rmsbolt-command: "g++ -O3"
+// beardbolt-kill-symbol-re: "\\(^_Z[^0-9]*[SP]\\|__gnu\\)"
// beardbolt-disassemble: nil
// End:
- [elpa] externals/beardbolt 3cace942b8 251/323: Fix buffer selection problems, (continued)
- [elpa] externals/beardbolt 3cace942b8 251/323: Fix buffer selection problems, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 041234b499 241/323: Improve auto-compilation, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2421b29094 255/323: Remove .ert-runner, .gitlab-ci.yml and Cask, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 49e2500be1 259/323: Use shorthands so I can just type bb- instead of beardbolt-, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 58b07a215c 268/323: Simplify some code, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 9f6d1cf10c 269/323: Remove some rmsbolt remnants, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 5deed3972e 276/323: * beardbolt.el (bb--reachable-p, bb--process-asm): Use obarrays., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 291f82a324 266/323: Continue rewriting, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3195997ccd 275/323: * beardbolt.el (bb--synch-relation-overlays): Rework and bugfix., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt a13f8fe7f4 287/323: Reset beardbolt-specific locals before hacking them in, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 85d24d69f1 286/323: Add bb-kill-symbol-re option,
ELPA Syncer <=
- [elpa] externals/beardbolt 10fe7307c3 291/323: Get a better C++ starter example, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 5324775417 321/323: Add beardbolt-shuffle-rainbow option, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 90b5cad9c1 016/323: Finish initial implementation of dissasembly, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt de183bea12 010/323: Add support for c++ and c, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 627dd4c1c9 059/323: Allow for custom asm processing functions, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 978d8290a1 067/323: Add guide on adding new languages, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f911321a02 058/323: Add support for automatically hot recompiling, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 86742e7b76 055/323: Merge branch 'master' of gitlab.com:jgkamat/rmsbolt, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 01f7664eda 060/323: Fix tests, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 36b701d70e 072/323: Fix broken tests, ELPA Syncer, 2023/03/09