Skip to content

Commit 2acd171

Browse files
iii-igregkh
authored andcommitted
scripts/gdb: fix debugging modules compiled with hot/cold partitioning
[ Upstream commit 8731acc5068eb3f422a45c760d32198175c756f8 ] 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/[email protected] Signed-off-by: Ilya Leoshkevich <[email protected]> Reviewed-by: Jan Kiszka <[email protected]> Cc: Kieran Bingham <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Vasily Gorbik <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 477daab commit 2acd171

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: scripts/gdb/linux/symbols.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def _section_arguments(self, module):
9999
attrs[n]['name'].string(): attrs[n]['address']
100100
for n in range(int(sect_attrs['nsections']))}
101101
args = []
102-
for section_name in [".data", ".data..read_mostly", ".rodata", ".bss"]:
102+
for section_name in [".data", ".data..read_mostly", ".rodata", ".bss",
103+
".text", ".text.hot", ".text.unlikely"]:
103104
address = section_name_to_address.get(section_name)
104105
if address:
105106
args.append(" -s {name} {addr}".format(

0 commit comments

Comments
 (0)