From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69219 invoked by alias); 22 Dec 2016 17:34:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 69200 invoked by uid 89); 22 Dec 2016 17:33:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HTo:U*cagney, HTo:U*drow, UD:configure.tgt, UD:tgt X-HELO: mail-wm0-f48.google.com Received: from mail-wm0-f48.google.com (HELO mail-wm0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Dec 2016 17:33:36 +0000 Received: by mail-wm0-f48.google.com with SMTP id a197so181456603wmd.0 for ; Thu, 22 Dec 2016 09:33:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=eWi5UrIs+ftvftctEYkRJil8Q34CUmiBd9Z0lYt56Dc=; b=nHSJJ8fgcgmNLwMPK5BWWcTgWpUP8EgTWDv6nDiVcpxDOMSki1xsM3q5iiRl+SXMxx K1QmEUWVYqbo+gzsgdHvTwkZK/5CPKbNl7mPa9bN1l5Om6moYnSRLd4LnAzP07CDRjTw FRs9jtdZ/OVLaHlnIyen5f6l/d2mbh7UObEVkQrUTGue0TZHbEGcz/mk6lUR+siHjNRl qhrysyXTuaNOf1t0nprT+HAHP2e7XWFYfYyJZHAi5awWf+GBuwddP+YKUSVcW21+vQ5D jsAQkXSW95KdLPIN1ap+Ismelf+lcFREYc5JMidSgmLw6xkusl5FtX743jAU+840x86W d+Aw== X-Gm-Message-State: AIkVDXJ8u6fpVJ/+eutVl90maK2P6+IE8853piZRBaPqDHg1675WsT/EeREVRiusBMeIq+1O X-Received: by 10.28.226.139 with SMTP id z133mr13428172wmg.139.1482428014490; Thu, 22 Dec 2016 09:33:34 -0800 (PST) Received: from localhost.localdomain (cpc89244-aztw30-2-0-cust4998.18-1.cable.virginm.net. [86.31.179.135]) by smtp.gmail.com with ESMTPSA id o132sm33156178wmo.17.2016.12.22.09.33.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Dec 2016 09:33:33 -0800 (PST) From: Peter Griffin To: gdb-patches@sourceware.org, palves@redhat.com, brobecker@adacore.com, kevinb@redhat.com, cagney@gnu.org, dje@google.com, drow@false.org, kettenis@gnu.org, yao.qi@arm.com, stanshebs@google.com, Ulrich.Weigand@de.ibm.com, elena.zannoni@oracle.com, eliz@gnu.org Cc: peter.griffin@linaro.org, arnez@linux.vnet.ibm.com Subject: [PATCH] Linux kernel thread runtime support Date: Thu, 22 Dec 2016 17:34:00 -0000 Message-Id: <1482427864-4317-1-git-send-email-peter.griffin@linaro.org> X-SW-Source: 2016-12/txt/msg00382.txt.bz2 Hi GDB maintainers, The following patch implements a Linux kernel thread runtime stratum which can be used when using GDB to debug a Linux kernel. For example when connecting to a QEMU GDB stub, or OpenOCD which then communicates with the target via JTAG or SWD. This patch is a refactored version based on the 'Linux kernel debugger' GDB plugin written at STMicroelectronics which used to be packaged with their JTAG debuggers. There has been some discussion previously on the list by myself [1], Kieran [2] and one of the original authors at ST Marc Titinger [3]. This patchset I'm hoping is a lot closer to something which can be upstreamed to GDB project after some discussion about structure with Yao Qi at Linaro Connect, the code has been refactored to be structured much more like the existing upstream thread runtimes (such as ravenscar-thread.c and sparc-ravenscar-thread etc). Since the original email [1] various helper commands have also been migrated into python and merged into the Linux kernel source tree. The GDB python extensions, combined with the linux-kthread GDB thread runtime implemented in this patchset provide a powerful Linux kernel debug solution, and is a working implementation of what Andreas talked about on slide 17 and 18 of his talk at GNU Cauldron [4]. I have currently been testing this patchset using mainline GDB debugging arm-linux kernels in Qemu and via OpenoCD to real hardware. It is straight forward with the current strructure to add new architecture support, and I'm looking at adding PowerPC so I can easily validate big endian targets. What I'm really hoping for now is some patch review on the GDB mailing list from the GDB maintainers and community with a view to getting this functionality which has been talked about for quite a few years finally merged to the upstream GDB project. All patch review feedback greatfully received :) kind regards, Peter. [1] https://cygwin.com/ml/gdb/2015-09/msg00032.html [2] https://www.sourceware.org/ml/gdb/2016-01/msg00028.html [3] https://lists.linaro.org/pipermail/linaro-toolchain/2011-November/001754.html [4] https://gcc.gnu.org/wiki/cauldron2015?action=AttachFile&do=view&target=Andreas+Arnez_+Debugging+Linux+kernel+dumps+with+GDB.pdf Peter Griffin (1): Add Linux kernel thread runtime support. gdb/ChangeLog | 12 + gdb/Makefile.in | 8 +- gdb/arm-linux-kthread.c | 178 +++++ gdb/arm-linux-kthread.h | 27 + gdb/arm-tdep.c | 4 + gdb/configure.tgt | 6 +- gdb/gdbarch.c | 23 + gdb/gdbarch.h | 5 + gdb/gdbarch.sh | 3 + gdb/linux-kthread.c | 1828 +++++++++++++++++++++++++++++++++++++++++++++++ gdb/linux-kthread.h | 223 ++++++ 11 files changed, 2311 insertions(+), 6 deletions(-) create mode 100644 gdb/arm-linux-kthread.c create mode 100644 gdb/arm-linux-kthread.h create mode 100644 gdb/linux-kthread.c create mode 100644 gdb/linux-kthread.h -- 2.7.4