aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/gdb/linux
diff options
context:
space:
mode:
authorDom Cote <buzdelabuz2+git@gmail.com>2016-05-23 19:25:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-23 20:04:14 -0400
commitd21d5b9eb0e1e492232a3b56d0cc03bcdaa7ee17 (patch)
tree795756b6102d60b3fff7db6b9b000fb6b4f8503e /scripts/gdb/linux
parent321958d9710c33e74ec98c0f3c96aa2a5dbe3008 (diff)
scripts/gdb: fix issue with dmesg.py and python 3.X
When built against Python 3, GDB differs in the return type for its read_memory function, causing the lx-dmesg command to fail. Now that we have an improved read_16() we can use the new read_memoryview() abstraction to make lx-dmesg return valid data on both current Python APIs Tested with python 3.4 and 2.7 Tested with gdb 7.7 Link: http://lkml.kernel.org/r/28477b727ff7fe3101fd4e426060e8a68317a639.1462865983.git.jan.kiszka@siemens.com Signed-off-by: Dom Cote <buzdelabuz2+git@gmail.com> [kieran@bingham.xyz: Adjusted commit log to better reflect code changes] Tested-by: Kieran Bingham <kieran@bingham.xyz> (Py2.7,Py3.4,GDB10) Signed-off-by: Kieran Bingham <kieran@bingham.xyz> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/gdb/linux')
-rw-r--r--scripts/gdb/linux/dmesg.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py
index 927d0d2a3145..04d6719067f2 100644
--- a/scripts/gdb/linux/dmesg.py
+++ b/scripts/gdb/linux/dmesg.py
@@ -33,11 +33,12 @@ class LxDmesg(gdb.Command):
33 if log_first_idx < log_next_idx: 33 if log_first_idx < log_next_idx:
34 log_buf_2nd_half = -1 34 log_buf_2nd_half = -1
35 length = log_next_idx - log_first_idx 35 length = log_next_idx - log_first_idx
36 log_buf = inf.read_memory(start, length) 36 log_buf = utils.read_memoryview(inf, start, length).tobytes()
37 else: 37 else:
38 log_buf_2nd_half = log_buf_len - log_first_idx 38 log_buf_2nd_half = log_buf_len - log_first_idx
39 log_buf = inf.read_memory(start, log_buf_2nd_half) + \ 39 a = utils.read_memoryview(inf, start, log_buf_2nd_half)
40 inf.read_memory(log_buf_addr, log_next_idx) 40 b = utils.read_memoryview(inf, log_buf_addr, log_next_idx)
41 log_buf = a.tobytes() + b.tobytes()
41 42
42 pos = 0 43 pos = 0
43 while pos < log_buf.__len__(): 44 while pos < log_buf.__len__():