]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/scripts-gdb-fix-lx-version-string-output.patch
autosel patches for 4.14
[thirdparty/kernel/stable-queue.git] / queue-4.14 / scripts-gdb-fix-lx-version-string-output.patch
1 From a1377270001749d1e58b7ebdb298d8971790f405 Mon Sep 17 00:00:00 2001
2 From: Du Changbin <changbin.du@gmail.com>
3 Date: Thu, 3 Jan 2019 15:28:27 -0800
4 Subject: scripts/gdb: fix lx-version string output
5
6 [ Upstream commit b058809bfc8faeb7b7cae047666e23375a060059 ]
7
8 A bug is present in GDB which causes early string termination when
9 parsing variables. This has been reported [0], but we should ensure
10 that we can support at least basic printing of the core kernel strings.
11
12 For current gdb version (has been tested with 7.3 and 8.1), 'lx-version'
13 only prints one character.
14
15 (gdb) lx-version
16 L(gdb)
17
18 This can be fixed by casting 'linux_banner' as (char *).
19
20 (gdb) lx-version
21 Linux version 4.19.0-rc1+ (changbin@acer) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #21 SMP Sat Sep 1 21:43:30 CST 2018
22
23 [0] https://sourceware.org/bugzilla/show_bug.cgi?id=20077
24
25 [kbingham@kernel.org: add detail to commit message]
26 Link: http://lkml.kernel.org/r/20181111162035.8356-1-kieran.bingham@ideasonboard.com
27 Fixes: 2d061d999424 ("scripts/gdb: add version command")
28 Signed-off-by: Du Changbin <changbin.du@gmail.com>
29 Signed-off-by: Kieran Bingham <kbingham@kernel.org>
30 Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
31 Cc: Jan Kiszka <jan.kiszka@siemens.com>
32 Cc: Jason Wessel <jason.wessel@windriver.com>
33 Cc: Daniel Thompson <daniel.thompson@linaro.org>
34 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
35 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
36 Signed-off-by: Sasha Levin <sashal@kernel.org>
37 ---
38 scripts/gdb/linux/proc.py | 2 +-
39 1 file changed, 1 insertion(+), 1 deletion(-)
40
41 diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py
42 index 086d27223c0c..0aebd7565b03 100644
43 --- a/scripts/gdb/linux/proc.py
44 +++ b/scripts/gdb/linux/proc.py
45 @@ -41,7 +41,7 @@ class LxVersion(gdb.Command):
46
47 def invoke(self, arg, from_tty):
48 # linux_banner should contain a newline
49 - gdb.write(gdb.parse_and_eval("linux_banner").string())
50 + gdb.write(gdb.parse_and_eval("(char *)linux_banner").string())
51
52 LxVersion()
53
54 --
55 2.19.1
56