linux-stable/scripts/gdb/linux
Ilya Leoshkevich ff3f7465ee scripts/gdb: fix debugging modules compiled with hot/cold partitioning
[ Upstream commit 8731acc506 ]

gcc's -freorder-blocks-and-partition option makes it group frequently
and infrequently used code in .text.hot and .text.unlikely sections
respectively.  At least when building modules on s390, this option is
used by default.

gdb assumes that all code is located in .text section, and that .text
section is located at module load address.  With such modules this is no
longer the case: there is code in .text.hot and .text.unlikely, and
either of them might precede .text.

Fix by explicitly telling gdb the addresses of code sections.

It might be tempting to do this for all sections, not only the ones in
the white list.  Unfortunately, gdb appears to have an issue, when
telling it about e.g. loadable .note.gnu.build-id section causes it to
think that non-loadable .note.Linux section is loaded at address 0,
which in turn causes NULL pointers to be resolved to bogus symbols.  So
keep using the white list approach for the time being.

Link: http://lkml.kernel.org/r/20191028152734.13065-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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-05 09:19:44 +01:00
..
.gitignore scripts/gdb: add constants.py to .gitignore 2016-07-15 14:54:27 +09:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
__init__.py scripts/gdb: add empty package initialization script 2015-02-28 09:57:51 -08:00
constants.py.in scripts/gdb: add lx-fdtdump command 2017-07-12 16:26:00 -07:00
cpus.py scripts/gdb: cast CPU numbers to integer 2016-05-23 17:04:14 -07:00
dmesg.py scripts/gdb: lx-dmesg: use explicit encoding=utf8 errors=replace 2017-07-12 16:26:01 -07:00
lists.py scripts/gdb: provide kernel list item generators 2016-05-23 17:04:14 -07:00
modules.py scripts/gdb: support !CONFIG_MODULES gracefully 2016-05-23 17:04:14 -07:00
proc.py scripts/gdb: fix lx-version string output 2019-02-12 19:47:20 +01:00
symbols.py scripts/gdb: fix debugging modules compiled with hot/cold partitioning 2019-12-05 09:19:44 +01:00
tasks.py scripts/gdb/linux/tasks.py: fix get_thread_info 2018-01-19 10:09:41 -08:00
utils.py scripts/gdb: improve types abstraction for gdb python scripts 2016-05-23 17:04:14 -07:00