public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/12956] New: Watchpoint on invalid memory addressed is too slow, they should be 'pending' until allocated
@ 2011-07-02 20:41 yuri at tsoft dot com
  2011-07-06  1:29 ` [Bug gdb/12956] " qiyao at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: yuri at tsoft dot com @ 2011-07-02 20:41 UTC (permalink / raw)
  To: gdb-prs

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

           Summary: Watchpoint on invalid memory addressed is too slow,
                    they should be 'pending' until allocated
           Product: gdb
           Version: 7.2
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: yuri@tsoft.com


I am setting a watchpoint for the memory address that is not yet allocated. I
am interested in what happens when it is allocated and later.

'watch' statement sets a software watchpoint, and program instantly becomes
very slow. My guess is that gdb traces the program and checks if the memory is
valid after each instruction. This is wrong.

Since memory can only become valid after mmap or brk/sbrk calls, gdb should
only trace those calls in such situation, which is a 'pending' state for a
watchpoint. Once the memory address becomes valid, gdb should change status to
hardware watchpoint. If the memory is deallocated again (with munmap or
brk/sbrk calls) gdb should change state back to 'pending' and wait for the
possible other allocations.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/12956] Watchpoint on invalid memory addressed is too slow, they should be 'pending' until allocated
  2011-07-02 20:41 [Bug gdb/12956] New: Watchpoint on invalid memory addressed is too slow, they should be 'pending' until allocated yuri at tsoft dot com
@ 2011-07-06  1:29 ` qiyao at gcc dot gnu.org
  2011-07-06  1:38 ` yuri at tsoft dot com
  2011-07-31 19:10 ` ppluzhnikov at google dot com
  2 siblings, 0 replies; 4+ messages in thread
From: qiyao at gcc dot gnu.org @ 2011-07-06  1:29 UTC (permalink / raw)
  To: gdb-prs

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

Yao Qi <qiyao at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qiyao at gcc dot gnu.org

--- Comment #1 from Yao Qi <qiyao at gcc dot gnu.org> 2011-07-06 01:29:22 UTC ---
(In reply to comment #0)
> I am setting a watchpoint for the memory address that is not yet allocated. I
> am interested in what happens when it is allocated and later.
> 
> 'watch' statement sets a software watchpoint, and program instantly becomes
> very slow. My guess is that gdb traces the program and checks if the memory is
> valid after each instruction. This is wrong.
> 

yes, in software watchpoint, gdb will execute program in a single step manner,
and check memory changed or not.  That is why program is slow, but I don't
think it is wrong.

> Since memory can only become valid after mmap or brk/sbrk calls, gdb should
> only trace those calls in such situation, which is a 'pending' state for a
> watchpoint. Once the memory address becomes valid, gdb should change status to
> hardware watchpoint. If the memory is deallocated again (with munmap or
  ^^^^^^^^^^^^^^^^^^^
I guess you mean "software watchpoint" here.

> brk/sbrk calls) gdb should change state back to 'pending' and wait for the
> possible other allocations.

This approach you proposed should speed up watchpoint in some cases.  GDB also
supports debugging ELF without OS on some bare-mental boards, so syscall
mmap/brk/sbrk/ is not available there.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/12956] Watchpoint on invalid memory addressed is too slow, they should be 'pending' until allocated
  2011-07-02 20:41 [Bug gdb/12956] New: Watchpoint on invalid memory addressed is too slow, they should be 'pending' until allocated yuri at tsoft dot com
  2011-07-06  1:29 ` [Bug gdb/12956] " qiyao at gcc dot gnu.org
@ 2011-07-06  1:38 ` yuri at tsoft dot com
  2011-07-31 19:10 ` ppluzhnikov at google dot com
  2 siblings, 0 replies; 4+ messages in thread
From: yuri at tsoft dot com @ 2011-07-06  1:38 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from yuri at tsoft dot com 2011-07-06 01:37:32 UTC ---

> > watchpoint. Once the memory address becomes valid, gdb should change status to
> > hardware watchpoint. If the memory is deallocated again (with munmap or
>   ^^^^^^^^^^^^^^^^^^^
> I guess you mean "software watchpoint" here.

No I meant hardware watchpoint. If requested memory address isn't available,
watchpoint is creates as "Pending". When it becomes available it becomes
hardware watchpoint.

On the platforms where mmap/brk/sbrk aren't available previous behavior should
be preserved.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/12956] Watchpoint on invalid memory addressed is too slow, they should be 'pending' until allocated
  2011-07-02 20:41 [Bug gdb/12956] New: Watchpoint on invalid memory addressed is too slow, they should be 'pending' until allocated yuri at tsoft dot com
  2011-07-06  1:29 ` [Bug gdb/12956] " qiyao at gcc dot gnu.org
  2011-07-06  1:38 ` yuri at tsoft dot com
@ 2011-07-31 19:10 ` ppluzhnikov at google dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ppluzhnikov at google dot com @ 2011-07-31 19:10 UTC (permalink / raw)
  To: gdb-prs

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

Paul Pluzhnikov <ppluzhnikov at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ppluzhnikov at google dot
                   |                            |com
         Resolution|                            |DUPLICATE

--- Comment #3 from Paul Pluzhnikov <ppluzhnikov at google dot com> 2011-07-31 19:08:32 UTC ---
Exact dup of PR10645

*** This bug has been marked as a duplicate of bug 10645 ***

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2011-07-31 19:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-02 20:41 [Bug gdb/12956] New: Watchpoint on invalid memory addressed is too slow, they should be 'pending' until allocated yuri at tsoft dot com
2011-07-06  1:29 ` [Bug gdb/12956] " qiyao at gcc dot gnu.org
2011-07-06  1:38 ` yuri at tsoft dot com
2011-07-31 19:10 ` ppluzhnikov at google 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).