From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3703 invoked by alias); 20 Jun 2007 20:26:45 -0000 Received: (qmail 3695 invoked by uid 22791); 20 Jun 2007 20:26:44 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate6.de.ibm.com (HELO mtagate6.de.ibm.com) (195.212.29.155) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 20 Jun 2007 20:26:32 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.8/8.13.8) with ESMTP id l5KKQT64464538 for ; Wed, 20 Jun 2007 20:26:29 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l5KKQTDR450740 for ; Wed, 20 Jun 2007 22:26:29 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l5KKQTgB009607 for ; Wed, 20 Jun 2007 22:26:29 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l5KKQTZo009602; Wed, 20 Jun 2007 22:26:29 +0200 Message-Id: <200706202026.l5KKQTZo009602@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Wed, 20 Jun 2007 22:26:29 +0200 Subject: Re: "maint print registers" crash To: drow@false.org (Daniel Jacobowitz) Date: Wed, 20 Jun 2007 20:26:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20070620194737.GA14838@caradoc.them.org> from "Daniel Jacobowitz" at Jun 20, 2007 03:47:37 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2007-06/txt/msg00403.txt.bz2 Daniel Jacobowitz wrote: > I used to be able to start GDB and print out the current register > layout without needing a target, by "maint print registers". Now that > crashes GDB, because current_regcache is NULL. What do you think - > refuse to dump values and use the gdbarch_descr in that case? Ah, that usage of current_regcache is a bug anyway; I must have overlooked it. current_regcache can now be NULL at other times as well (always after registers_changed () for example); no code should simply use that variable any more. The following patch changes it to use get_current_regcache () instead, which currently always succeeds allocating a register cache (even if we don't have an inferior yet). That gets "maint print registers" immediately after startup working for me. Does this solve your problem? Bye, Ulrich ChangeLog: * regcache.c (regcache_print): Use get_current_regcache () instead of current_regcache. diff -urNp gdb-orig/gdb/regcache.c gdb-head/gdb/regcache.c --- gdb-orig/gdb/regcache.c 2007-06-19 19:12:17.000000000 +0200 +++ gdb-head/gdb/regcache.c 2007-06-20 22:17:39.205744658 +0200 @@ -1114,13 +1114,13 @@ static void regcache_print (char *args, enum regcache_dump_what what_to_dump) { if (args == NULL) - regcache_dump (current_regcache, gdb_stdout, what_to_dump); + regcache_dump (get_current_regcache (), gdb_stdout, what_to_dump); else { struct ui_file *file = gdb_fopen (args, "w"); if (file == NULL) perror_with_name (_("maintenance print architecture")); - regcache_dump (current_regcache, file, what_to_dump); + regcache_dump (get_current_regcache (), file, what_to_dump); ui_file_delete (file); } } -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com