public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "qiyao at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/12956] Watchpoint on invalid memory addressed is too slow, they should be 'pending' until allocated
Date: Wed, 06 Jul 2011 01:29:00 -0000	[thread overview]
Message-ID: <bug-12956-4717-aDZ28rMa5I@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-12956-4717@http.sourceware.org/bugzilla/>

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.


  reply	other threads:[~2011-07-06  1:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-02 20:41 [Bug gdb/12956] New: " yuri at tsoft dot com
2011-07-06  1:29 ` qiyao at gcc dot gnu.org [this message]
2011-07-06  1:38 ` [Bug gdb/12956] " yuri at tsoft dot com
2011-07-31 19:10 ` ppluzhnikov at google dot com

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=bug-12956-4717-aDZ28rMa5I@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).