From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49468 invoked by alias); 9 Feb 2017 15:09:02 -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 49453 invoked by uid 89); 9 Feb 2017 15:09:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.0 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Core, Philipp, philipp, linux-kernel 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; Thu, 09 Feb 2017 15:08:58 +0000 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v19F8nkM039906 for ; Thu, 9 Feb 2017 10:08:57 -0500 Received: from e06smtp09.uk.ibm.com (e06smtp09.uk.ibm.com [195.75.94.105]) by mx0a-001b2d01.pphosted.com with ESMTP id 28gqghs69t-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 09 Feb 2017 10:08:57 -0500 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Feb 2017 15:08:55 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp09.uk.ibm.com (192.168.101.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 9 Feb 2017 15:08:53 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 5B3EE2190019; Thu, 9 Feb 2017 15:07:56 +0000 (GMT) Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v19F8qxg1835486; Thu, 9 Feb 2017 15:08:52 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B0CA052043; Thu, 9 Feb 2017 14:07:36 +0000 (GMT) Received: from ThinkPad (unknown [9.152.212.148]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 773C152045; Thu, 9 Feb 2017 14:07:36 +0000 (GMT) Date: Thu, 09 Feb 2017 15:09:00 -0000 From: Philipp Rudo To: Yao Qi Cc: gdb-patches@sourceware.org, peter.griffin@linaro.org, yao.qi@arm.com, arnez@linux.vnet.ibm.com Subject: Re: [RFC 3/7] Add basic Linux kernel support In-Reply-To: <86wpczo6o9.fsf@gmail.com> References: <20170112113217.48852-1-prudo@linux.vnet.ibm.com> <20170112113217.48852-4-prudo@linux.vnet.ibm.com> <20170207105403.GA1630@E107787-LIN> <86wpczo6o9.fsf@gmail.com> 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: 17020915-0036-0000-0000-0000036A09B1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020915-0037-0000-0000-0000150E4DD5 Message-Id: <20170209160851.1a63b508@ThinkPad> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-02-09_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702090137 X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00225.txt.bz2 Hi Yao wow. Thats wonderful. Now we know we can go this way for testing. One minor thing I noticed in your code (which is actually my mistake) > struct mm_struct > {}; > > struct mm_struct init_mm; You don't need those two when you are only interested in thread handling. The mm_struct and init_mm are needed for address translation and actually belong in the commit with module handling ... Fixed it for v3. Thanks a lot Philipp On Thu, 09 Feb 2017 13:05:58 +0000 Yao Qi wrote: > Yao Qi writes: > > > I am playing your first three patches on x86_64 with some hacks. > > I write a small program with the same linux kernel "signature", and > > want GDB treat it as a linux kernel. > > > > I make some progress on writing such small test case, > see the code below. I hacked lk_try_push_target not to do the > sanity check, and not to call lk_try_push_target in > lk_observer_inferior_created, so that I can push this target layer > when I want. > > (gdb) break stop^M > Breakpoint 2 at 0x400711: > file /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.base/linux-kernel.c, > line 104.^M (gdb) continue^M Continuing.^M > ^M > Breakpoint 2, stop () > at /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.base/linux-kernel.c:104^M > 104 {}^M (gdb) PASS: gdb.base/linux-kernel.exp: continue to > breakpoint: stop > > at this point, the list of tasks are set up, switch to linux-kernel > target layer, > > target linux-kernel^M > [New process 8001]^M > (gdb) PASS: gdb.base/linux-kernel.exp: target linux-kernel > maintenance print target-stack^M > The current target stack is:^M > - linux-kernel (linux kernel support)^M > - native (Native process)^M > - exec (Local exec file)^M > - None (None)^M > > It works! In this way, we can test that GDB can successfully parse > the these data structures in Linux kernel without Linux kernel image > at all. > > Then, we can generate a coredump, > > (gdb) generate-core-file > Saved corefile core.9614 > > Remove the hack in lk_observer_inferior_created, so that GDB can > automatically push linux-kernel target layer, > > $ ./gdb ./testsuite/outputs/gdb.base/linux-kernel/linux-kernel ./core.9614 > [New LWP 9614] > [New process 9614] > Core was generated by > `/scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.base/linux-kernel/li'. > Program terminated with signal SIGTRAP, Trace/breakpoint trap. #0 > stop () > at /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.base/linux-kernel.c:104 > 104 {} [Current thread is 1 (PID: 9614*, 0x602010)] (gdb) > maintenance print target-stack The current target stack is: > - linux-kernel (linux kernel support) > - core (Local core dump file) > - exec (Local exec file) > - None (None) > > The next step would be extending the test case to a multi-threaded > program, so that we can create task lists for these threads, and > generate coredump which is similar to the kernel coredump. >