From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22081 invoked by alias); 8 Sep 2013 15:10:27 -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 22069 invoked by uid 89); 8 Sep 2013 15:10:26 -0000 Received: from mtaout21.012.net.il (HELO mtaout21.012.net.il) (80.179.55.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Sep 2013 15:10:26 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED autolearn=ham version=3.3.2 X-HELO: mtaout21.012.net.il Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MST00400BE6HJ00@a-mtaout21.012.net.il> for gdb-patches@sourceware.org; Sun, 08 Sep 2013 18:10:23 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MST004PYBHA9Y30@a-mtaout21.012.net.il>; Sun, 08 Sep 2013 18:10:22 +0300 (IDT) Date: Sun, 08 Sep 2013 15:10:00 -0000 From: Eli Zaretskii Subject: Re: [PATCH 1/7] Emit a warning when writing to a readonly section and trust_readonly is true In-reply-to: <1378641807-24256-2-git-send-email-yao@codesourcery.com> To: Yao Qi Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <8338pfl57o.fsf@gnu.org> References: <1378432920-7731-1-git-send-email-yao@codesourcery.com> <1378641807-24256-1-git-send-email-yao@codesourcery.com> <1378641807-24256-2-git-send-email-yao@codesourcery.com> X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00267.txt.bz2 > From: Yao Qi > Date: Sun, 8 Sep 2013 20:03:21 +0800 > > If users write a readonly section, such as .text, the contents of the inferior > and of the executable become out of sync. It is better to emit a warning > to ask users to "set trust-readonly-sections off". > > (gdb) set trust-readonly-sections on > (gdb) p /x* (char *) 0x080484c1 = 0xcc > warning: Writing to a readonly section so that the contents in the > inferior and in the executable are out of sync. Please 'set > trust-readonly-sections off'. > $1 = 0xcc This warning got me puzzled: did GDB write to the address or did it not? If it did, why do we need the warning? If it did not, the warning does not say that clearly enough. How about the following instead: (gdb) set trust-readonly-sections on (gdb) p /x* (char *) 0x080484c1 = 0xcc Address is read-only and trust-readonly-sections is set to "on"; set it to "off" and write to a read-only section? (y or n) And then if the user answers "yes", set trust-readonly-sections to off automatically. Isn't this a better UI?