Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patchv2 12/11] New options {relative,basename}-with-system-absolute
@ 2013-01-29 22:10 Jan Kratochvil
  2013-01-30  7:48 ` [patchv3 " Jan Kratochvil
  0 siblings, 1 reply; 14+ messages in thread
From: Jan Kratochvil @ 2013-01-29 22:10 UTC (permalink / raw)
  To: gdb-patches

Hi,

to make {this,a} patchset practically useful it needs to be enabled by default.

But making "set filename-display absolute" the default is probably not great:

#8  0x0000000000735ed2 in captured_main (data=0x7fffffffdaa0) at main.c:1033
#9  0x00000000007324ef in catch_errors (func=0x734cae <captured_main>, func_args=0x7fffffffdaa0, errstring=0xfa2e54 "", mask=6) at exceptions.c:546
#10 0x0000000000735f1e in gdb_main (args=0x7fffffffdaa0) at main.c:1042
#11 0x000000000048cd66 in main (argc=1, argv=0x7fffffffdba8) at gdb.c:34
->
#8  0x0000000000735ed2 in captured_main (data=0x7fffffffdaa0) at /home/jkratoch/redhat/archer-jankratochvil-absdir/gdb/main.c:1033
#9  0x00000000007324ef in catch_errors (func=0x734cae <captured_main>, func_args=0x7fffffffdaa0, errstring=0xfa2e54 "", mask=6)
    at /home/jkratoch/redhat/archer-jankratochvil-absdir/gdb/exceptions.c:546
#10 0x0000000000735f1e in gdb_main (args=0x7fffffffdaa0) at /home/jkratoch/redhat/archer-jankratochvil-absdir/gdb/main.c:1042
#11 0x000000000048cd66 in main (argc=1, argv=0x7fffffffdba8) at /home/jkratoch/redhat/archer-jankratochvil-absdir/gdb/gdb.c:34

OTOH this output I find wrong and the "absolute" change is a win for it:

#0  0x00007ffff63773d0 in __poll_nocancel () at ../sysdeps/unix/syscall-template.S:81
->
#0  0x00007ffff63773d0 in __poll_nocancel () at /usr/src/debug/glibc-2.17-c758a686/sysdeps/unix/syscall-template.S:81

So a combination of absolute filenames for system component and relative
filenames for user binaries should be the best of both choices.

This applies then also for the main executable, if it comes from system:

#3  0x00000000004016e4 in main (argc=<optimized out>, argv=<optimized out>) at src/sleep.c:145
->
#3  0x00000000004016e4 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/coreutils-8.20/src/sleep.c:145

All these patches are unrelated if *-debuginfo.rpm (or equivalent) is not
installed for the system component as in such case GDB has always displayed:

#0  0x00007ffff63773d0 in __poll_nocancel () from /lib64/libc.so.6


In fact I would personally prefer "basename" instead of "relative" for user
binaries when we have "ambiguous linespec" already implemented.  But I do not
find there a big difference so it would be mostly a needless user interface
change.  Such relative* -> basename* change is in fact unrelated to this
proposal and it can be still made in the future.

This patch does not yet make the change of the default.


Thanks,
Jan


gdb/
2013-01-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* source.c (filename_display_relative_with_system_absolute)
	(filename_display_basename_with_system_absolute): New.
	(filename_display_kind_names): Add them.
	(symtab_to_filename): Use them.
	(_initialize_source): Describe them for "set filename-display".

gdb/doc/
2013-01-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.texinfo (Backtrace): Add new set filename-display options
	relative-with-system-absolute and basename-with-system-absolute.

--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -6549,6 +6549,16 @@ Display only basename of a filename.
 @item set filename-display absolute
 Display an absolute filename.
 
+@item set filename-display relative-with-system-absolute
+Determine whether a source filename comes from file having separate debug
+information file.  In such case display the source filename as absolute one.
+Otherwise display it relative to the compilation directory.
+
+@item set filename-display basename-with-system-absolute
+Determine whether a source filename comes from file having separate debug
+information file.  In such case display the source filename as absolute one.
+Otherwise display only basename of the filename.
+
 @item show filename-display
 Show the current way to display filenames.
 @end table
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -113,11 +113,17 @@ show_lines_to_list (struct ui_file *file, int from_tty,
 static const char filename_display_basename[] = "basename";
 static const char filename_display_relative[] = "relative";
 static const char filename_display_absolute[] = "absolute";
+static const char filename_display_relative_with_system_absolute[] =
+						"relative-with-system-absolute";
+static const char filename_display_basename_with_system_absolute[] =
+						"basename-with-system-absolute";
 
 static const char *const filename_display_kind_names[] = {
   filename_display_basename,
   filename_display_relative,
   filename_display_absolute,
+  filename_display_relative_with_system_absolute,
+  filename_display_basename_with_system_absolute,
   NULL
 };
 
@@ -1144,8 +1150,16 @@ symtab_to_filename (struct symtab *symtab)
     return symtab_to_fullname (symtab);
   else if (filename_display_string == filename_display_relative)
     return symtab->filename;
-  else
-    internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
+
+  if (symtab->objfile->separate_debug_objfile != NULL
+      || symtab->objfile->separate_debug_objfile_backlink != NULL)
+    return symtab_to_fullname (symtab);
+
+  if (filename_display_string == filename_display_relative_with_system_absolute)
+    return symtab->filename;
+  if (filename_display_string == filename_display_basename_with_system_absolute)
+    return lbasename (symtab->filename);
+  internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
 }
 \f
 /* Create and initialize the table S->line_charpos that records
@@ -2065,6 +2079,13 @@ filename-display can be:\n\
   basename - display only basename of a filename\n\
   relative - display a filename relative to the compilation directory\n\
   absolute - display an absolute filename\n\
+  relative-with-system-absolute - display filenames from files with separate\n\
+                                  debug info files as absolute, other files\n\
+                                  display relative to the compilation directory\
+\n\
+  basename-with-system-absolute - display filenames from files with separate\n\
+                                  debug info files as absolute, other files\n\
+                                  display only with basename of the filename\n\
 By default, relative filenames are displayed."),
 			NULL,
 			show_filename_display_string,


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-29 22:10 [patchv2 12/11] New options {relative,basename}-with-system-absolute Jan Kratochvil
@ 2013-01-30  7:48 ` Jan Kratochvil
  2013-01-30 17:15   ` Eli Zaretskii
  2013-02-01 20:59   ` Tom Tromey
  0 siblings, 2 replies; 14+ messages in thread
From: Jan Kratochvil @ 2013-01-30  7:48 UTC (permalink / raw)
  To: gdb-patches

Just forgot about gdb/NEWS.
On Tue, 29 Jan 2013 23:10:19 +0100, Jan Kratochvil wrote:

Hi,

to make {this,a} patchset practically useful it needs to be enabled by default.

But making "set filename-display absolute" the default is probably not great:

#8  0x0000000000735ed2 in captured_main (data=0x7fffffffdaa0) at main.c:1033
#9  0x00000000007324ef in catch_errors (func=0x734cae <captured_main>, func_args=0x7fffffffdaa0, errstring=0xfa2e54 "", mask=6) at exceptions.c:546
#10 0x0000000000735f1e in gdb_main (args=0x7fffffffdaa0) at main.c:1042
#11 0x000000000048cd66 in main (argc=1, argv=0x7fffffffdba8) at gdb.c:34
->
#8  0x0000000000735ed2 in captured_main (data=0x7fffffffdaa0) at /home/jkratoch/redhat/archer-jankratochvil-absdir/gdb/main.c:1033
#9  0x00000000007324ef in catch_errors (func=0x734cae <captured_main>, func_args=0x7fffffffdaa0, errstring=0xfa2e54 "", mask=6)
    at /home/jkratoch/redhat/archer-jankratochvil-absdir/gdb/exceptions.c:546
#10 0x0000000000735f1e in gdb_main (args=0x7fffffffdaa0) at /home/jkratoch/redhat/archer-jankratochvil-absdir/gdb/main.c:1042
#11 0x000000000048cd66 in main (argc=1, argv=0x7fffffffdba8) at /home/jkratoch/redhat/archer-jankratochvil-absdir/gdb/gdb.c:34

OTOH this output I find wrong and the "absolute" change is a win for it:

#0  0x00007ffff63773d0 in __poll_nocancel () at ../sysdeps/unix/syscall-template.S:81
->
#0  0x00007ffff63773d0 in __poll_nocancel () at /usr/src/debug/glibc-2.17-c758a686/sysdeps/unix/syscall-template.S:81

So a combination of absolute filenames for system component and relative
filenames for user binaries should be the best of both choices.

This applies then also for the main executable, if it comes from system:

#3  0x00000000004016e4 in main (argc=<optimized out>, argv=<optimized out>) at src/sleep.c:145
->
#3  0x00000000004016e4 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/coreutils-8.20/src/sleep.c:145

All these patches are unrelated if *-debuginfo.rpm (or equivalent) is not
installed for the system component as in such case GDB has always displayed:

#0  0x00007ffff63773d0 in __poll_nocancel () from /lib64/libc.so.6


In fact I would personally prefer "basename" instead of "relative" for user
binaries when we have "ambiguous linespec" already implemented.  But I do not
find there a big difference so it would be mostly a needless user interface
change.  Such relative* -> basename* change is in fact unrelated to this
proposal and it can be still made in the future.

This patch does not yet make the change of the default.


Thanks,
Jan


gdb/
2013-01-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* NEWS (set filename-display): Add options
	relative-with-system-absolute and basename-with-system-absolute.
	* source.c (filename_display_relative_with_system_absolute)
	(filename_display_basename_with_system_absolute): New.
	(filename_display_kind_names): Add them.
	(symtab_to_filename): Use them.
	(_initialize_source): Describe them for "set filename-display".

gdb/doc/
2013-01-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.texinfo (Backtrace): Add new set filename-display options
	relative-with-system-absolute and basename-with-system-absolute.

--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -115,7 +115,8 @@ show print type typedefs
   Control whether typedef definitions are displayed by "ptype".
   The default is to show them.
 
-set filename-display basename|relative|absolute
+set filename-display basename|relative|absolute|relative-with-system-absolute
+                     |basename-with-system-absolute
 show filename-display
   Control the way in which filenames is displayed.
   The default is "relative", which preserves previous behavior.
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -6549,6 +6549,22 @@ Display only basename of a filename.
 @item set filename-display absolute
 Display an absolute filename.
 
