From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12881 invoked by alias); 24 Jan 2013 21:56:26 -0000 Received: (qmail 12869 invoked by uid 22791); 24 Jan 2013 21:56:25 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS 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; Thu, 24 Jan 2013 21:56:16 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0OLuGq3010445 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 24 Jan 2013 16:56:16 -0500 Received: from host2.jankratochvil.net (ovpn-116-88.ams2.redhat.com [10.36.116.88]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0OLuAWv020638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 24 Jan 2013 16:56:14 -0500 Date: Thu, 24 Jan 2013 21:56:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [patch 6/9] Mechanical symtab->filename -> symtab_to_filename Message-ID: <20130124215609.GA31688@host2.jankratochvil.net> References: <20130117222242.GG16249@host2.jankratochvil.net> <87ip6q1gbo.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ip6q1gbo.fsf@fleche.redhat.com> 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: 2013-01/txt/msg00614.txt.bz2 On Mon, 21 Jan 2013 20:33:47 +0100, Tom Tromey wrote: > >>>>> "Jan" == Jan Kratochvil writes: > > Jan> Hi, > Jan> this patch is mostly a mechanical substitution: > Jan> symtab-> filename -> symtab_to_filename (symtab) > > Jan> - && loc->line_number == sal.line) > Jan> - { > Jan> - if (compare_filenames_for_search (loc->symtab->filename, > Jan> - sal.symtab->filename)) > Jan> - line_match = 1; > Jan> - } > Jan> + && loc->line_number == sal.line > Jan> + && filename_cmp (symtab_to_fullname (loc->symtab), > Jan> + sal_fullname) == 0) > Jan> + line_match = 1; > > I found the patch a bit difficult because some spots are the mechanical > conversion you mention, but others, like this, use symtab_to_fullname. I am aware of it and I appreciate your reading it. Maybe I could split this patch to more-mechanical and less-mechanical but I did not. > Jan> + if (function_sal->symtab != NULL > Jan> + && compare_filenames_for_search (function_sal->symtab->filename, > Jan> + e->filename)) > Jan> + return 1; > > This spot still uses symtab->filename directly. > Is that intentional? If so I think it should perhaps have a comment. Yes. + /* Check first sole SYMTAB->FILENAME. It does not need to be + a substring of symtab_to_fullname as it may contain "./" etc. */ > Jan> + if (symname == NULL > Jan> + || filename_cmp (symname, symtab_to_filename (s)) == 0) > > This spot uses filename_cmp with symtab_to_filename. > Is that intentional? > It seems a bit strange to me to allow the filename-display setting to > control comparisons. Because this is a maintenance command. It has already contained filename_cmp and not compare_filenames_for_search. I am not completely sure with it but for maintenance commands I have tried to follow: * Keep backward compatibility of behavior as long as is set the (currently default) setting "set filename-display relative". * Make it always working for copy-pasted filenames. * Do not make the comparisons too relaxed, while false ambiguous-location breakpoint set does not hurt much for maintenance commands I believe GDB should display only exactly what it was asked for, nothing else. > Jan> if (! regexp > Jan> - || re_exec (symtab->filename)) > Jan> + || re_exec (symtab_to_filename (symtab))) > > Likewise. Likewise, a maintenance command. > Jan> @@ -150,7 +152,7 @@ tui_set_source_content (struct symtab *s, > [...] > Jan> - s->filename) == 0 > Jan> + symtab_to_filename (s)) == 0 > > Likewise. This was a larger change, it will be a new patch part. This filename was only internally stored in TUI and it should be symtab_to_fullname. Thanks, Jan