From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3907 invoked by alias); 26 Jan 2007 00:05:45 -0000 Received: (qmail 3898 invoked by uid 22791); 26 Jan 2007 00:05:44 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.palmsource.com (HELO mx2.palmsource.com) (12.7.175.14) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 26 Jan 2007 00:05:39 +0000 Received: from localhost (localhost [127.0.0.1]) by localhost.domain.tld (Postfix) with ESMTP id D2B99279EB; Thu, 25 Jan 2007 16:05:37 -0800 (PST) Received: from mx2.palmsource.com ([127.0.0.1]) by localhost (mx2.palmsource.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 09011-01-9; Thu, 25 Jan 2007 16:05:31 -0800 (PST) Received: from ussunex01.palmsource.com (unknown [192.168.101.9]) by mx2.palmsource.com (Postfix) with ESMTP id 67D84108C77; Thu, 25 Jan 2007 15:20:05 -0800 (PST) Received: from 192.168.92.91 ([192.168.92.91]) by ussunex01.palmsource.com ([192.168.101.9]) via Exchange Front-End Server owa.palmsource.com ([10.0.20.17]) with Microsoft Exchange Server HTTP-DAV ; Thu, 25 Jan 2007 23:20:05 +0000 Received: from svmsnyderlnx by owa.palmsource.com; 25 Jan 2007 15:20:04 -0800 Subject: Re: Breaking on C labels? From: Michael Snyder To: Jim Blandy Cc: Joel Brobecker , gdb@sourceware.org In-Reply-To: References: <20070125194905.GB4262@adacore.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 26 Jan 2007 00:05:00 -0000 Message-Id: <1169767203.22601.128.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00327.txt.bz2 On Thu, 2007-01-25 at 13:19 -0800, Jim Blandy wrote: > Joel Brobecker writes: > > A customer asked us a question about the ability of breaking on labels > > inside C code. Consider for instance: > > > > void > > procedure foo (void) > > { > > [...] > > error_handler: > > [...] > > } > > > > The customer asked if it was possible to break at the error_handler > > label. We are helping them with finding alternative solutions, but > > I still did a bit of researching... > > > > I discovered without much surprise that DWARF does indeed have provision > > for labels (DW_TAG_label). However, I also noticed that GCC already > > generates the associated DIEs. We actually even process them. However, > > all my attempts in trying to reference them from the debugger failed. > > I tried "break error_handler", or more simply "p error_handler", etc. > > > > Did we ever make any attempt in implementing this sort of functionality > > in the past? > > > > Looking at the source code, I found in new_symbol (): > > > > case DW_TAG_label: > > attr = dwarf2_attr (die, DW_AT_low_pc, cu); > > if (attr) > > { > > SYMBOL_VALUE_ADDRESS (sym) = DW_ADDR (attr) + baseaddr; > > } > > SYMBOL_CLASS (sym) = LOC_LABEL; > > break; > > > > So we setup the symbol, but we don't add to any of our symbol lists... > > I am left wondering what it is that we'll be doing with this symbol. > > You're right, it looks to me as if we just throw the symbol away, too. > > The logical thing would be to put it in the block of the function it's > in, since goto labels are block-scoped. It would go in LABEL_DOMAIN, > since that's a separate namespace. And then you'd need to teach > linespec.[ch] about them. There's a risk that some symbol-lookup function would then select that label instead of the function entry label when you tried to look up the nearest label preceeding a given address.