+@item set filename-display relative-with-system-absolute
+Determine whether a source filename comes from file having separate debug
+information file.  In such case display the source filename as absolute one.
+Otherwise display it relative to the compilation directory.
+
+Files having separate debug information file are expected to come from system
+shared libraries.
+
+@item set filename-display basename-with-system-absolute
+Determine whether a source filename comes from file having separate debug
+information file.  In such case display the source filename as absolute one.
+Otherwise display only basename of the filename.
+
+Files having separate debug information file are expected to come from system
+shared libraries.
+
 @item show filename-display
 Show the current way to display filenames.
 @end table
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -113,11 +113,17 @@ show_lines_to_list (struct ui_file *file, int from_tty,
 static const char filename_display_basename[] = "basename";
 static const char filename_display_relative[] = "relative";
 static const char filename_display_absolute[] = "absolute";
+static const char filename_display_relative_with_system_absolute[] =
+						"relative-with-system-absolute";
+static const char filename_display_basename_with_system_absolute[] =
+						"basename-with-system-absolute";
 
 static const char *const filename_display_kind_names[] = {
   filename_display_basename,
   filename_display_relative,
   filename_display_absolute,
+  filename_display_relative_with_system_absolute,
+  filename_display_basename_with_system_absolute,
   NULL
 };
 
@@ -1144,8 +1150,16 @@ symtab_to_filename (struct symtab *symtab)
     return symtab_to_fullname (symtab);
   else if (filename_display_string == filename_display_relative)
     return symtab->filename;
-  else
-    internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
+
+  if (symtab->objfile->separate_debug_objfile != NULL
+      || symtab->objfile->separate_debug_objfile_backlink != NULL)
+    return symtab_to_fullname (symtab);
+
+  if (filename_display_string == filename_display_relative_with_system_absolute)
+    return symtab->filename;
+  if (filename_display_string == filename_display_basename_with_system_absolute)
+    return lbasename (symtab->filename);
+  internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
 }
 \f
 /* Create and initialize the table S->line_charpos that records
@@ -2065,6 +2079,13 @@ filename-display can be:\n\
   basename - display only basename of a filename\n\
   relative - display a filename relative to the compilation directory\n\
   absolute - display an absolute filename\n\
+  relative-with-system-absolute - display filenames from files with separate\n\
+                                  debug info files as absolute, other files\n\
+                                  display relative to the compilation directory\
+\n\
+  basename-with-system-absolute - display filenames from files with separate\n\
+                                  debug info files as absolute, other files\n\
+                                  display only with basename of the filename\n\
 By default, relative filenames are displayed."),
 			NULL,
 			show_filename_display_string,


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-30  7:48 ` [patchv3 " Jan Kratochvil
@ 2013-01-30 17:15   ` Eli Zaretskii
  2013-01-30 18:30     ` Eli Zaretskii
  2013-02-02 18:12     ` Jan Kratochvil
  2013-02-01 20:59   ` Tom Tromey
  1 sibling, 2 replies; 14+ messages in thread
From: Eli Zaretskii @ 2013-01-30 17:15 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

> Date: Wed, 30 Jan 2013 08:48:20 +0100
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> 
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -115,7 +115,8 @@ show print type typedefs
>    Control whether typedef definitions are displayed by "ptype".
>    The default is to show them.
>  
> -set filename-display basename|relative|absolute
> +set filename-display basename|relative|absolute|relative-with-system-absolute
> +                     |basename-with-system-absolute

Can't say I like these too-old names.

Otherwise, OK for this part.

> +@item set filename-display relative-with-system-absolute
> +Determine whether a source filename comes from file having separate debug
> +information file.  In such case display the source filename as absolute one.
> +Otherwise display it relative to the compilation directory.

The option controls how file names are displayed, so starting its
description with "Determine ..." is not the best way.  That first
sentence got me puzzled for a few seconds.

I suggest something like this:

  Display as absolute those source file names that come from files
  with separate debug info, and all the other source file names as
  relative to their compilation directory.

> +@item set filename-display basename-with-system-absolute
> +Determine whether a source filename comes from file having separate debug
> +information file.  In such case display the source filename as absolute one.
> +Otherwise display only basename of the filename.

Similarly here: start with "Display ..." as this what the option
controls.

> +Files having separate debug information file are expected to come from system
> +shared libraries.

This repetition is unnecessary.

OK with these changes.

Thanks.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-30 17:15   ` Eli Zaretskii
@ 2013-01-30 18:30     ` Eli Zaretskii
  2013-01-30 18:53       ` Jan Kratochvil
  2013-02-02 18:12     ` Jan Kratochvil
  1 sibling, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2013-01-30 18:30 UTC (permalink / raw)
  To: jan.kratochvil; +Cc: gdb-patches

> Date: Wed, 30 Jan 2013 19:15:07 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: gdb-patches@sourceware.org
> 
> > -set filename-display basename|relative|absolute
> > +set filename-display basename|relative|absolute|relative-with-system-absolute
> > +                     |basename-with-system-absolute
> 
> Can't say I like these too-old names.
                         ^^^^^^^^^^^^^
I meant too-long, of course.

Sorry.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-30 18:30     ` Eli Zaretskii
@ 2013-01-30 18:53       ` Jan Kratochvil
  2013-01-30 20:11         ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Jan Kratochvil @ 2013-01-30 18:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

On Wed, 30 Jan 2013 19:30:03 +0100, Eli Zaretskii wrote:
> > Date: Wed, 30 Jan 2013 19:15:07 +0200
> > From: Eli Zaretskii <eliz@gnu.org>
> > Cc: gdb-patches@sourceware.org
> > 
> > > -set filename-display basename|relative|absolute
> > > +set filename-display basename|relative|absolute|relative-with-system-absolute
> > > +                     |basename-with-system-absolute
> > 
> > Can't say I like these too-old names.
>                          ^^^^^^^^^^^^^
> I meant too-long, of course.

I sure agree; just I did not find a better name.

relative-sysabs
relative-system-absolute
relative-syspkg (?)
relative-executable (misleading, system packaged executable is absolute)
?


Jan


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-30 18:53       ` Jan Kratochvil
@ 2013-01-30 20:11         ` Eli Zaretskii
  2013-01-30 21:48           ` Doug Evans
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2013-01-30 20:11 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

> Date: Wed, 30 Jan 2013 19:53:44 +0100
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb-patches@sourceware.org
> 
> On Wed, 30 Jan 2013 19:30:03 +0100, Eli Zaretskii wrote:
> > > Date: Wed, 30 Jan 2013 19:15:07 +0200
> > > From: Eli Zaretskii <eliz@gnu.org>
> > > Cc: gdb-patches@sourceware.org
> > > 
> > > > -set filename-display basename|relative|absolute
> > > > +set filename-display basename|relative|absolute|relative-with-system-absolute
> > > > +                     |basename-with-system-absolute
> > > 
> > > Can't say I like these too-old names.
> >                          ^^^^^^^^^^^^^
> > I meant too-long, of course.
> 
> I sure agree; just I did not find a better name.

Neither did I.  relative-absolute and basename-absolute, perhaps?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-30 20:11         ` Eli Zaretskii
@ 2013-01-30 21:48           ` Doug Evans
  2013-01-31  3:49             ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Doug Evans @ 2013-01-30 21:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Jan Kratochvil, gdb-patches

On Wed, Jan 30, 2013 at 12:10 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Wed, 30 Jan 2013 19:53:44 +0100
>> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>> Cc: gdb-patches@sourceware.org
>>
>> On Wed, 30 Jan 2013 19:30:03 +0100, Eli Zaretskii wrote:
>> > > Date: Wed, 30 Jan 2013 19:15:07 +0200
>> > > From: Eli Zaretskii <eliz@gnu.org>
>> > > Cc: gdb-patches@sourceware.org
>> > >
>> > > > -set filename-display basename|relative|absolute
>> > > > +set filename-display basename|relative|absolute|relative-with-system-absolute
>> > > > +                     |basename-with-system-absolute
>> > >
>> > > Can't say I like these too-old names.
>> >                          ^^^^^^^^^^^^^
>> > I meant too-long, of course.
>>
>> I sure agree; just I did not find a better name.
>
> Neither did I.  relative-absolute and basename-absolute, perhaps?

The nice thing about {relative,basename}-with-system-absolute is that
they are clear.
It's not like these will be typed very often, and tab-completion can
reduce a lot of that.
I like the "long" names.  What real problem is being solved by terse names?

$0.02


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-30 21:48           ` Doug Evans
@ 2013-01-31  3:49             ` Eli Zaretskii
  2013-01-31 18:07               ` Doug Evans
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2013-01-31  3:49 UTC (permalink / raw)
  To: Doug Evans; +Cc: jan.kratochvil, gdb-patches

> Date: Wed, 30 Jan 2013 13:48:05 -0800
> From: Doug Evans <dje@google.com>
> Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, gdb-patches <gdb-patches@sourceware.org>
> 
> The nice thing about {relative,basename}-with-system-absolute is that
> they are clear.

They aren't to me.  They might be clear _after_ you know what they
mean, exactly.  But then so would be every shorthand of them.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-31  3:49             ` Eli Zaretskii
@ 2013-01-31 18:07               ` Doug Evans
  2013-01-31 18:54                 ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Doug Evans @ 2013-01-31 18:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Jan Kratochvil, gdb-patches

On Wed, Jan 30, 2013 at 7:48 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Wed, 30 Jan 2013 13:48:05 -0800
>> From: Doug Evans <dje@google.com>
>> Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, gdb-patches <gdb-patches@sourceware.org>
>>
>> The nice thing about {relative,basename}-with-system-absolute is that
>> they are clear.
>
> They aren't to me.  They might be clear _after_ you know what they
> mean, exactly.  But then so would be every shorthand of them.

So then why not reduce them even more?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-31 18:07               ` Doug Evans
@ 2013-01-31 18:54                 ` Eli Zaretskii
  2013-02-01  3:41                   ` Doug Evans
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2013-01-31 18:54 UTC (permalink / raw)
  To: Doug Evans; +Cc: jan.kratochvil, gdb-patches

> Date: Thu, 31 Jan 2013 10:07:09 -0800
> From: Doug Evans <dje@google.com>
> Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, gdb-patches <gdb-patches@sourceware.org>
> 
> On Wed, Jan 30, 2013 at 7:48 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> >> Date: Wed, 30 Jan 2013 13:48:05 -0800
> >> From: Doug Evans <dje@google.com>
> >> Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, gdb-patches <gdb-patches@sourceware.org>
> >>
> >> The nice thing about {relative,basename}-with-system-absolute is that
> >> they are clear.
> >
> > They aren't to me.  They might be clear _after_ you know what they
> > mean, exactly.  But then so would be every shorthand of them.
> 
> So then why not reduce them even more?

That could work, but hard to tell without seeing specific suggestions.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-31 18:54                 ` Eli Zaretskii
@ 2013-02-01  3:41                   ` Doug Evans
  2013-02-01  8:09                     ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Doug Evans @ 2013-02-01  3:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Jan Kratochvil, gdb-patches

On Thu, Jan 31, 2013 at 10:54 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Thu, 31 Jan 2013 10:07:09 -0800
>> From: Doug Evans <dje@google.com>
>> Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, gdb-patches <gdb-patches@sourceware.org>
>>
>> On Wed, Jan 30, 2013 at 7:48 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> >> Date: Wed, 30 Jan 2013 13:48:05 -0800
>> >> From: Doug Evans <dje@google.com>
>> >> Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, gdb-patches <gdb-patches@sourceware.org>
>> >>
>> >> The nice thing about {relative,basename}-with-system-absolute is that
>> >> they are clear.
>> >
>> > They aren't to me.  They might be clear _after_ you know what they
>> > mean, exactly.  But then so would be every shorthand of them.
>>
>> So then why not reduce them even more?
>
> That could work, but hard to tell without seeing specific suggestions.

Apologies.  My point was that at some point things become too terse.
Names aren't just mnemonics to trigger memory - ideally they shouldn't
have to trigger any memory as the name is already clear.

What about basename-with-system-absolute is not clearer than basename-absolute?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-02-01  3:41                   ` Doug Evans
@ 2013-02-01  8:09                     ` Eli Zaretskii
  0 siblings, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2013-02-01  8:09 UTC (permalink / raw)
  To: Doug Evans; +Cc: jan.kratochvil, gdb-patches

> Date: Thu, 31 Jan 2013 19:41:31 -0800
> From: Doug Evans <dje@google.com>
> Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, gdb-patches <gdb-patches@sourceware.org>
> 
> What about basename-with-system-absolute is not clearer than basename-absolute?

What isn't clear is _when_ absolute file names are printed.
"With-system" is not specific/descriptive enough to tell that.  I can
come up with shorter names with the same deficiency, such as
basename-or-absolute or basename-ifnot-system or even mostly-basename.

IOW, as long as the name itself does not eliminate the need to consult
the documentation, I see no justification for longer names.  A long
name that would not need to consult documentation would be something
like

  basename-but-if-from-system-libraries-then-absolute

but is, of course, preposterously long.

(I'm OK with ending this bykeshedding; I just wanted to explain why I
think the suggested names can be shrunk considerably without hampering
user experience in any way.  I would be happy to come up with
significantly better, but shorter names, but I cannot.)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-30  7:48 ` [patchv3 " Jan Kratochvil
  2013-01-30 17:15   ` Eli Zaretskii
@ 2013-02-01 20:59   ` Tom Tromey
  1 sibling, 0 replies; 14+ messages in thread
From: Tom Tromey @ 2013-02-01 20:59 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> So a combination of absolute filenames for system component and relative
Jan> filenames for user binaries should be the best of both choices.

FWIW I think this makes sense.

Tom


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patchv3 12/11] New options {relative,basename}-with-system-absolute
  2013-01-30 17:15   ` Eli Zaretskii
  2013-01-30 18:30     ` Eli Zaretskii
@ 2013-02-02 18:12     ` Jan Kratochvil
  1 sibling, 0 replies; 14+ messages in thread
From: Jan Kratochvil @ 2013-02-02 18:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

On Wed, 30 Jan 2013 18:15:07 +0100, Eli Zaretskii wrote:
> > +@item set filename-display basename-with-system-absolute
> > +Determine whether a source filename comes from file having separate debug
> > +information file.  In such case display the source filename as absolute one.
> > +Otherwise display only basename of the filename.
> 
> Similarly here: start with "Display ..." as this what the option
> controls.

used:
	debug info, and all the other source file names only as their basenames.


Thanks,
Jan


gdb/
2013-01-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* NEWS (set filename-display): Add options
	relative-with-system-absolute and basename-with-system-absolute.
	* source.c (filename_display_relative_with_system_absolute)
	(filename_display_basename_with_system_absolute): New.
	(filename_display_kind_names): Add them.
	(symtab_to_filename_for_display): Use them.
	(_initialize_source): Describe them for "set filename-display".

gdb/doc/
2013-01-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.texinfo (Backtrace): Add new set filename-display options
	relative-with-system-absolute and basename-with-system-absolute.

--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -115,7 +115,8 @@ show print type typedefs
   Control whether typedef definitions are displayed by "ptype".
   The default is to show them.
 
-set filename-display basename|relative|absolute
+set filename-display basename|relative|absolute|relative-with-system-absolute
+                     |basename-with-system-absolute
 show filename-display
   Control the way in which filenames is displayed.
   The default is "relative", which preserves previous behavior.
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -6549,6 +6549,18 @@ Display only basename of a filename.
 @item set filename-display absolute
 Display an absolute filename.
 
+@item set filename-display relative-with-system-absolute
+Display as absolute those source file names that come from files with separate
+debug info, and all the other source file names as relative to their
+compilation directory.
+
+Files having separate debug information file are expected to come from system
+shared libraries.
+
+@item set filename-display basename-with-system-absolute
+Display as absolute those source file names that come from files with separate
+debug info, and all the other source file names only as their basenames.
+
 @item show filename-display
 Show the current way to display filenames.
 @end table
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -113,11 +113,17 @@ show_lines_to_list (struct ui_file *file, int from_tty,
 static const char filename_display_basename[] = "basename";
 static const char filename_display_relative[] = "relative";
 static const char filename_display_absolute[] = "absolute";
+static const char filename_display_relative_with_system_absolute[] =
+						"relative-with-system-absolute";
+static const char filename_display_basename_with_system_absolute[] =
+						"basename-with-system-absolute";
 
 static const char *const filename_display_kind_names[] = {
   filename_display_basename,
   filename_display_relative,
   filename_display_absolute,
+  filename_display_relative_with_system_absolute,
+  filename_display_basename_with_system_absolute,
   NULL
 };
 
@@ -1144,8 +1150,16 @@ symtab_to_filename_for_display (struct symtab *symtab)
     return symtab_to_fullname (symtab);
   else if (filename_display_string == filename_display_relative)
     return symtab->filename;
-  else
-    internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
+
+  if (symtab->objfile->separate_debug_objfile != NULL
+      || symtab->objfile->separate_debug_objfile_backlink != NULL)
+    return symtab_to_fullname (symtab);
+
+  if (filename_display_string == filename_display_relative_with_system_absolute)
+    return symtab->filename;
+  if (filename_display_string == filename_display_basename_with_system_absolute)
+    return lbasename (symtab->filename);
+  internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
 }
 \f
 /* Create and initialize the table S->line_charpos that records
@@ -2071,6 +2085,13 @@ filename-display can be:\n\
   basename - display only basename of a filename\n\
   relative - display a filename relative to the compilation directory\n\
   absolute - display an absolute filename\n\
+  relative-with-system-absolute - display filenames from files with separate\n\
+                                  debug info files as absolute, other files\n\
+                                  display relative to the compilation directory\
+\n\
+  basename-with-system-absolute - display filenames from files with separate\n\
+                                  debug info files as absolute, other files\n\
+                                  display only with basename of the filename\n\
 By default, relative filenames are displayed."),
 			NULL,
 			show_filename_display_string,


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-02-02 18:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29 22:10 [patchv2 12/11] New options {relative,basename}-with-system-absolute Jan Kratochvil
2013-01-30  7:48 ` [patchv3 " Jan Kratochvil
2013-01-30 17:15   ` Eli Zaretskii
2013-01-30 18:30     ` Eli Zaretskii
2013-01-30 18:53       ` Jan Kratochvil
2013-01-30 20:11         ` Eli Zaretskii
2013-01-30 21:48           ` Doug Evans
2013-01-31  3:49             ` Eli Zaretskii
2013-01-31 18:07               ` Doug Evans
2013-01-31 18:54                 ` Eli Zaretskii
2013-02-01  3:41                   ` Doug Evans
2013-02-01  8:09                     ` Eli Zaretskii
2013-02-02 18:12     ` Jan Kratochvil
2013-02-01 20:59   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox