diff options
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
-rwxr-xr-x | tools/perf/scripts/python/exported-sql-viewer.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py index 0cf30956064a..74ef92f1d19a 100755 --- a/tools/perf/scripts/python/exported-sql-viewer.py +++ b/tools/perf/scripts/python/exported-sql-viewer.py | |||
@@ -2908,9 +2908,13 @@ class LibXED(): | |||
2908 | ok = self.xed_format_context(2, inst.xedp, inst.bufferp, sizeof(inst.buffer), ip, 0, 0) | 2908 | ok = self.xed_format_context(2, inst.xedp, inst.bufferp, sizeof(inst.buffer), ip, 0, 0) |
2909 | if not ok: | 2909 | if not ok: |
2910 | return 0, "" | 2910 | return 0, "" |
2911 | if sys.version_info[0] == 2: | ||
2912 | result = inst.buffer.value | ||
2913 | else: | ||
2914 | result = inst.buffer.value.decode() | ||
2911 | # Return instruction length and the disassembled instruction text | 2915 | # Return instruction length and the disassembled instruction text |
2912 | # For now, assume the length is in byte 166 | 2916 | # For now, assume the length is in byte 166 |
2913 | return inst.xedd[166], inst.buffer.value | 2917 | return inst.xedd[166], result |
2914 | 2918 | ||
2915 | def TryOpen(file_name): | 2919 | def TryOpen(file_name): |
2916 | try: | 2920 | try: |
@@ -2926,9 +2930,14 @@ def Is64Bit(f): | |||
2926 | header = f.read(7) | 2930 | header = f.read(7) |
2927 | f.seek(pos) | 2931 | f.seek(pos) |
2928 | magic = header[0:4] | 2932 | magic = header[0:4] |
2929 | eclass = ord(header[4]) | 2933 | if sys.version_info[0] == 2: |
2930 | encoding = ord(header[5]) | 2934 | eclass = ord(header[4]) |
2931 | version = ord(header[6]) | 2935 | encoding = ord(header[5]) |
2936 | version = ord(header[6]) | ||
2937 | else: | ||
2938 | eclass = header[4] | ||
2939 | encoding = header[5] | ||
2940 | version = header[6] | ||
2932 | if magic == chr(127) + "ELF" and eclass > 0 and eclass < 3 and encoding > 0 and encoding < 3 and version == 1: | 2941 | if magic == chr(127) + "ELF" and eclass > 0 and eclass < 3 and encoding > 0 and encoding < 3 and version == 1: |
2933 | result = True if eclass == 2 else False | 2942 | result = True if eclass == 2 else False |
2934 | return result | 2943 | return result |