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

unsupported listp in LAP file throws off scanner #5

Open
danmcmahill opened this issue Nov 21, 2019 · 0 comments
Open

unsupported listp in LAP file throws off scanner #5

danmcmahill opened this issue Nov 21, 2019 · 0 comments

Comments

@danmcmahill
Copy link

my LAP file has this little bit in in:

20      constant  defalias
21      constant  il-return-car-string
22      constant  <compiled-function>
      args: (element)
    0       varref    element
    1       listp
    2       goto-if-nil 1
    5       varref    element
    6       car
    7       return
    8:1     varref    element
    9       return

23      call      2
24      return

in particular, note the listp on 1. This triggers

elif opname[:-1] in ("list", "concat", "cal"):
if opname.startswith("call"):
count = int(fields[2])
opname = "%s_%d" % (opname, count)
elif opname[-1] == "N":
count = int(fields[2])
opname = "%s_%d" % (opname, count)
else:
count = int(opname[-1])
opname = "%s_%d" % (opname[:-1], count)

and we end up with

  File "/home/dan/src/elisp-decompile/lapdecompile/scanner.py", line 139, in fn_scanner_internal
    count = int(opname[-1])
ValueError: invalid literal for int() with base 10: 'p'

this seems to get past the listp bit but I still have other problems preventing decompiling my files

diff --git a/lapdecompile/scanner.py b/lapdecompile/scanner.py
index e8f25b6..32a772b 100644
--- a/lapdecompile/scanner.py
+++ b/lapdecompile/scanner.py
@@ -127,7 +127,7 @@ class LapScanner:
                     self.fn_scanner_internal(fn_name, fn_type="defun")
                     attr = self.fns[fn_name]
                 tokens.append(Token("CONSTANT", attr, offset.strip(), label=label))
-            elif opname[:-1] in ("list", "concat", "cal"):
+            elif opname[:-1] in ("list", "concat", "cal") and opname != "listp":
                 if opname.startswith("call"):
                     count = int(fields[2])
                     opname = "%s_%d" % (opname, count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant