This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename)


>>>>> "iam" == iam ahal <hal9000ed2k@gmail.com> writes:

iam> I've created new patch where I've added new option called
iam> skip-compile-dir. Patch in attachment. I didn't make ChangeLog yet.
iam> If you like this implementation I prepare ChangeLog and testsuite script.
iam> I can change something if you want.

Thanks.

I forget (I never keep records of this, I think perhaps I should) -- did
we get you started on the copyright assignment paperwork?

iam> +static int backtrace_skip_compile;
iam> +static void

Newline between these two lines.

iam> +char *
iam> +get_display_filename_from_sal (struct symtab_and_line *sal)

Should have an introductory comment before this function.
It should return a 'const char *'.

iam> +  if (backtrace_skip_compile && filename && dirname
iam> +      && strstr(filename, dirname))

Space before the open paren.  But this seems like a strange test to me,
strstr can't really be correct.

iam> +    {
iam> +      /* +1 means skip directory separator */
iam> +      return filename + strlen(dirname) + 1;

Comments should end with a period and two spaces, per GNU standards.

Can there never be multiple separators?
It seems like there could be, in which case you want a loop.

iam> +  add_setshow_boolean_cmd ("skip-compile-dir", class_obscure,

I'm not especially fond of this name.

I don't have a better suggestion though.

iam> +      const char *display_filename = get_display_filename_from_sal(&sal);

Space before open paren.

iam> +      if (display_filename == NULL)
iam> +	  display_filename = sal.symtab->filename;

It seems that perhaps get_display_filename_from_sal should do this.

iam> -      ui_out_field_string (uiout, "file", sal.symtab->filename);
iam> +      ui_out_field_string (uiout, "file", display_filename);

I'm surprised this change has any effect.
I thought the compilation directory and the source file name were kept
separate in the symtab.  What is actually happening?

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]