From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86342 invoked by alias); 15 Feb 2017 16:45:35 -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 86326 invoked by uid 89); 15 Feb 2017 16:45:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=gdbarch.sh, UD:gdbarch.sh, gdbarchsh, beneath X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 15 Feb 2017 16:45:24 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1FGjDRu071414 for ; Wed, 15 Feb 2017 11:45:23 -0500 Received: from e06smtp09.uk.ibm.com (e06smtp09.uk.ibm.com [195.75.94.105]) by mx0a-001b2d01.pphosted.com with ESMTP id 28mq9gam5s-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 15 Feb 2017 11:45:22 -0500 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 15 Feb 2017 16:45:20 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp09.uk.ibm.com (192.168.101.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 15 Feb 2017 16:45:14 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id A9EEB1B08023; Wed, 15 Feb 2017 16:48:10 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1FGjDSu8716772; Wed, 15 Feb 2017 16:45:13 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E736AA4053; Wed, 15 Feb 2017 16:45:10 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7FDF2A4057; Wed, 15 Feb 2017 16:45:10 +0000 (GMT) Received: from ThinkPad (unknown [9.152.212.148]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 15 Feb 2017 16:45:10 +0000 (GMT) Date: Wed, 15 Feb 2017 16:45:00 -0000 From: Philipp Rudo To: Peter Griffin Cc: 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, arnez@linux.vnet.ibm.com Subject: Re: [PATCH] Linux kernel thread runtime support In-Reply-To: <1482427864-4317-1-git-send-email-peter.griffin@linaro.org> References: <1482427864-4317-1-git-send-email-peter.griffin@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021516-0036-0000-0000-0000036DBE1E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021516-0037-0000-0000-000015201760 Message-Id: <20170215174512.3ee9c6a4@ThinkPad> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-02-15_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=8 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702150160 X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00420.txt.bz2 Hi Peter, while looking into your patch in more detail, I found some problems with your code. In particular I dislike your general approach using private_thread_info, since the remote-target already uses this field inside thread_info. Thus "forcibly" adding your own version of private_thread_info, like you do, can lead to undefined behavior. For example remote_stopped_by_sw_breakpoint requires information from private_tread_info and won't work reliably. Even worse, remote_resume you call by passing target_resume to the target beneath writes (via resume_clear_thread_private_info) to the private_thread_info thus causing a memory corruption. With your and the remote-target being that interlaced, I don't think it's possible to separate them cleanly. That's why I see no other way than allowing each target to manage its own thread list. Philipp On Thu, 22 Dec 2016 17:31:03 +0000 Peter Griffin wrote: > 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 >