From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756095AbeARNLC (ORCPT ); Thu, 18 Jan 2018 08:11:02 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:43088 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755624AbeARNK7 (ORCPT ); Thu, 18 Jan 2018 08:10:59 -0500 X-Google-Smtp-Source: ACJfBotZNX2st9T7F8Wc4JvP/lf8cYKftf+0GXWUPJZL/4dvIJY08W/Bsyd5GqELTISXKyBfWLnYKw== From: Xi Kangjie To: jan.kiszka@siemens.com, kieran@ksquared.org.uk Cc: linux-kernel@vger.kernel.org, Xi Kangjie Subject: [PATCH] scripts/gdb: fix get_thread_info Date: Thu, 18 Jan 2018 21:01:59 +0000 Message-Id: <20180118210159.17223-1-imxikangjie@gmail.com> X-Mailer: git-send-email 2.13.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since kernel 4.9, the thread_info has been moved into task_struct, no longer locates at the bottom of kernel stack. See commits: - commit c65eacbe290b ("sched/core: Allow putting thread_info into task_struct") - commit 15f4eae70d36 ("x86: Move thread_info into task_struct") Before fix: (gdb) set $current = $lx_current() (gdb) p $lx_thread_info($current) $1 = {flags = 1470918301} (gdb) p $current.thread_info $2 = {flags = 2147483648} After fix: (gdb) p $lx_thread_info($current) $1 = {flags = 2147483648} (gdb) p $current.thread_info $2 = {flags = 2147483648} Signed-off-by: Xi Kangjie --- scripts/gdb/linux/tasks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py index 1bf949c43b76..f6ab3ccf698f 100644 --- a/scripts/gdb/linux/tasks.py +++ b/scripts/gdb/linux/tasks.py @@ -96,6 +96,8 @@ def get_thread_info(task): thread_info_addr = task.address + ia64_task_size thread_info = thread_info_addr.cast(thread_info_ptr_type) else: + if task.type.fields()[0].type == thread_info_type.get_type(): + return task['thread_info'] thread_info = task['stack'].cast(thread_info_ptr_type) return thread_info.dereference() -- 2.13.2