Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: bug-gdb@rich-paul.net, bug-gdb@gnu.org, gdb-patches@sources.redhat.com
Subject: Re: [RFA] Fix file name generation in edit_command (was: Ver 6.3 edit command failing)
Date: Wed, 27 Apr 2005 18:04:00 -0000	[thread overview]
Message-ID: <20050427180410.GA19592@nevyn.them.org> (raw)
In-Reply-To: <01c54b40$Blat.v2.4$be3bafe0@zahav.net.il>

On Wed, Apr 27, 2005 at 06:48:46PM +0300, Eli Zaretskii wrote:
> Thanks for the tip.  Here's the revised patch:

The rest of this is mostly stylistic; a few comments...

> +  /* If we don't already know the full absolute file name of the
> +     source file, find it now.  */
> +  if (NULL == sal.symtab->fullname)
> +    {
> +      fn = symtab_to_fullname (sal.symtab);
> +      if (NULL == fn)
> +	fn = "unknown";
> +    }
> +  else
> +    fn = sal.symtab->fullname;
> +
> +  /*         $EDITOR      blank  +NN  blank    file      \0 */
> +  cmdlen = strlen(editor) + 1 + log10 + 2 +  strlen(fn) + 1;
>    p = xmalloc(cmdlen);
> -  sprintf(p,"%s +%d %s%s",editor,sal.line,
> -     (NULL == sal.symtab->dirname ? "./" :
> -        (NULL != sal.symtab->filename && *(sal.symtab->filename) != '/') ?
> -	   sal.symtab->dirname : ""),
> -     (NULL == sal.symtab->filename ? "unknown" : sal.symtab->filename)
> -  );
> +  sprintf (p, "%s +%d %s", editor, sal.line, fn);

It strikes me as odd that you can use "edit" if GDB doesn't know where
the source file is.  I realize this is a pre-existing condition, but...
Also, symtab_to_fullname includes the cached fullname check.  So what's
your opinion of boiling the whole thing down to:

  fn = symtab_to_fullname (sal.symtab);
  if (fn == NULL)
    error (_("Could not find file \"%s\""), sal.symtab->filename);
  p = xstrprintf ("%s +%d %s", editor, sal.line, fn);

Mark, can I have those bonus points? :-)

-- 
Daniel Jacobowitz
CodeSourcery, LLC


  parent reply	other threads:[~2005-04-27 18:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1DLM3u-0000IQ-Vj@lists.gnu.org>
2005-04-27 14:32 ` Eli Zaretskii
2005-04-27 14:36   ` Daniel Jacobowitz
2005-04-27 15:52     ` Eli Zaretskii
2005-04-27 17:43       ` Mark Kettenis
2005-04-28  7:10         ` Eli Zaretskii
2005-04-27 18:04       ` Daniel Jacobowitz [this message]
2005-04-28  7:05         ` Eli Zaretskii
2005-04-28 20:39         ` Eli Zaretskii
2005-04-28 20:42           ` Daniel Jacobowitz
2005-04-28 21:04             ` Eli Zaretskii
2005-04-28 21:18               ` Daniel Jacobowitz
2005-04-29  7:07                 ` Eli Zaretskii

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=20050427180410.GA19592@nevyn.them.org \
    --to=drow@false.org \
    --cc=bug-gdb@gnu.org \
    --cc=bug-gdb@rich-paul.net \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.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