From: Joel Colledge <joel.colledge@linbit.com>
To: Jan Kiszka <jan.kiszka@siemens.com>,
Kieran Bingham <kbingham@kernel.org>
Cc: linux-kernel@vger.kernel.org, Joel Colledge <joel.colledge@linbit.com>
Subject: [PATCH] scripts/gdb: fix lx-dmesg when CONFIG_PRINTK_CALLER is set
Date: Wed, 25 Sep 2019 17:03:08 +0200 [thread overview]
Message-ID: <20190925150308.6609-1-joel.colledge@linbit.com> (raw)
When CONFIG_PRINTK_CALLER is set, struct printk_log contains an
additional member caller_id. As a result, the offset of the log text is
different.
This fixes the following error:
(gdb) lx-dmesg
Python Exception <class 'ValueError'> embedded null character:
Error occurred in Python command: embedded null character
Signed-off-by: Joel Colledge <joel.colledge@linbit.com>
---
scripts/gdb/linux/constants.py.in | 1 +
scripts/gdb/linux/dmesg.py | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in
index 2efbec6b6b8d..3c9794a0bf55 100644
--- a/scripts/gdb/linux/constants.py.in
+++ b/scripts/gdb/linux/constants.py.in
@@ -74,4 +74,5 @@ LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
LX_CONFIG(CONFIG_HIGH_RES_TIMERS)
LX_CONFIG(CONFIG_NR_CPUS)
LX_CONFIG(CONFIG_OF)
+LX_CONFIG(CONFIG_PRINTK_CALLER)
LX_CONFIG(CONFIG_TICK_ONESHOT)
diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py
index 6d2e09a2ad2f..1352680ef731 100644
--- a/scripts/gdb/linux/dmesg.py
+++ b/scripts/gdb/linux/dmesg.py
@@ -14,6 +14,7 @@
import gdb
import sys
+from linux import constants
from linux import utils
@@ -53,7 +54,8 @@ class LxDmesg(gdb.Command):
continue
text_len = utils.read_u16(log_buf[pos + 10:pos + 12])
- text = log_buf[pos + 16:pos + 16 + text_len].decode(
+ text_start = pos + (20 if constants.LX_CONFIG_PRINTK_CALLER else 16)
+ text = log_buf[text_start:text_start + text_len].decode(
encoding='utf8', errors='replace')
time_stamp = utils.read_u64(log_buf[pos:pos + 8])
--
2.17.1
next reply other threads:[~2019-09-25 15:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 15:03 Joel Colledge [this message]
2019-10-10 14:51 ` [PATCH] scripts/gdb: fix lx-dmesg when CONFIG_PRINTK_CALLER is set Joel Colledge
2019-10-10 15:13 ` Jan Kiszka
2019-10-10 19:36 ` Leonard Crestez
2019-10-11 12:24 ` [PATCH v2] " Joel Colledge
2019-10-11 12:38 ` Jan Kiszka
2019-10-11 12:56 ` Joel Colledge
2019-10-11 14:25 ` [PATCH v3] " Joel Colledge
2019-10-11 15:41 ` Jan Kiszka
2019-10-11 12:47 ` [PATCH v2] " Leonard Crestez
2019-10-11 13:01 ` Joel Colledge
2019-10-11 14:20 ` Leonard Crestez
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=20190925150308.6609-1-joel.colledge@linbit.com \
--to=joel.colledge@linbit.com \
--cc=jan.kiszka@siemens.com \
--cc=kbingham@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox