lawrence_danna created this revision.
lawrence_danna added reviewers: JDevlieghere, jasonmolenda.
Herald added a project: LLDB.
When swig fails, all the errors are squished onto one line with `\n` quoting.
It's very hard to read. This will print them out in a more reasonable format.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D67790
Files:
lldb/scripts/Python/prepare_binding_Python.py
Index: lldb/scripts/Python/prepare_binding_Python.py
===================================================================
--- lldb/scripts/Python/prepare_binding_Python.py
+++ lldb/scripts/Python/prepare_binding_Python.py
@@ -231,11 +231,13 @@
swig_stdout, swig_stderr = process.communicate()
return_code = process.returncode
if return_code != 0:
+ swig_stdout = swig_stdout.decode('utf8', errors='replace').rstrip()
+ swig_stderr = swig_stderr.decode('utf8', errors='replace').rstrip()
+ swig_stdout = re.sub(r'^(?=.)', 'stdout: ', swig_stdout,
flags=re.MULTILINE)
+ swig_stderr = re.sub(r'^(?=.)', 'stderr: ', swig_stderr,
flags=re.MULTILINE)
logging.error(
- "swig failed with error code %d: stdout=%s, stderr=%s",
- return_code,
- swig_stdout,
- swig_stderr)
+ "swig failed with error code %d\n%s%s",
+ return_code, swig_stdout, swig_stderr)
logging.error(
"command line:\n%s", ' '.join(command))
sys.exit(return_code)
Index: lldb/scripts/Python/prepare_binding_Python.py
===================================================================
--- lldb/scripts/Python/prepare_binding_Python.py
+++ lldb/scripts/Python/prepare_binding_Python.py
@@ -231,11 +231,13 @@
swig_stdout, swig_stderr = process.communicate()
return_code = process.returncode
if return_code != 0:
+ swig_stdout = swig_stdout.decode('utf8', errors='replace').rstrip()
+ swig_stderr = swig_stderr.decode('utf8', errors='replace').rstrip()
+ swig_stdout = re.sub(r'^(?=.)', 'stdout: ', swig_stdout, flags=re.MULTILINE)
+ swig_stderr = re.sub(r'^(?=.)', 'stderr: ', swig_stderr, flags=re.MULTILINE)
logging.error(
- "swig failed with error code %d: stdout=%s, stderr=%s",
- return_code,
- swig_stdout,
- swig_stderr)
+ "swig failed with error code %d\n%s%s",
+ return_code, swig_stdout, swig_stderr)
logging.error(
"command line:\n%s", ' '.join(command))
sys.exit(return_code)
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits