From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24261 invoked by alias); 25 Jan 2007 19:48:15 -0000 Received: (qmail 24252 invoked by uid 22791); 25 Jan 2007 19:48:14 -0000 X-Spam-Check-By: sourceware.org Received: from nile.gnat.com (HELO nile.gnat.com) (205.232.38.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 25 Jan 2007 19:48:08 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-nile.gnat.com (Postfix) with ESMTP id D212C48D138 for ; Thu, 25 Jan 2007 14:48:06 -0500 (EST) Received: from nile.gnat.com ([127.0.0.1]) by localhost (nile.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 24809-01-8 for ; Thu, 25 Jan 2007 14:48:06 -0500 (EST) Received: from takamaka.act-europe.fr (joel.gnat.com [205.232.38.116]) by nile.gnat.com (Postfix) with ESMTP id AAEBE48D137 for ; Thu, 25 Jan 2007 14:48:06 -0500 (EST) Received: by takamaka.act-europe.fr (Postfix, from userid 1000) id 36B2834C099; Thu, 25 Jan 2007 23:49:05 +0400 (RET) Date: Thu, 25 Jan 2007 19:48:00 -0000 From: Joel Brobecker To: gdb@sourceware.org Subject: Breaking on C labels? Message-ID: <20070125194905.GB4262@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i 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/msg00321.txt.bz2 Hello, 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. Thanks, -- Joel, curious