[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt cb0b781e82 143/323: Add rudimentary support f
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt cb0b781e82 143/323: Add rudimentary support for hack/hhvm |
Date: |
Thu, 9 Mar 2023 10:58:25 -0500 (EST) |
branch: externals/beardbolt
commit cb0b781e82d85968dd1ac2d616b19cdeded46a28
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>
Add rudimentary support for hack/hhvm
---
README.org | 2 ++
rmsbolt.el | 72 +++++++++++++++++++++++++++++++++++++++-----------------------
2 files changed, 47 insertions(+), 27 deletions(-)
diff --git a/README.org b/README.org
index ddba8bda2f..8cd6a09254 100644
--- a/README.org
+++ b/README.org
@@ -130,6 +130,8 @@ moment.
** PHP
Requires the [[https://github.com/derickr/vld][vld php extension]] to display
PHP opcodes.
+If you use hack, you will not get source->asm matching or filtering.
+
[[https://i.imgur.com/xBfzaK9.gif][https://i.imgur.com/xBfzaK9.gif]]
** Pony
diff --git a/rmsbolt.el b/rmsbolt.el
index 15c94e2b95..c57d70e519 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -487,6 +487,19 @@ Return value is quoted for passing to the shell."
">" output-filename)
" "))))
+(defun rmsbolt--hack-p (src-buffer)
+ "Return non-nil if SRC-BUFFER should should use hhvm instead of php."
+ (with-current-buffer src-buffer
+ (save-excursion
+ (goto-char (point-min))
+ (re-search-forward (rx "<?hh") nil t))))
+
+(defun rmsbolt--php-default-compile-cmd (src-buffer)
+ "Return the default php compile command for SRC-BUFFER."
+ (if (rmsbolt--hack-p src-buffer)
+ "hh_single_compile"
+ "php"))
+
(cl-defun rmsbolt--php-compile-cmd (&key src-buffer)
"Process a compile command for PHP.
In order to disassemble opcdoes, we need to have the vld.so
@@ -494,9 +507,12 @@ extension to php on.
https://github.com/derickr/vld"
(rmsbolt--with-files
src-buffer
- (concat (buffer-local-value 'rmsbolt-command src-buffer)
- " -dvld.active=1 -dvld.execute=0 -dvld.verbosity=1 "
- src-filename " 2> " output-filename " > /dev/null")))
+ (if (rmsbolt--hack-p src-buffer)
+ (concat (buffer-local-value 'rmsbolt-command src-buffer)
+ " " src-filename " > " output-filename)
+ (concat (buffer-local-value 'rmsbolt-command src-buffer)
+ " -dvld.active=1 -dvld.execute=0 -dvld.verbosity=1 "
+ src-filename " 2> " output-filename " > /dev/null"))))
(cl-defun rmsbolt--hs-compile-cmd (&key src-buffer)
"Process a compile command for ghc."
@@ -614,7 +630,7 @@ https://github.com/derickr/vld"
:objdumper 'objdump
:compile-cmd-function #'rmsbolt--pony-compile-cmd))
(php-mode
- . ,(make-rmsbolt-lang :compile-cmd "php"
+ . ,(make-rmsbolt-lang :compile-cmd #'rmsbolt--php-default-compile-cmd
:supports-asm t
:supports-disass nil
:compile-cmd-function #'rmsbolt--php-compile-cmd
@@ -910,29 +926,31 @@ Argument SRC-BUFFER source buffer."
(push line result))))
(nreverse result)))
-(cl-defun rmsbolt--process-php-bytecode (_src-buffer asm-lines)
- (let ((state 'useless)
- (current-line nil)
- (result nil))
- (dolist (line asm-lines)
- (cl-case state
- ((text)
- (push line result)
- (when (string-match "^-+$" line)
- (setq state 'asm)))
- ((asm)
- (cond
- ((string-empty-p line) (setq state 'useless))
- ((string-match "^ *\\([0-9]+\\) +[0-9]+" line)
- (setq current-line (string-to-number (match-string 1 line)))
- (add-text-properties 0 (length line) `(rmsbolt-src-line
,current-line) line))
- (t
- (add-text-properties 0 (length line) `(rmsbolt-src-line
,current-line) line)))
- (push line result))
- (otherwise
- (when (string-match "^filename:" line)
- (setq state 'text)))))
- (nreverse result)))
+(cl-defun rmsbolt--process-php-bytecode (src-buffer asm-lines)
+ (if (rmsbolt--hack-p src-buffer)
+ asm-lines
+ (let ((state 'useless)
+ (current-line nil)
+ (result nil))
+ (dolist (line asm-lines)
+ (cl-case state
+ ((text)
+ (push line result)
+ (when (string-match "^-+$" line)
+ (setq state 'asm)))
+ ((asm)
+ (cond
+ ((string-empty-p line) (setq state 'useless))
+ ((string-match "^ *\\([0-9]+\\) +[0-9]+" line)
+ (setq current-line (string-to-number (match-string 1 line)))
+ (add-text-properties 0 (length line) `(rmsbolt-src-line
,current-line) line))
+ (t
+ (add-text-properties 0 (length line) `(rmsbolt-src-line
,current-line) line)))
+ (push line result))
+ (otherwise
+ (when (string-match "^filename:" line)
+ (setq state 'text)))))
+ (nreverse result))))
(cl-defun rmsbolt--process-python-bytecode (_src-buffer asm-lines)
(let ((source-linum nil)
- [elpa] externals/beardbolt 02a0bfbcdb 313/323: Add `beardbolt-ccj-extra-flags` option, (continued)
- [elpa] externals/beardbolt 02a0bfbcdb 313/323: Add `beardbolt-ccj-extra-flags` option, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 6a71a16619 319/323: Simplify rainbow-clearing logic, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt e403331350 322/323: * beardbolt.el (bb--synch-relation-overlays): Fix bug., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4a6f289c94 002/323: Add very basic compilation of c files, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ac893146e3 019/323: Force dissasembly if we don't support asm, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f30a05624d 051/323: Add support for parsing .file directives, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 865d5a8c1a 111/323: Clean up CI config, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 7f61815c17 121/323: Try to fix bytecode issues, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt e517cd4dbc 142/323: Remove unneeded disass-hidden-funcs overrides, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f89875215b 128/323: Fix byte-compilation warnings, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt cb0b781e82 143/323: Add rudimentary support for hack/hhvm,
ELPA Syncer <=
- [elpa] externals/beardbolt 4f86bae37e 144/323: Add rmsbolt-asm-format for toggling between asm formats., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 20fa6a76e0 150/323: Clear out unset or nil variables after setting them via defaults, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt fc712fe954 147/323: Fix typo in readme, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 56f8fd2037 148/323: Add additional salespitch, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 0c19afca2d 157/323: Simplify d support, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f7aab87454 162/323: Fix README link, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 097abb56de 154/323: Fix tests, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 9fb117d6c9 159/323: Add docs for D language, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 1916179672 166/323: Add support for Zig, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 8cf49aeac6 167/323: Add zig starter, ELPA Syncer, 2023/03/09