Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Jim Blandy <jimb@codesourcery.com>,  gdb-patches@sources.redhat.com
Subject: Re: [RFA] Don't reset watchpoint block on solib load.
Date: Thu, 29 Nov 2007 07:04:00 -0000	[thread overview]
Message-ID: <200711291003.58932.vladimir@codesourcery.com> (raw)
In-Reply-To: <ur6i91xx7.fsf@gnu.org>

On Thursday 29 November 2007 07:24:36 Eli Zaretskii wrote:
> > Cc: gdb-patches@sources.redhat.com
> > From: Jim Blandy <jimb@codesourcery.com>
> > Date: Wed, 28 Nov 2007 14:18:06 -0800
> > 
> > Now, if I later unload libx.so, the watchpoint should delete itself
> > with an appropriate message, just as a watchpoint on a stack variable
> > does when its frame is popped --- when a shared library is unloaded,
> > that ends the lifetimes of the variables it defines, just as exiting a
> > block ends the lifetimes of the variables defined in the block.
> 
> Actually, a more useful behavior would be to disable the watchpoint in
> this case, and reenable it (and, possibly, re-parse the expression) if
> the library gets loaded again.

This is probably good behaviour, indeed. Or maybe we should not
disable watchpoint, but mark it as pending, in the same sense of
"user wanted it to be enabled, but it won't trigger until a shared
lib is loaded" that is used for ordinary watchpoints.

But before we even get to that, we need to fix all the existing
bugs with watchpoints/solib interaction. For example, currently
a watchpoint on a global variable in shared library wedges gdb
if that shared library is unloaded:

	Old value = 1
	New value = 2
	foo (i=2) at helper.cpp:7
	7       }
	(gdb) n
	main () at main.cpp:14
	14          dlclose(h);
	(gdb) n
	Address of symbol "g" is unknown.
	(gdb) n
	Single stepping until exit from function _dl_debug_state,
	which has no line number information.
	Address of symbol "g" is unknown.

Here, all further 'next' commands will tell you the same. This is problem
present before my patch, and I don't try to fix it. Then, there's problem
whereby local watchpoint gets deleted if a completely unrelated shared library
is loaded. Probably, there's much more. With that done, we can think about
more useful general behaviour.

- Volodya



> 
> Similarly when a watchpoint on a static variable, or an automatic
> variable in the `main' function, goes out of scope, because the
> program exits: it would be useful, at least as an option, to have the
> watchpoint re-enabled when the program is restarted.
> 



  reply	other threads:[~2007-11-29  7:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-20 17:14 Vladimir Prus
2007-11-27 23:00 ` Jim Blandy
2007-11-28 15:59   ` Vladimir Prus
2007-11-28 16:23     ` Vladimir Prus
2007-11-28 19:46     ` Jim Blandy
2007-11-28 20:04       ` Vladimir Prus
2007-11-28 22:37         ` Jim Blandy
2007-11-29  6:09           ` Vladimir Prus
2007-11-28 22:50         ` Jim Blandy
2007-11-28 22:18     ` Jim Blandy
2007-11-29  4:24       ` Eli Zaretskii
2007-11-29  7:04         ` Vladimir Prus [this message]
2007-11-29 18:54           ` Jim Blandy
2007-11-29 19:03             ` Variable identification (Was: [RFA] Don't reset watchpoint block on solib load.) Vladimir Prus
2007-11-30  1:22               ` Michael Snyder
2007-11-30  5:52                 ` Vladimir Prus
2007-11-30 20:53                 ` Eli Zaretskii
2007-12-01  1:39                 ` Variable identification Jim Blandy
2007-12-01  1:47                   ` Michael Snyder
2008-01-16  1:29     ` [RFA] Don't reset watchpoint block on solib load Jim Blandy
2008-01-23  9:58       ` Vladimir Prus
2008-01-29 15:23         ` Daniel Jacobowitz
2007-11-29  6:55   ` Vladimir Prus
2007-11-29 18:40     ` Jim Blandy
2007-11-29 18:45       ` Vladimir Prus

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=200711291003.58932.vladimir@codesourcery.com \
    --to=vladimir@codesourcery.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@codesourcery.com \
    /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