Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch 6/9] Mechanical symtab->filename -> symtab_to_filename
Date: Thu, 24 Jan 2013 21:56:00 -0000	[thread overview]
Message-ID: <20130124215609.GA31688@host2.jankratochvil.net> (raw)
In-Reply-To: <87ip6q1gbo.fsf@fleche.redhat.com>

On Mon, 21 Jan 2013 20:33:47 +0100, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> 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


  reply	other threads:[~2013-01-24 21:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17 22:23 Jan Kratochvil
2013-01-21 19:34 ` Tom Tromey
2013-01-24 21:56   ` Jan Kratochvil [this message]
2013-01-25 14:28     ` Tom Tromey
2013-01-25 14:30       ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130124215609.GA31688@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox