From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2597 invoked by alias); 23 Jul 2004 23:00:10 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 2588 invoked from network); 23 Jul 2004 23:00:09 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 23 Jul 2004 23:00:09 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i6NN09e1011344 for ; Fri, 23 Jul 2004 19:00:09 -0400 Received: from zenia.home.redhat.com (porkchop.devel.redhat.com [172.16.58.2]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i6NN07a14371; Fri, 23 Jul 2004 19:00:07 -0400 To: gdb-patches@sources.redhat.com Subject: RFA: assert that target_fetch_registers did its job From: Jim Blandy Date: Fri, 23 Jul 2004 23:00:00 -0000 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-07/txt/msg00337.txt.bz2 Does anyone see anything wrong with this? Should it be an error, or a warning, instead of an internal error? It seems to me that the error should be furnished by the target-specific code; if target_fetch_registers returns silently, it should have done its job. But thread_db_fetch_registers doesn't follow that assumption. In the threaded case, given any register number, it fetches the gprs, and the fprs, supplies them, and assumes its job is done. It seems to me it sholud be calling register_valid_p (current_regcache, regno) to check that the register's value has really been supplied, and complaining if it hasn't. Or should regcache.c check these conditions and report the warning / error? The behavior being hoped for here is target-independent. 2004-07-21 Jim Blandy * regcache.c (legacy_read_register_gen, regcache_raw_read): Assert that, after calling target_fetch_registers, the register we're reading is cached. Index: gdb/regcache.c =================================================================== RCS file: /cvs/src/src/gdb/regcache.c,v retrieving revision 1.116 diff -c -p -r1.116 regcache.c *** gdb/regcache.c 10 Jul 2004 01:17:52 -0000 1.116 --- gdb/regcache.c 21 Jul 2004 23:04:46 -0000 *************** legacy_read_register_gen (int regnum, ch *** 735,740 **** --- 735,742 ---- if (!register_cached (regnum)) target_fetch_registers (regnum); + gdb_assert (register_cached (regnum)); + memcpy (myaddr, register_buffer (current_regcache, regnum), DEPRECATED_REGISTER_RAW_SIZE (regnum)); } *************** regcache_raw_read (struct regcache *regc *** 768,773 **** --- 770,776 ---- } if (!register_cached (regnum)) target_fetch_registers (regnum); + gdb_assert (register_cached (regnum)); } /* Copy the value directly into the register cache. */ memcpy (buf, register_buffer (regcache, regnum),