From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28928 invoked by alias); 10 Apr 2012 19:20:14 -0000 Received: (qmail 28917 invoked by uid 22791); 10 Apr 2012 19:20:13 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Apr 2012 19:20:00 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3AJJxcr031269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 10 Apr 2012 15:20:00 -0400 Received: from host2.jankratochvil.net (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q3AJJtlk032009 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Tue, 10 Apr 2012 15:19:58 -0400 Date: Tue, 10 Apr 2012 19:55:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] More suggestive displaced-stepping memory error message Message-ID: <20120410191955.GB31331@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2012-04/txt/msg00191.txt.bz2 Hi, with gdbserver ld-linux-x86-64.so.2 /bin/prog and gdb /bin/prog in non-stop mode during ld.so initialization happens an error as displaced-stepping buffer at /bin/prog's _start is not yet available. Also I think in single-threaded mode displaced-stepping is not useful. But I understand turning off displaced-stepping if inferior has only one thread would be too complicating all the troubleshooting. With all the races and errors I would definitely find this message helpful. It should at least state the error occured for the displaced-stepping buffer, not just generic Cannot access memory at address %s No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu. I may check it in on my own without the "you may want .*" part. Thanks, Jan gdb/ 2012-04-10 Jan Kratochvil Provide more specific displaced-stepping memory error message. * infrun.c (displaced_step_prepare): New variable status. Call target_read_memory instead of read_memory, provide more specific error message. --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1296,6 +1296,7 @@ displaced_step_prepare (ptid_t ptid) ULONGEST len; struct displaced_step_closure *closure; struct displaced_step_inferior_state *displaced; + int status; /* We should never reach this function if the architecture does not support displaced stepping. */ @@ -1356,7 +1357,13 @@ displaced_step_prepare (ptid_t ptid) displaced->step_saved_copy = xmalloc (len); ignore_cleanups = make_cleanup (free_current_contents, &displaced->step_saved_copy); - read_memory (copy, displaced->step_saved_copy, len); + status = target_read_memory (copy, displaced->step_saved_copy, len); + if (status != 0) + throw_error (MEMORY_ERROR, + _("Error accessing memory address %s (%s) for " + "displaced-stepping buffer, you may want to temporarily " + "turn it off if there is only one inferior thread."), + paddress (target_gdbarch, copy), safe_strerror (status)); if (debug_displaced) { fprintf_unfiltered (gdb_stdlog, "displaced: saved %s: ",