diff options
Diffstat (limited to 'scripts/gdb/linux/dmesg.py')
-rw-r--r-- | scripts/gdb/linux/dmesg.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py index 927d0d2a3145..f9b92ece7834 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__(): |
@@ -50,10 +51,10 @@ class LxDmesg(gdb.Command): | |||
50 | continue | 51 | continue |
51 | 52 | ||
52 | text_len = utils.read_u16(log_buf[pos + 10:pos + 12]) | 53 | text_len = utils.read_u16(log_buf[pos + 10:pos + 12]) |
53 | text = log_buf[pos + 16:pos + 16 + text_len] | 54 | text = log_buf[pos + 16:pos + 16 + text_len].decode() |
54 | time_stamp = utils.read_u64(log_buf[pos:pos + 8]) | 55 | time_stamp = utils.read_u64(log_buf[pos:pos + 8]) |
55 | 56 | ||
56 | for line in memoryview(text).tobytes().splitlines(): | 57 | for line in text.splitlines(): |
57 | gdb.write("[{time:12.6f}] {line}\n".format( | 58 | gdb.write("[{time:12.6f}] {line}\n".format( |
58 | time=time_stamp / 1000000000.0, | 59 | time=time_stamp / 1000000000.0, |
59 | line=line)) | 60 | line=line)) |