aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/gdb/linux/symbols.py
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2019-10-18 23:20:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-10-19 06:32:33 -0400
commit585d730d41120926e3f79a601edad3930fa28366 (patch)
tree630acdfaed1e3cd5449067577b61ca600f21ac76 /scripts/gdb/linux/symbols.py
parentaa5de305c90c995321df452f274fe75b52bd8fcc (diff)
scripts/gdb: fix debugging modules on s390
Currently lx-symbols assumes that module text is always located at module->core_layout->base, but s390 uses the following layout: +------+ <- module->core_layout->base | GOT | +------+ <- module->core_layout->base + module->arch->plt_offset | PLT | +------+ <- module->core_layout->base + module->arch->plt_offset + | TEXT | module->arch->plt_size +------+ Therefore, when trying to debug modules on s390, all the symbol addresses are skewed by plt_offset + plt_size. Fix by adding plt_offset + plt_size to module_addr in load_module_symbols(). Link: http://lkml.kernel.org/r/20191017085917.81791-1-iii@linux.ibm.com Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Cc: Kieran Bingham <kbingham@kernel.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Vasily Gorbik <gor@linux.ibm.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/symbols.py')
-rw-r--r--scripts/gdb/linux/symbols.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py
index 34e40e96dee2..7b7c2fafbc68 100644
--- a/scripts/gdb/linux/symbols.py
+++ b/scripts/gdb/linux/symbols.py
@@ -15,7 +15,7 @@ import gdb
15import os 15import os
16import re 16import re
17 17
18from linux import modules 18from linux import modules, utils
19 19
20 20
21if hasattr(gdb, 'Breakpoint'): 21if hasattr(gdb, 'Breakpoint'):
@@ -116,6 +116,12 @@ lx-symbols command."""
116 module_file = self._get_module_file(module_name) 116 module_file = self._get_module_file(module_name)
117 117
118 if module_file: 118 if module_file:
119 if utils.is_target_arch('s390'):
120 # Module text is preceded by PLT stubs on s390.
121 module_arch = module['arch']
122 plt_offset = int(module_arch['plt_offset'])
123 plt_size = int(module_arch['plt_size'])
124 module_addr = hex(int(module_addr, 0) + plt_offset + plt_size)
119 gdb.write("loading @{addr}: {filename}\n".format( 125 gdb.write("loading @{addr}: {filename}\n".format(
120 addr=module_addr, filename=module_file)) 126 addr=module_addr, filename=module_file))
121 cmdline = "add-symbol-file {filename} {addr}{sections}".format( 127 cmdline = "add-symbol-file {filename} {addr}{sections}".format(