archive mirror
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <>
To: Jan Kiszka <>,
	Kieran Bingham <>,,
Cc: Heiko Carstens <>,
	Vasily Gorbik <>,
	Ilya Leoshkevich <>
Subject: [PATCH] scripts/gdb: fix debugging modules compiled with hot/cold partitioning
Date: Mon, 28 Oct 2019 16:27:34 +0100	[thread overview]
Message-ID: <> (raw)

gcc's -freorder-blocks-and-partition option makes it group frequently
and infrequently used code in 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 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 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.

Signed-off-by: Ilya Leoshkevich <>
 scripts/gdb/linux/ | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/gdb/linux/ b/scripts/gdb/linux/
index 7b7c2fafbc68..be984aa29b75 100644
--- a/scripts/gdb/linux/
+++ b/scripts/gdb/linux/
@@ -99,7 +99,8 @@ lx-symbols command."""
             attrs[n]['name'].string(): attrs[n]['address']
             for n in range(int(sect_attrs['nsections']))}
         args = []
-        for section_name in [".data", ".data..read_mostly", ".rodata", ".bss"]:
+        for section_name in [".data", ".data..read_mostly", ".rodata", ".bss",
+                             ".text", "", ".text.unlikely"]:
             address = section_name_to_address.get(section_name)
             if address:
                 args.append(" -s {name} {addr}".format(

             reply	other threads:[~2019-10-28 15:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 15:27 Ilya Leoshkevich [this message]
2019-10-30 18:29 ` [PATCH] scripts/gdb: fix debugging modules compiled with hot/cold partitioning Jan Kiszka
2019-10-31  9:56   ` Ilya Leoshkevich

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).