From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11237 invoked by alias); 14 Mar 2017 13:15:03 -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 11182 invoked by uid 89); 14 Mar 2017 13:15:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1497 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Mar 2017 13:15:00 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2EDDeb2007166 for ; Tue, 14 Mar 2017 09:14:59 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 295vx7ghe8-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 14 Mar 2017 09:14:59 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 Mar 2017 13:14:57 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 14 Mar 2017 13:14:55 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v2EDEsu436372598; Tue, 14 Mar 2017 13:14:54 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EAF6F4204D; Tue, 14 Mar 2017 13:14:36 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA2BF42047; Tue, 14 Mar 2017 13:14:36 +0000 (GMT) Received: from oc3748833570.ibm.com (unknown [9.152.213.194]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 14 Mar 2017 13:14:36 +0000 (GMT) Received: by oc3748833570.ibm.com (Postfix, from userid 1000) id 533FAD830FF; Tue, 14 Mar 2017 14:14:54 +0100 (CET) Subject: Re: [PATCH 1/1] [RFC] gdb: corelow: make possible to modify (set) registers for a corefile To: roman.penyaev@profitbricks.com (Roman Pen) Date: Tue, 14 Mar 2017 13:15:00 -0000 From: "Ulrich Weigand" Cc: roman.penyaev@profitbricks.com (Roman Pen), palves@redhat.com (Pedro Alves), dan@codesourcery.com (Daniel Jacobowitz), jan.kratochvil@redhat.com (Jan Kratochvil), gdb-patches@sourceware.org, stefanha@redhat.com (Stefan Hajnoczi) In-Reply-To: <20170314100838.12647-1-roman.penyaev@profitbricks.com> from "Roman Pen" at Mar 14, 2017 11:08:37 AM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17031413-0016-0000-0000-00000455D308 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17031413-0017-0000-0000-000026CC67F2 Message-Id: <20170314131454.533FAD830FF@oc3748833570.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-14_08:,, 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-1702020001 definitions=main-1703140107 X-SW-Source: 2017-03/txt/msg00235.txt.bz2 Roman Pen wrote: > Despite the fact that this is a hairy hack this change eases debugging > of a jmp_buf (setjmp()) and user contexts (makecontext()), which are > highly used in QEMU project as a part of coroutines. > > This change allows setting registers for a corefile, thus QEMU gdb > script (qemu/scripts/qemugdb/coroutine.py) is allowed to investigate > backtrace of a preempted coroutine context. Previously only debugging > of a live process was allowed. > > This patch caches all register on a first attempt to modify register > '(gdb) set $REG = ADDR' and then cached copy is always returned from > get_core_registers(). > > This change should not break previous behaviour if nobody sets any > register, i.e. on each get_core_registers() call registers from a > corefile will be reread. I'm wondering why you need that extra copy of the registers; there already should be a regcache that would be able to hold any modified values. It is not currently possible to actually change those values in the regcache because there is no to_store_registers routine. But simply adding such a routine that does nothing (just like to_prepare_to_store in your patch) should hopefully be enough ... In any case, it would be good to add or extend a test case to verify that this feature is working as intended. Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com