public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/11557] New: Stale register and frame info in non-stop/async modes, just after resuming a thread
@ 2010-04-29 14:34 pedro at codesourcery dot com
  2010-04-29 14:34 ` [Bug gdb/11557] " pedro at codesourcery dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pedro at codesourcery dot com @ 2010-04-29 14:34 UTC (permalink / raw)
  To: gdb-prs

In non-stop/async modes, just after a thread is resumed GDB still
shows the thread's register state as if it was still stopped were it
was before you resumed it.  The bug is present in 7.0, 7.1, and
mainline.  Vis, with GDB 7.0:

 $gdb-7.0 -q -ex "set target-async 1" -ex "set non-stop 1" -ex "set pagination
off" stale-regcache
 Reading symbols from stale-regcache...done.
 (gdb) start
 Temporary breakpoint 1 at 0x400563: file ns-stale-regcache.c, line 24.
 Starting program: stale-regcache

 Temporary breakpoint 1, main (argc=1, argv=0x7fffffffe0b8) at stale-regcache.c:24
 24        volatile int my_number = 1;
 (gdb) p $pc
 $1 = (void (*)()) 0x400563 <main+15>

This is where it gets interesting:

 (gdb) c&
 Continuing.
 (gdb) info threads
 * 1 process 11017  (running)
 (gdb) p $pc
 $2 = (void (*)()) 0x400563 <main+15>
 (gdb) frame
# 0  main (argc=Cannot access memory at address 0x7fffffffdfbc) at
stale-regcache.c:24
 24        volatile int my_number = 1;

That PC and frame is of course, stale and bogus.  Notice how we failed
to read ARGC (because the thread is actually running).

-- 
           Summary: Stale register and frame info in non-stop/async modes,
                    just after resuming a thread
           Product: gdb
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: pedro at codesourcery dot com
                CC: gdb-prs at sourceware dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=11557

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/11557] Stale register and frame info in non-stop/async modes, just after resuming a thread
  2010-04-29 14:34 [Bug gdb/11557] New: Stale register and frame info in non-stop/async modes, just after resuming a thread pedro at codesourcery dot com
@ 2010-04-29 14:34 ` pedro at codesourcery dot com
  2010-04-29 14:35 ` pedro at codesourcery dot com
  2010-04-29 16:45 ` pedro at codesourcery dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pedro at codesourcery dot com @ 2010-04-29 14:34 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware dot|pedro at codesourcery dot
                   |org                         |com
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1


http://sourceware.org/bugzilla/show_bug.cgi?id=11557

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/11557] Stale register and frame info in non-stop/async modes, just after resuming a thread
  2010-04-29 14:34 [Bug gdb/11557] New: Stale register and frame info in non-stop/async modes, just after resuming a thread pedro at codesourcery dot com
  2010-04-29 14:34 ` [Bug gdb/11557] " pedro at codesourcery dot com
@ 2010-04-29 14:35 ` pedro at codesourcery dot com
  2010-04-29 16:45 ` pedro at codesourcery dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pedro at codesourcery dot com @ 2010-04-29 14:35 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From pedro at codesourcery dot com  2010-04-29 14:35 -------
The problem is that we ended up with a stale regcache after resuming
the thread.  Any stop (internal or visible to the user) would flush
the cache, and so would a few user commands, like "info threads", but
iff you have more than one thread.

The always-works workaround, is to force a register cache
flush with "flushregs":

 (gdb) flushregs
 Register cache flushed.
 (gdb) info threads
 * 1 process 11017  (running)
 (gdb) p $pc
 Target is executing.
 (gdb) frame
 No stack.

("No stack" is bit of a lie in this case, but better than stale info!)


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=11557

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/11557] Stale register and frame info in non-stop/async modes, just after resuming a thread
  2010-04-29 14:34 [Bug gdb/11557] New: Stale register and frame info in non-stop/async modes, just after resuming a thread pedro at codesourcery dot com
  2010-04-29 14:34 ` [Bug gdb/11557] " pedro at codesourcery dot com
  2010-04-29 14:35 ` pedro at codesourcery dot com
@ 2010-04-29 16:45 ` pedro at codesourcery dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pedro at codesourcery dot com @ 2010-04-29 16:45 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2010-04-29 16:33 -------
Subject: Bug 11557

CVSROOT:	/cvs/src
Module name:	src
Changes by:	palves@sourceware.org	2010-04-29 16:33:16

Modified files:
	gdb            : ChangeLog regcache.c regcache.h target.c 
	gdb/testsuite  : ChangeLog 
Added files:
	gdb/testsuite/gdb.mi: mi-ns-stale-regcache.exp 
	                      ns-stale-regcache.c 

Log message:
	PR gdb/11557
	
	gdb/
	* regcache.c (registers_changed): Rename to ...
	(registers_changed_ptid): ... this, and only delete register cache
	entries matching the ptid filter argument.
	(registers_changed): Reimplement on top of registers_changed_ptid.
	* regcache.h (registers_changed_ptid): Declare.
	* target.c (target_resume): Flush register caches.
	
	gdb/testsuite/
	* gdb.mi/mi-ns-stale-regcache.exp, gdb.mi/ns-stale-regcache.c: New
	files.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11699&r2=1.11700
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/regcache.c.diff?cvsroot=src&r1=1.177&r2=1.178
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/regcache.h.diff?cvsroot=src&r1=1.66&r2=1.67
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/target.c.diff?cvsroot=src&r1=1.247&r2=1.248
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2258&r2=1.2259
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.mi/ns-stale-regcache.c.diff?cvsroot=src&r1=NONE&r2=1.1


------- Additional Comments From pedro at codesourcery dot com  2010-04-29 16:45 -------
Fix checked in.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|7.1                         |7.2


http://sourceware.org/bugzilla/show_bug.cgi?id=11557

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-29 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-29 14:34 [Bug gdb/11557] New: Stale register and frame info in non-stop/async modes, just after resuming a thread pedro at codesourcery dot com
2010-04-29 14:34 ` [Bug gdb/11557] " pedro at codesourcery dot com
2010-04-29 14:35 ` pedro at codesourcery dot com
2010-04-29 16:45 ` pedro at codesourcery dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).