From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8579 invoked by alias); 30 Oct 2003 06:21:55 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 8572 invoked from network); 30 Oct 2003 06:21:54 -0000 Received: from unknown (HELO monty-python.gnu.org) (199.232.76.173) by sources.redhat.com with SMTP; 30 Oct 2003 06:21:54 -0000 Received: from [207.232.27.5] (helo=WST0054) by monty-python.gnu.org with asmtp (Exim 4.24) id 1AF69r-0008TB-Ki; Thu, 30 Oct 2003 01:19:47 -0500 Date: Thu, 30 Oct 2003 06:21:00 -0000 Message-Id: From: Eli Zaretskii To: Daniel Jacobowitz CC: gdb@sources.redhat.com In-reply-to: <20031030055345.GA7588@nevyn.them.org> (message from Daniel Jacobowitz on Thu, 30 Oct 2003 00:53:45 -0500) Subject: Re: Multiple locations vs. watchpoints. Reply-to: Eli Zaretskii References: <20031030055345.GA7588@nevyn.them.org> X-SW-Source: 2003-10/txt/msg00330.txt.bz2 > Date: Thu, 30 Oct 2003 00:53:45 -0500 > From: Daniel Jacobowitz > > Suppose we have this: > foo.c:static int *bar; > > (gdb) watch *bar > > My idea has sort of been to create a watchpoint with multiple locations, one > for bar and one for *bar, each representing a conceptual hardware watchpoint > (though not necessarily one hardware watchpoint resource). Yes, we do it now, albeit differently at the high level. > And for this: > foo.c:static int foo() > bar.c:static int foo() > > (gdb) break foo > > My idea has sort of been that we should have a breakpoint with two > bp_locations, one for foo.c:foo and one for bar.c:foo. I don't think we should do that. I think we should leave things as they are now, namely, that "break foo" means the function foo in the _current_ module, be that foo.c or bar.c. For the other, the user is required to type "break bar.c:foo". In C++ and other OO languages, this is different, but in C we shouldn't introduce confusion, IMHO. Someone who debugs a C program doesn't expect to get a breakpoint on a completely different function. > But suppose we have this: > foo.c:static int *bar; > bar.c:static int *bar; > > (gdb) watch *bar > > > It watches whatever *bar would print, which is one of them. No easy way to > get at the other or describe the ambiguity. I wonder once again whether the > two-level scheme is really correctly designed; but I have no better ideas. Accept my position about static functions in C, and this problem goes away. But if you still want to put a watchpoint on both static variables, then there might be no reason for multi-level schemes: simply have the chain of addresses include foo.c:bar, foo.c:*bar, bar.c:bar, and bar.c:*bar. Does this make sense?