This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
- From: Tom Tromey <tromey at redhat dot com>
- To: iam ahal <hal9000ed2k at gmail dot com>
- Cc: gdb-patches at sourceware dot org, eliz at gnu dot org, pmuldoon at redhat dot com, brobecker at adacore dot com, pedro at codesourcery dot com, drow at false dot org, jan dot kratochvil at redhat dot com
- Date: Wed, 03 Aug 2011 11:44:50 -0600
- Subject: Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)
- References: <BANLkTinD+9_Mkug8o2VhZ03L6XSriL_RKQ@mail.gmail.com> <m3oc1kfheh.fsf@redhat.com> <20110627160029.GF20676@adacore.com> <m3sjqt67pe.fsf@fleche.redhat.com> <m3mxh1oa8a.fsf@redhat.com> <CAA18ubJ10sh3pPDLp4V44qY6r6hLU9RqyDi62KuAAtfXJY7Oug@mail.gmail.com> <834o33qlm9.fsf@gnu.org> <CAA18ubJZK7w51Bmwvy7xYXPvHf7e=bbRbdBOqNvZA-PrXJpUsA@mail.gmail.com> <E1Qdhn8-0000fE-TK@fencepost.gnu.org> <CAA18ubJAvwHt-sq8XN98PhC=LSFXPbcy4P1+AVic-G=MNE7R2A@mail.gmail.com> <CAA18ubLBZseSxqjWSk1jH7OeZi06K_o75HKc0CN-_iCAjQ5boA@mail.gmail.com> <83bowq6x7f.fsf@gnu.org> <CAA18ub+ox5kmHu=1qvMkwNfzbCxMdy3M4Z8eKuheaiqyjxJvEg@mail.gmail.com> <m3d3gu77uk.fsf@fleche.redhat.com> <CAA18ubL6ofB9X+2nJC3jUCTEqZBbWL4=wXHgBkOFKJaAOXsiow@mail.gmail.com>
>>>>> "Eldar" == iam ahal <hal9000ed2k@gmail.com> writes:
Tom> I forget (I never keep records of this, I think perhaps I should) -- did
Tom> we get you started on the copyright assignment paperwork?
Eldar> Not yet, because my previous patches is very different. I mean the
Eldar> different files was changed and I don't know which files I need to
Eldar> change in the next patch.
Eldar> I hope some people here can accept implementation in this last patch.
Eldar> After I can start the copyright assignment.
It is best to start early. Sometimes it can take quite a while, and in
the meantime your patch will not go in.
The list of files does not really matter, since the assignment is for
past and future changes. You can ask the copyright clerk for
clarification on this point if you need it.
I think the patch is basically fine, just a few nits.
Eldar> +static int backtrace_skip_compile;
Eldar> +static void
Tom> Newline between these two lines.
Eldar> I'm not sure that's right because I see that there's no newline in
Eldar> this case (if you look at other places related 'set backtrace ...').
Yeah, I think a newline is better, though.
Eldar> +char *
Eldar> +get_display_filename_from_sal (struct symtab_and_line *sal)
Tom>
Tom> Should have an introductory comment before this function.
Eldar> Comment was added in 'frame.h'
Ok, thanks.
Add a comment saying to see the documentation in frame.h.
Eldar> +static const char filename_display_without_comp_dir[] = "without-compile-dir";
I think spelling out "directory" would be better.
Eldar> + const char *filename = sal->symtab->filename;
Eldar> + const char *dirname = sal->symtab->dirname;
Eldar> + size_t flen = strlen (filename);
Eldar> + size_t dlen = strlen (dirname);
This will crash if filename==NULL or dirname==NULL.
Eldar> + if (filename_display_string == filename_display_without_comp_dir
Eldar> + && filename && dirname && dlen <= flen
Eldar> + && !FILENAME_NCMP (filename, dirname, dlen))
This test is not correct, in that it will match "/tmp/x" with "/tmp/xaaa".
I think it needs an additional check for a separator.
Eldar> diff -rup gdb-7.2-orig/include/filenames.h gdb-7.2/include/filenames.h
Changes to libiberty have to go to gcc-patches.
I don't think you actually need this change, though, so it would be
simpler and quicker if you left it out.
Eldar> +extern int filename_ncmp (const char *s1, const char *s2, size_t n);
This is already declared in the trunk filenames.h.
Be sure to always write patches against the trunk, not something older.
Tom