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 _______________________________________________ Bug-gdb mailing list Bug-gdb@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gdb