Repository: Hanaasagi/pymem

Issue:
Not work with LLDB 8.0
### Environment
- Linux archlinux 5.1.16-arch1-1-ARCH
- Python 3.7.3
- lldb version 8.0.0

### How To Reproduce

Run

```Bash
pymem [pid] -d lldb
```

Full Trackback

```
Traceback (most recent call last):
  File "/root/py37/bin/pymem", line 11, in <module>
    load_entry_point('pymem-debugger', 'console_scripts', 'pymem')()
  File "/root/py37/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/root/py37/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/root/py37/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/py37/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/pymem/pymem/cli.py", line 47, in main
    data["objects"] = get_objects(debugger)
  File "/root/pymem/pymem/api.py", line 14, in get_objects
    return debugger.debug_with(code.decode())
  File "/root/pymem/pymem/debugger/base.py", line 63, in debug_with
    return json.loads(info.read())
  File "/usr/lib64/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
```

LLDB stderr

```
warning: ignoring unknown option: --one-line=expr void * $gil = (void *) PyGILState_Ensure()
...
```

I think the problem is due to the incompatible command arguments of LLDB 8.0.

Discussion:

Patch:
diff --git a/pymem/debugger/lldb.py b/pymem/debugger/lldb.py
index 8583c92..b669726 100644
--- a/pymem/debugger/lldb.py
+++ b/pymem/debugger/lldb.py
@@ -17,5 +17,6 @@ class LLDBDebugger(BaseDebugger):
             r"expr (void) PyGILState_Release($gil)",
         ]
         arguments = ["-p", str(self.target_pid), "--batch"]
-        arguments.extend(f"--one-line={command}" for command in lldb_commands)
+        for command in lldb_commands:
+            arguments.extend(['--one-line', command])
         return [self.bin_path] + arguments


Test patch:
diff --git a/tests/test_debugger.py b/tests/test_debugger.py
index 1e5b063..473f011 100644
--- a/tests/test_debugger.py
+++ b/tests/test_debugger.py
@@ -48,9 +48,12 @@ def test_LLDBDebugger_format_command():
         "-p",
         "1",
         "--batch",
-        "--one-line=expr void * $gil = (void *) PyGILState_Ensure()",
-        '--one-line=expr (void) PyRun_SimpleString("import base64;exec(base64.b64decode(\\\'f.write(\'{"status": "OK"}\')\\\').decode());")',
-        "--one-line=expr (void) PyGILState_Release($gil)",
+        "--one-line",
+        "expr void * $gil = (void *) PyGILState_Ensure()",
+        "--one-line",
+        'expr (void) PyRun_SimpleString("import base64;exec(base64.b64decode(\\\'f.write(\'{"status": "OK"}\')\\\').decode());")',
+        "--one-line",
+        "expr (void) PyGILState_Release($gil)",
     ]