From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: drow@false.org (Daniel Jacobowitz)
Cc: gdb-patches@sourceware.org
Subject: Re: "maint print registers" crash
Date: Wed, 20 Jun 2007 20:26:00 -0000 [thread overview]
Message-ID: <200706202026.l5KKQTZo009602@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <20070620194737.GA14838@caradoc.them.org> from "Daniel Jacobowitz" at Jun 20, 2007 03:47:37 PM
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
next prev parent reply other threads:[~2007-06-20 20:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-20 19:47 Daniel Jacobowitz
2007-06-20 20:26 ` Ulrich Weigand [this message]
2007-06-20 20:34 ` Daniel Jacobowitz
2007-06-20 20:52 ` Ulrich Weigand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200706202026.l5KKQTZo009602@d12av02.megacenter.de.ibm.com \
--to=uweigand@de.ibm.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox