From patchwork Tue Jan 29 05:03:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omair Javaid X-Patchwork-Id: 156927 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4230563jaa; Mon, 28 Jan 2019 21:03:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN4RZtC/O1mHi0p87kTKNOunRdbjt8zs0eRg8h7YNX93XVxwzvQB3hPx1oUv5aayLiFq6G/Y X-Received: by 2002:a63:4665:: with SMTP id v37mr22791278pgk.425.1548738232349; Mon, 28 Jan 2019 21:03:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548738232; cv=none; d=google.com; s=arc-20160816; b=RgfpbM1w8jD2fpa6JfHo+vAIRRpqY/RReDDijHXy8XAJOusaJlXUIg1VUQ2uFcedDI VzEUoGWZc1dyioskU+stte+dVOYm8yUl2+i20DG7gRMG83ZxbCr/uhhw8XvEMG+ntgbN D2jhd+OaRyEcQCY/XDMHR/wUlI5gNc7IJaVBI8pcwLQbg3RygA3sE3tpxlYy9aWy0tHp TlGhl97KjjKJaSQaoMpOP83j76plH7SQ1FcfmOk9Prlo2WbEcZPq6qQp8r+oWuGnkvmq i4ZFUwF4wfU+zYFA39TzMGBHq7ckJ4BKf9wzhJGOoJMHP/Vq9pIYrtDpV7+8zDFDuQdh MpVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=6mb0XAIYTb45GPPhXoSs2aj0Tfs2Pq8/UTy0Sr3wWSw=; b=v55DkIKoKGZkwDqSDCt2ZCvC2UhScUA5VjGI4FQm1cbGR+vChgFrXJWMamqLVRa7Kp fbbsSjP3bNZ8MavFkgDF4tWzJ4jMfY5V6WDqzKbLY4Qg0F2vIVEc2Tm46dARCG2aQDKR feg4h+C2RbHqDw+V9G5zKxqK9lbMSy8+BT0A9wgVNOZmbaMEUAH0/s9IgamMcExi0EIQ SkESGau9foaIK0rvuadww7cG9G0UOiJhsHEaMPEnexU0KsExM9r18r6F7BKEnebhZw5m Uc9hJVjuQdIwCkEnAGuz0pptK9swo7E7LQ4Wh0Vke8yHZ7DIyzn/V30fkkU5n8OIA2dn QYjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="WA/n8AZO"; dkim=pass header.i=@linaro.org header.s=google header.b=ClW3LhRR; spf=pass (google.com: domain of gdb-patches-return-153706-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gdb-patches-return-153706-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 44si9822198plc.110.2019.01.28.21.03.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Jan 2019 21:03:52 -0800 (PST) Received-SPF: pass (google.com: domain of gdb-patches-return-153706-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="WA/n8AZO"; dkim=pass header.i=@linaro.org header.s=google header.b=ClW3LhRR; spf=pass (google.com: domain of gdb-patches-return-153706-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gdb-patches-return-153706-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=A24HegV2AnOD9K4nyMR3FXEvNjUIfSgK5mlSqjoG3RAe3HhfXSvK9 d2Fk8+vR1ztf5uBwhuClbghp1PGETZ4vwJVexx3Tx/8z/ygNdcWV3zZ3EvTb1U/P WzvTtL6OJDWUanU+dLsK+5BuSR/NeS+ytLdHwcB3jkmXTLPgDU3Ixw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=wRbcXz43JXVPEyTGRKuq4vGp/uU=; b=WA/n8AZOxrvsLhgK6c4j3p3tB4Iw lBHesj1zDAo2nehnD0OeJbW2EpdyJe0kAOOauKTnW8559qjnU/Om4J0gujpsivXl 6uMvcdzRCozIS5qcSJcz13SYq+ZJMjBEYiheVST0v4wT1EsHfer+38h18m+NIkNj NpzGcrkwFaW/9PI= Received: (qmail 35570 invoked by alias); 29 Jan 2019 05:03:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 35562 invoked by uid 89); 29 Jan 2019 05:03:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=BAYES_00, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=201803, 2018-03, H*Ad:D*co.uk, Kernel X-HELO: mail-wr1-f68.google.com Received: from mail-wr1-f68.google.com (HELO mail-wr1-f68.google.com) (209.85.221.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 29 Jan 2019 05:03:43 +0000 Received: by mail-wr1-f68.google.com with SMTP id p7so20583341wru.0 for ; Mon, 28 Jan 2019 21:03:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=6mb0XAIYTb45GPPhXoSs2aj0Tfs2Pq8/UTy0Sr3wWSw=; b=ClW3LhRRXR3M8k7rLIq8CSVsboV0TXmNtCQsS6bSxQ79MGjdEJmhtyyeI9M2ZFnI+j oP9125NiBcuFkqcs/BBoQYO7iYv9KiB+2zZfdkyB/1mmxwLTGbOrxVqrN5hkyGzR5UVB 4oOlqdk1nyr+4guE5ZhqVCZbqX4Pln7SJYvqg= Return-Path: Received: from localhost.localdomain ([43.251.253.48]) by smtp.gmail.com with ESMTPSA id s1sm170325615wro.9.2019.01.28.21.03.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 21:03:39 -0800 (PST) From: Omair Javaid To: gdb-patches@sourceware.org Cc: palves@redhat.com, prudo@linux.ibm.com, arnez@linux.vnet.ibm.com, peter.griffin@linaro.org, Ulrich.Weigand@de.ibm.com, kieran@linuxembedded.co.uk, Omair Javaid Subject: [RFC PATCH 0/6] Support for Linux kernel thread aware debug Date: Tue, 29 Jan 2019 10:03:13 +0500 Message-Id: <1548738199-9403-1-git-send-email-omair.javaid@linaro.org> X-IsSubscribed: yes This patch series implements linux kernel target which allows linux kernel tasks to be viewed as GDB threads. We have had multiple set of patches submitted over last few years aiming to insert add-ons into GDB for debugging Linux kernel. This patch series builds on top of Linux kernel infrastructure submitted by Philipp Rudo in his various sets of patches aiming to debug Linux kernel dumps. Here is a list of patch series submitted by Philipp Rudo: RFC v5 https://sourceware.org/ml/gdb-patches/2018-03/msg00243.html RFC v4 https://sourceware.org/ml/gdb-patches/2017-06/msg00347.html RFC v3 https://sourceware.org/ml/gdb-patches/2017-03/msg00268.html Changes in this patch series: - Rebase over current GDB - Separate out core-dump support for future - Rework implementation of linux_kernel_ops class for live task management - Implements target class for linux kernel - Add support for AArch64 and Arm targets to debug linux kernel with thread awareness. Limitation: - No support for module debugging - Only support direct mapped kernel addresses. There has been a lot of discussion over mailing list about how to improve debugability of Linux kernel using gdb. These discussion threads eventually ended up with Phillip writing above patch series which unfortunately stalled permanently due to various types of delays. I have listed below some of the past mailing list threads for reference. Andreas Arnez https://gcc.gnu.org/wiki/cauldron2015?action=AttachFile&do=get&target=Andreas+Arnez_+Debugging+Linux+kernel+dumps+with+GDB.pdf Peter Griffin: RFC GDB Linux Awareness analysis https://sourceware.org/ml/gdb-patches/2015-06/msg00040.html Ales Novak: gdb on Linux Kernel dumps (gdb-kdump) https://sourceware.org/ml/gdb/2015-09/msg00014.html Kieran Bingham: GDB Linux Awareness revisited https://www.sourceware.org/ml/gdb/2016-01/msg00028.html Omair Javaid (3): Linux kernel thread awareness Arm target support Linux kernel thread awareness AArch64 target support Linux kernel debug infrastructure and target Linux kernel Philipp Rudo (4): Convert substitute_path_component to C++ Add libiberty/concat styled concat_path function Add scoped_restore_regcache_ptid Linux kernel debug infrastructure and target Linux kernel gdb/Makefile.in | 7 + gdb/aarch64-lk-tdep.c | 135 +++++ gdb/arm-lk-tdep.c | 139 +++++ gdb/auto-load.c | 19 +- gdb/common/common-utils.h | 11 + gdb/configure.tgt | 9 +- gdb/defs.h | 1 + gdb/gdbarch.c | 34 +- gdb/gdbarch.h | 11 +- gdb/gdbarch.sh | 4 + gdb/lk-bitmap.h | 226 ++++++++ gdb/lk-list.h | 200 +++++++ gdb/lk-low.c | 1126 +++++++++++++++++++++++++++++++++++++++ gdb/lk-low.h | 354 ++++++++++++ gdb/osabi.c | 1 + gdb/regcache.h | 21 + gdb/unittests/utils-selftests.c | 10 +- gdb/utils.c | 85 +-- gdb/utils.h | 26 +- 19 files changed, 2364 insertions(+), 55 deletions(-) create mode 100644 gdb/aarch64-lk-tdep.c create mode 100644 gdb/arm-lk-tdep.c create mode 100644 gdb/lk-bitmap.h create mode 100644 gdb/lk-list.h create mode 100644 gdb/lk-low.c create mode 100644 gdb/lk-low.h -- 2.7.4