aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-04-20 17:01:11 +0000
committerPedro Alves <palves@redhat.com>2011-04-20 17:01:11 +0000
commitb78974c3b4cea6c98cb8dfd9c0bee59efd45d311 (patch)
treef469d8b9134b15398d79696f3c16c0135b8d4318 /gdb/regcache.c
parent15be625dff82153e4e05018a22c6cd66ba160f70 (diff)
downloadgdb-b78974c3b4cea6c98cb8dfd9c0bee59efd45d311.zip
gdb-b78974c3b4cea6c98cb8dfd9c0bee59efd45d311.tar.gz
gdb-b78974c3b4cea6c98cb8dfd9c0bee59efd45d311.tar.bz2
2011-04-20 Pedro Alves <pedro@codesourcery.com>
gdb/ * regcache.c (get_thread_arch_regcache): If creating a regcache for null_ptid, assume and allow a NULL address space, instead of asking the target for the ptid's address space. * infrun.c (ptid_is_pid): Remove assertion. gdb/testsuite/ * gdb.base/maint.exp: Test that "maint print registers" works without a running program.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index fbdeccc..8b4d77c 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -453,16 +453,25 @@ get_thread_arch_regcache (ptid_t ptid, struct gdbarch *gdbarch)
{
struct regcache_list *list;
struct regcache *new_regcache;
+ struct address_space *aspace;
for (list = current_regcache; list; list = list->next)
if (ptid_equal (list->regcache->ptid, ptid)
&& get_regcache_arch (list->regcache) == gdbarch)
return list->regcache;
- new_regcache = regcache_xmalloc_1 (gdbarch,
- target_thread_address_space (ptid), 0);
+ /* For the benefit of "maint print registers" & co when debugging an
+ executable, allow dumping the regcache even when there is no
+ thread selected (target_thread_address_space internal-errors if
+ no address space is found). Note that normal user commands will
+ fail higher up on the call stack due to no
+ target_has_registers. */
+ aspace = (ptid_equal (null_ptid, ptid)
+ ? NULL
+ : target_thread_address_space (ptid));
+
+ new_regcache = regcache_xmalloc_1 (gdbarch, aspace, 0);
new_regcache->ptid = ptid;
- gdb_assert (new_regcache->aspace != NULL);
list = xmalloc (sizeof (struct regcache_list));
list->regcache = new_regcache;