From: Kieran Bingham <kieran@ksquared.org.uk>
To: buzdelabuz2@gmail.com, jan.kiszka@siemens.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] Fix issue with dmesg.py and python 3.X
Date: Wed, 4 May 2016 13:37:47 +0100 [thread overview]
Message-ID: <5729ED1B.2070602@bingham.xyz> (raw)
In-Reply-To: <1462331576-5570-2-git-send-email-buzdelabuz2+git@gmail.com>
On 04/05/16 04:12, buzdelabuz2@gmail.com wrote:
> From: Dom Cote <buzdelabuz2+git@gmail.com>
>
> Replace the addition (+) of 2 python 'memoryview' objects
> with the addition of 2 'bytes' objects, convert the result
> back to memoryview.
I'm a little concerned with the text above not quite sounding like the
code below, as the two 'bytes' objects are not converted back to a
memoryview object, rather the memoryview objects are converted to
'bytes' objects (i.e. the result in log_buf) ...
Could I suggest something like the following commit-log-message? (Also
based on Jan's feedback)
---8<---
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
--->8---
(Only a suggestion of course, if you feel it should say something else
go with that)
>
> Tested with python 3.4 and 2.7
> Tested with gdb 7.7
I have also tested with Python 3.4, 2.7 on GDB 11, and I've tested that
things still work on a wrapped log-buffer too.
Looking good.
The only final note is that because of the way Python 3 prints a
byte-stream, we end up with:
[ 0.000000] b'x86/fpu: Legacy x87 FPU detected.'
instead of:
[ 0.000000] x86/fpu: Legacy x87 FPU detected.
on all of the lines.
I've just done a little digging, and seen we now need to '.decode()' the
line for printing, so I'll post that as a quick patch in reply to this set.
> Signed-off-by: Dom Cote <buzdelabuz2+git@gmail.com>
Tested-by: Kieran Bingham <kieran@bingham.xyz>
Reviewed-by: Kieran Bingham <kieran@bingham.xyz>
> ---
> scripts/gdb/linux/dmesg.py | 7 ++++---
> 1 file 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):
> if log_first_idx < log_next_idx:
> log_buf_2nd_half = -1
> length = log_next_idx - log_first_idx
> - log_buf = inf.read_memory(start, length)
> + log_buf = utils.read_memoryview(inf, start, length).tobytes()
> else:
> log_buf_2nd_half = log_buf_len - log_first_idx
> - log_buf = inf.read_memory(start, log_buf_2nd_half) + \
> - inf.read_memory(log_buf_addr, log_next_idx)
> + a = utils.read_memoryview(inf, start, log_buf_2nd_half)
> + b = utils.read_memoryview(inf, log_buf_addr, log_next_idx)
> + log_buf = a.tobytes() + b.tobytes()
>
> pos = 0
> while pos < log_buf.__len__():
>
--
Regards
Kieran Bingham
next prev parent reply other threads:[~2016-05-04 12:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-04 3:12 [PATCH 1/2] Improve types abstraction for gdb python scripts buzdelabuz2
2016-05-04 3:12 ` [PATCH 2/2] Fix issue with dmesg.py and python 3.X buzdelabuz2
2016-05-04 5:41 ` Jan Kiszka
2016-05-04 12:37 ` Kieran Bingham [this message]
2016-05-04 12:37 ` [PATCH] scripts/gdb: decode bytestream on dmesg for Python3 Kieran Bingham
2016-05-05 14:20 ` Dom Cote
2016-05-04 12:37 ` [PATCH 1/2] Improve types abstraction for gdb python scripts Kieran Bingham
-- strict thread matches above, loose matches on Subject: below --
2016-05-04 3:08 buzdelabuz2
2016-05-04 3:08 ` [PATCH 2/2] Fix issue with dmesg.py and python 3.X buzdelabuz2
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5729ED1B.2070602@bingham.xyz \
--to=kieran@ksquared.org.uk \
--cc=buzdelabuz2@gmail.com \
--cc=jan.kiszka@siemens.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.