From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28851 invoked by alias); 11 Apr 2011 21:08:06 -0000 Received: (qmail 28843 invoked by uid 22791); 11 Apr 2011 21:08:05 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Apr 2011 21:08:01 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3BL81ps005052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 11 Apr 2011 17:08:01 -0400 Received: from host1.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3BL7x21015121 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 11 Apr 2011 17:08:00 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p3BL7w4F016140; Mon, 11 Apr 2011 23:07:58 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p3BL7w00016139; Mon, 11 Apr 2011 23:07:58 +0200 Date: Mon, 11 Apr 2011 21:08:00 -0000 From: Jan Kratochvil To: Sergio Durigan Junior Cc: gdb-patches@sourceware.org, Tom Tromey Subject: Re: [PATCH 2/6] Introduce `pre_expanded sals' Message-ID: <20110411210758.GB28109@host1.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00156.txt.bz2 On Mon, 04 Apr 2011 05:08:23 +0200, Sergio Durigan Junior wrote: > static struct symtabs_and_lines > -addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found) > +addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found, > + int *pre_expanded) > { > char *s; > int marker_spec, not_found; > struct symtabs_and_lines sals = {0}; > struct gdb_exception e; > + int my_pre_expanded = 0; Such as proposal: if (pre_expanded == NULL) pre_expanded = &my_pre_expanded; and use only `pre_expanded' in the code so that one does not forget to update both. (+Probably some *pre_expanded preinitialization.) [...] > + my_pre_expanded = canonical.pre_expanded; > + if (pre_expanded) > + *pre_expanded = my_pre_expanded; > + } > } > if (e.reason < 0) > { > @@ -11010,7 +11041,7 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found) > > if (!not_found) > { > - gdb_assert (sals.nelts == 1); > + gdb_assert (my_pre_expanded || sals.nelts == 1); > > resolve_sal_pc (&sals.sals[0]); > if (b->condition_not_parsed && s && s[0]) > @@ -11049,22 +11080,27 @@ re_set_breakpoint (struct breakpoint *b) > struct symtabs_and_lines expanded = {0}; > struct symtabs_and_lines expanded_end = {0}; > struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); > + int pre_expanded = 0; > > input_radix = b->input_radix; > save_current_space_and_thread (); > switch_to_program_space_and_thread (b->pspace); > set_language (b->language); > > - sals = addr_string_to_sals (b, b->addr_string, &found); > + sals = addr_string_to_sals (b, b->addr_string, &found, &pre_expanded); > if (found) > { > make_cleanup (xfree, sals.sals); > - expanded = expand_line_sal_maybe (sals.sals[0]); > + if (pre_expanded) > + expanded = sals; > + else > + expanded = expand_line_sal_maybe (sals.sals[0]); > } > > if (b->addr_string_range_end) > { > - sals_end = addr_string_to_sals (b, b->addr_string_range_end, &found); > + sals_end = addr_string_to_sals (b, b->addr_string_range_end, &found, > + NULL); > if (found) > { > make_cleanup (xfree, sals_end.sals); > diff --git a/gdb/linespec.h b/gdb/linespec.h > index d8d2ec9..458235c 100644 > --- a/gdb/linespec.h > +++ b/gdb/linespec.h > @@ -30,6 +30,10 @@ struct linespec_result > display mechanism would do the wrong thing. */ > int special_display; > > + /* If non-zero, the linespec result should be considered to be a > + "pre-expanded" multi-location linespec. */ > + int pre_expanded; Here could be the comment by Tom from the follow-up mail as this comment does not explain much. > + > /* If non-NULL, an array of canonical names for returned > symtab_and_line objects. The array has as many elements as the > `nelts' field in the symtabs_and_line returned by decode_line_1. Thanks, Jan