* [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
@ 2013-02-15 20:25 Jan Kratochvil
2013-02-16 8:33 ` Eli Zaretskii
2013-02-27 19:38 ` Jan Kratochvil
0 siblings, 2 replies; 15+ messages in thread
From: Jan Kratochvil @ 2013-02-15 20:25 UTC (permalink / raw)
To: gdb-patches
Hi,
this mail obsoletes:
[patchv2 12/11] New options {relative,basename}-with-system-absolute
http://sourceware.org/ml/gdb-patches/2013-01/msg00700.html
Message-ID: <20130129221019.GA27463@host2.jankratochvil.net>
to address Doug's argument
http://sourceware.org/ml/gdb-patches/2013-02/msg00193.html
Message-ID: <CADPb22TatUwO6qL6sJEr8HRhjJR_Q66de7zhFdLA81hToNuJjA@mail.gmail.com>
> "system" is being conflated with "separate debug info", and I'm not
> comfortable with that.
In the patch below I had optimization of "show filename-display" to display a
single line if all the 4 options were set to the same value.
(gdb) show filename-display
Filenames are displayed as "relative".
But later I found it rather confusing and despite one can type:
(gdb) set filename-display relative
GDB will then still display now explicitly:
(gdb) show filename-display
executable: Filenames in executable with embedded debug info are displayed as "relative".
executable-with-separate-debug-info: Filenames in executable with separate debug info are displayed as "relative".
libraries: Filenames in shared libraries with embedded debug info are displayed as "relative".
libraries-with-separate-debug-info: Filenames in shared libraries with separate debug info are displayed as "relative".
I can return the single-line display back if anyone thinks so.
No regressions on {x86_64,x86_64-m32,i686}-fedora19pre-linux-gnu.
Thanks,
Jan
gdb/
2013-02-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (set filename-display executable)
(set filename-display libraries)
(set filename-display executable-with-separate-debug-info)
(set filename-display libraries-with-separate-debug-info)
(show filename-display executable)
(show filename-display libraries)
(show filename-display executable-with-separate-debug-info)
(show filename-display libraries-with-separate-debug-info): New. Also
say for all the options.
* source.c: Include cli/cli-decode.h and cli/cli-setshow.h.
(filename_display_string): Remove.
(filename_display_executable_string)
(filename_display_libraries_string)
(filename_display_executable_sepdebug_string)
(filename_display_libraries_sepdebug_string): New.
(show_filename_display_string): Remove.
(show_filename_display_executable_string)
(show_filename_display_libraries_string)
(show_filename_display_executable_sepdebug_string)
(show_filename_display_libraries_sepdebug_string): New.
(symtab_to_filename_for_display): Follow the new variables.
(filename_display_set_cmdlist, filename_display_show_cmdlist)
(set_filename_display_cmd, set_filename_display_1)
(set_filename_display_basename_string)
(set_filename_display_relative_string)
(set_filename_display_absolute_string, show_filename_display_cmd): New.
(_initialize_source): New variables filename_display_doc and doc.
Initialize filename_display_doc. Remove add_setshow_enum_cmd for
filename-display. Add filename_display_set_cmdlist and
filename_display_show_cmdlist initializations by add_prefix_cmd.
Add add_setshow_enum_cmd for executable, libraries,
executable-with-separate-debug-info and
libraries-with-separate-debug-info. Add add_cmd for basename, relative
and absolute.
gdb/doc/
2013-02-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Backtrace): Extend the show filename-display description.
New description for set filename-display executable, set
filename-display libraries, set filename-display
executable-with-separate-debug-info, set filename-display
libraries-with-separate-debug-info, show filename-display executable,
show filename-display libraries, show filename-display
executable-with-separate-debug-info and show filename-display
libraries-with-separate-debug-info.
(Files): New anchor file command.
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -123,9 +123,20 @@ show print type typedefs
The default is to show them.
set filename-display basename|relative|absolute
+set filename-display executable basename|relative|absolute
+set filename-display libraries basename|relative|absolute
+set filename-display executable-with-separate-debug-info basename|relative
+ |absolute
+set filename-display libraries-with-separate-debug-info basename|relative
+ |absolute
show filename-display
+show filename-display executable
+show filename-display libraries
+show filename-display executable-with-separate-debug-info
+show filename-display libraries-with-separate-debug-info
Control the way in which filenames is displayed.
- The default is "relative", which preserves previous behavior.
+ The default is "relative" for all the options, which preserves previous
+ behavior.
* MI changes
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -6539,7 +6539,11 @@ You can control how file names are displayed.
@table @code
@item set filename-display
-@itemx set filename-display relative
+Set how to display filenames coming from any file. One can make this setting
+more specific to the inferior file kind below. Using this command will set the
+same value for all the four kinds of inferior files as described below.
+
+@item set filename-display relative
@cindex filename-display
Display file names relative to the compilation directory. This is the default.
@@ -6550,7 +6554,53 @@ Display only basename of a filename.
Display an absolute filename.
@item show filename-display
-Show the current way to display filenames.
+Show the current way to display filenames. Setting for each of the four kinds
+of inferior files (as described below) will be displayed.
+@end table
+
+If you want to set the displayed filenames kind more specifically you can use
+the following option.
+
+Files having separate debug information file usually come from system shared
+libraries where may be more appropriate to display filenames in their absolute
+form.
+
+@table @code
+@item set filename-display executable @{relative|basename|absolute@}
+Set how to display filenames coming from the inferior executable, as set by the
+@ref{file command}. Inferior executable has to use embedded debug info as is
+usually found in binaries compiled by @value{GDBN} user.
+
+@item show filename-display executable
+Show the current way to display filenames coming from the inferior executable
+with embedded debug info.
+
+@item set filename-display libraries @{relative|basename|absolute@}
+Set how to display filenames coming from inferior shared libraries. The shared
+libraries have to use embedded debug info as is usually found in shared
+libraries compiled by @value{GDBN} user.
+
+@item show filename-display libraries
+Show the current way to display filenames coming from the inferior shared
+libraries with embedded debug info.
+
+@item set filename-display executable-with-separate-debug-info @{@dots{}@}
+Set how to display filenames coming from the inferior executable, as set by the
+@ref{file command}. Inferior executable has to use separate debug info file as
+is usually optionally provided by operating system debug info packages.
+
+@item show filename-display executable-with-separate-debug-info
+Show the current way to display filenames coming from the inferior executable
+with separate debug info file.
+
+@item set filename-display libraries-with-separate-debug-info @{@dots{}@}
+Set how to display filenames coming from inferior shared libraries. The shared
+libraries have to use separate debug info files as are usually found in shared
+libraries optionally provided by operating system debug info packages.
+
+@item show filename-display libraries-with-separate-debug-info
+Show the current way to display filenames coming from the inferior shared
+libraries with separate debug info file.
@end table
@node Selection
@@ -15941,6 +15991,7 @@ Program}). In these situations the @value{GDBN} commands to specify
new files are useful.
@table @code
+@anchor{file command}
@cindex executable file
@kindex file
@item file @var{filename}
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -43,6 +43,8 @@
#include "completer.h"
#include "ui-out.h"
#include "readline/readline.h"
+#include "cli/cli-decode.h"
+#include "cli/cli-setshow.h"
#include "psymtab.h"
@@ -121,13 +123,72 @@ static const char *const filename_display_kind_names[] = {
NULL
};
-static const char *filename_display_string = filename_display_relative;
+/* Setting for "set filename-display executable". */
+static const char *filename_display_executable_string =
+ filename_display_relative;
+
+/* Setting for "set filename-display libraries". */
+static const char *filename_display_libraries_string =
+ filename_display_relative;
+
+/* Setting for "set filename-display executable-with-separate-debug-info". */
+static const char *filename_display_executable_sepdebug_string =
+ filename_display_relative;
+
+/* Setting for "set filename-display libraries-with-separate-debug-info". */
+static const char *filename_display_libraries_sepdebug_string =
+ filename_display_relative;
+
+/* Implement command "show filename-display executable". */
+
+static void
+show_filename_display_executable_string (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("Filenames in executable with embedded "
+ "debug info are displayed as \"%s\".\n"),
+ value);
+}
+
+/* Implement command "show filename-display libraries". */
static void
-show_filename_display_string (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_filename_display_libraries_string (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
- fprintf_filtered (file, _("Filenames are displayed as \"%s\".\n"), value);
+ fprintf_filtered (file, _("Filenames in shared libraries with embedded "
+ "debug info are displayed as \"%s\".\n"),
+ value);
+}
+
+/* Implement command
+ "show filename-display executable-with-separate-debug-info". */
+
+static void
+show_filename_display_executable_sepdebug_string (struct ui_file *file,
+ int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("Filenames in executable with separate "
+ "debug info are displayed as \"%s\".\n"),
+ value);
+}
+
+/* Implement command
+ "show filename-display libraries-with-separate-debug-info". */
+
+static void
+show_filename_display_libraries_sepdebug_string (struct ui_file *file,
+ int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("Filenames in shared libraries with separate "
+ "debug info are displayed as \"%s\".\n"),
+ value);
}
/* Line number of last line printed. Default for various commands.
@@ -1138,14 +1199,34 @@ symtab_to_fullname (struct symtab *s)
const char *
symtab_to_filename_for_display (struct symtab *symtab)
{
- if (filename_display_string == filename_display_basename)
+ struct objfile *objfile = symtab->objfile;
+ int has_sepdebug, is_executable;
+ const char *setting;
+
+ if (objfile->separate_debug_objfile_backlink != NULL)
+ objfile = objfile->separate_debug_objfile_backlink;
+ has_sepdebug = objfile->separate_debug_objfile != NULL;
+ is_executable = objfile == symfile_objfile;
+
+ if (is_executable && !has_sepdebug)
+ setting = filename_display_executable_string;
+ if (!is_executable && !has_sepdebug)
+ setting = filename_display_libraries_string;
+ if (is_executable && has_sepdebug)
+ setting = filename_display_executable_sepdebug_string;
+ if (!is_executable && has_sepdebug)
+ setting = filename_display_libraries_sepdebug_string;
+ if (setting == NULL)
+ internal_error (__FILE__, __LINE__,
+ _("symtab_to_filename_for_display setting == NULL"));
+
+ if (setting == filename_display_basename)
return lbasename (symtab->filename);
- else if (filename_display_string == filename_display_absolute)
+ else if (setting == filename_display_absolute)
return symtab_to_fullname (symtab);
- else if (filename_display_string == filename_display_relative)
+ else if (setting == filename_display_relative)
return symtab->filename;
- else
- internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
+ internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
}
\f
/* Create and initialize the table S->line_charpos that records
@@ -1945,11 +2026,85 @@ set_substitute_path_command (char *args, int from_tty)
forget_cached_source_info ();
}
+/* The list of commands prefixed by "set filename-display". */
+static struct cmd_list_element *filename_display_set_cmdlist;
+
+/* The list of commands prefixed by "show filename-display". */
+static struct cmd_list_element *filename_display_show_cmdlist;
+
+/* Implement command "set filename-display" itself. */
+
+static void
+set_filename_display_cmd (char *args, int from_tty)
+{
+ error (_("Value \"basename\", \"relative\" or \"absolute\" set for all "
+ "sub-categories expected.\n"
+ "More specific category \"executable\", \"libraries\", "
+ "\"executable-with-separate-debug-info\" or "
+ "\"libraries-with-separate-debug-info\" may be also specified."));
+}
+
+/* Set all sub-values of the "set filename-display" setting to KIND. */
+
+static void
+set_filename_display_1 (const char *kind, int from_tty)
+{
+ struct cmd_list_element *list;
+
+ for (list = filename_display_set_cmdlist; list != NULL; list = list->next)
+ if (list->type == set_cmd)
+ do_set_command ((char *) kind, from_tty, list);
+}
+
+/* Implement command "set filename-display basename". */
+
+static void
+set_filename_display_basename_string (char *args, int from_tty)
+{
+ if (args != NULL && *args != 0)
+ error (_("Command has no parameters."));
+
+ set_filename_display_1 ("basename", from_tty);
+}
+
+/* Implement command "set filename-display relative". */
+
+static void
+set_filename_display_relative_string (char *args, int from_tty)
+{
+ if (args != NULL && *args != 0)
+ error (_("Command has no parameters."));
+
+ set_filename_display_1 ("relative", from_tty);
+}
+
+/* Implement command "set filename-display absolute". */
+
+static void
+set_filename_display_absolute_string (char *args, int from_tty)
+{
+ if (args != NULL && *args != 0)
+ error (_("Command has no parameters."));
+
+ set_filename_display_1 ("absolute", from_tty);
+}
+
+/* Command "show filename-display" displays summary of all the current
+ "show filename-display " settings. */
+
+static void
+show_filename_display_cmd (char *args, int from_tty)
+{
+ cmd_show_list (filename_display_show_cmdlist, from_tty, "");
+}
+
\f
void
_initialize_source (void)
{
struct cmd_list_element *c;
+ const char *filename_display_doc;
+ char *doc;
current_source_symtab = 0;
init_source_path ();
@@ -2062,18 +2217,87 @@ Print the rule for substituting FROM in source file names. If FROM\n\
is not specified, print all substitution rules."),
&showlist);
- add_setshow_enum_cmd ("filename-display", class_files,
- filename_display_kind_names,
- &filename_display_string, _("\
-Set how to display filenames."), _("\
-Show how to display filenames."), _("\
+ filename_display_doc = _("\
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\
By default, relative filenames are displayed."),
- NULL,
- show_filename_display_string,
- &setlist, &showlist);
+ doc = xstrprintf (_("\
+Set how to display filenames for all categories of files.\n\
+%s"),
+ filename_display_doc);
+ add_prefix_cmd ("filename-display", class_files, set_filename_display_cmd,
+ doc, &filename_display_set_cmdlist, "set filename-display ",
+ 0/*allow-unknown*/, &setlist);
+ xfree (doc);
+
+ doc = xstrprintf (_("\
+Show how to display filenames for all categories of files.\n\
+%s"),
+ filename_display_doc);
+ add_prefix_cmd ("filename-display", class_files, show_filename_display_cmd,
+ doc, &filename_display_show_cmdlist, "show filename-display ",
+ 0/*allow-unknown*/, &showlist);
+ xfree (doc);
+
+ add_setshow_enum_cmd ("executable", class_files,
+ filename_display_kind_names,
+ &filename_display_executable_string, _("\
+Set how to display filenames in executable with embedded debug info."), _("\
+Show how to display filenames in executable with embedded debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_executable_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_setshow_enum_cmd ("libraries", class_files,
+ filename_display_kind_names,
+ &filename_display_libraries_string, _("\
+Set how to display filenames in libraries with embedded debug info."), _("\
+Show how to display filenames in libraries with embedded debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_libraries_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_setshow_enum_cmd ("executable-with-separate-debug-info", class_files,
+ filename_display_kind_names,
+ &filename_display_executable_sepdebug_string, _("\
+Set how to display filenames in executable with separate debug info."), _("\
+Show how to display filenames in executable with separate debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_executable_sepdebug_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_setshow_enum_cmd ("libraries-with-separate-debug-info", class_files,
+ filename_display_kind_names,
+ &filename_display_libraries_sepdebug_string, _("\
+Set how to display filenames in libraries with separate debug info."), _("\
+Show how to display filenames in libraries with separate debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_libraries_sepdebug_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_cmd ("basename", class_files, set_filename_display_basename_string,
+ _("\
+Set displaying of filenames to basename for all categories of files.\n\
+See \"help set display-filename\" for other options of this setting."),
+ &filename_display_set_cmdlist);
+
+ add_cmd ("relative", class_files, set_filename_display_relative_string,
+ _("\
+Set displaying of filenames as relative for all categories of files.\n\
+Filename is displayed relative to the compilation directory\n\
+See \"help set display-filename\" for other options of this setting."),
+ &filename_display_set_cmdlist);
+
+ add_cmd ("absolute", class_files, set_filename_display_absolute_string,
+ _("\
+Set displaying of filenames as absolute for all categories of files.\n\
+See \"help set display-filename\" for other options of this setting."),
+ &filename_display_set_cmdlist);
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-02-15 20:25 [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug} Jan Kratochvil
@ 2013-02-16 8:33 ` Eli Zaretskii
2013-02-18 14:33 ` Jan Kratochvil
2013-02-27 19:38 ` Jan Kratochvil
1 sibling, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2013-02-16 8:33 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
> Date: Fri, 15 Feb 2013 21:25:36 +0100
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -123,9 +123,20 @@ show print type typedefs
> The default is to show them.
>
> set filename-display basename|relative|absolute
> +set filename-display executable basename|relative|absolute
> +set filename-display libraries basename|relative|absolute
> +set filename-display executable-with-separate-debug-info basename|relative
> + |absolute
> +set filename-display libraries-with-separate-debug-info basename|relative
> + |absolute
> show filename-display
> +show filename-display executable
> +show filename-display libraries
> +show filename-display executable-with-separate-debug-info
> +show filename-display libraries-with-separate-debug-info
> Control the way in which filenames is displayed.
> - The default is "relative", which preserves previous behavior.
> + The default is "relative" for all the options, which preserves previous
> + behavior.
OK for this part.
> +@item set filename-display executable @{relative|basename|absolute@}
> +Set how to display filenames coming from the inferior executable, as set by the
> +@ref{file command}. Inferior executable has to use embedded debug info as is
> +usually found in binaries compiled by @value{GDBN} user.
Here and elsewhere, I think, instead of a separate sentence saying "FOO
has to use BAR debug info", it is better to say "... when FOO uses BAR
debug info" in the same sentence. For example:
Set how to display filenames coming from the inferior executable, as
set by the @ref{file command}, when the inferior executable uses
embedded debug info as found in binaries compiled normally.
Otherwise, OK.
Thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-02-16 8:33 ` Eli Zaretskii
@ 2013-02-18 14:33 ` Jan Kratochvil
2013-02-18 16:27 ` Eli Zaretskii
0 siblings, 1 reply; 15+ messages in thread
From: Jan Kratochvil @ 2013-02-18 14:33 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On Sat, 16 Feb 2013 09:32:34 +0100, Eli Zaretskii wrote:
> Here and elsewhere, I think, instead of a separate sentence saying "FOO
> has to use BAR debug info", it is better to say "... when FOO uses BAR
> debug info" in the same sentence. For example:
>
> Set how to display filenames coming from the inferior executable, as
> set by the @ref{file command}, when the inferior executable uses
> embedded debug info as found in binaries compiled normally.
Done; the changed parts may need a new review.
Thanks,
Jan
gdb/
2013-02-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (set filename-display executable)
(set filename-display libraries)
(set filename-display executable-with-separate-debug-info)
(set filename-display libraries-with-separate-debug-info)
(show filename-display executable)
(show filename-display libraries)
(show filename-display executable-with-separate-debug-info)
(show filename-display libraries-with-separate-debug-info): New. Also
say for all the options.
* source.c: Include cli/cli-decode.h and cli/cli-setshow.h.
(filename_display_string): Remove.
(filename_display_executable_string)
(filename_display_libraries_string)
(filename_display_executable_sepdebug_string)
(filename_display_libraries_sepdebug_string): New.
(show_filename_display_string): Remove.
(show_filename_display_executable_string)
(show_filename_display_libraries_string)
(show_filename_display_executable_sepdebug_string)
(show_filename_display_libraries_sepdebug_string): New.
(symtab_to_filename_for_display): Follow the new variables.
(filename_display_set_cmdlist, filename_display_show_cmdlist)
(set_filename_display_cmd, set_filename_display_1)
(set_filename_display_basename_string)
(set_filename_display_relative_string)
(set_filename_display_absolute_string, show_filename_display_cmd): New.
(_initialize_source): New variables filename_display_doc and doc.
Initialize filename_display_doc. Remove add_setshow_enum_cmd for
filename-display. Add filename_display_set_cmdlist and
filename_display_show_cmdlist initializations by add_prefix_cmd.
Add add_setshow_enum_cmd for executable, libraries,
executable-with-separate-debug-info and
libraries-with-separate-debug-info. Add add_cmd for basename, relative
and absolute.
gdb/doc/
2013-02-18 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Backtrace): Extend the show filename-display description.
New description for set filename-display executable, set
filename-display libraries, set filename-display
executable-with-separate-debug-info, set filename-display
libraries-with-separate-debug-info, show filename-display executable,
show filename-display libraries, show filename-display
executable-with-separate-debug-info and show filename-display
libraries-with-separate-debug-info.
(Files): New anchor file command.
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -123,9 +123,20 @@ show print type typedefs
The default is to show them.
set filename-display basename|relative|absolute
+set filename-display executable basename|relative|absolute
+set filename-display libraries basename|relative|absolute
+set filename-display executable-with-separate-debug-info basename|relative
+ |absolute
+set filename-display libraries-with-separate-debug-info basename|relative
+ |absolute
show filename-display
+show filename-display executable
+show filename-display libraries
+show filename-display executable-with-separate-debug-info
+show filename-display libraries-with-separate-debug-info
Control the way in which filenames is displayed.
- The default is "relative", which preserves previous behavior.
+ The default is "relative" for all the options, which preserves previous
+ behavior.
* MI changes
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -6539,7 +6539,11 @@ You can control how file names are displayed.
@table @code
@item set filename-display
-@itemx set filename-display relative
+Set how to display filenames coming from any file. One can make this setting
+more specific to the inferior file kind below. Using this command will set the
+same value for all the four kinds of inferior files as described below.
+
+@item set filename-display relative
@cindex filename-display
Display file names relative to the compilation directory. This is the default.
@@ -6550,7 +6554,53 @@ Display only basename of a filename.
Display an absolute filename.
@item show filename-display
-Show the current way to display filenames.
+Show the current way to display filenames. Setting for each of the four kinds
+of inferior files (as described below) will be displayed.
+@end table
+
+If you want to set the displayed filenames kind more specifically you can use
+the following option.
+
+Files having separate debug information file usually come from system shared
+libraries where may be more appropriate to display filenames in their absolute
+form.
+
+@table @code
+@item set filename-display executable @{relative|basename|absolute@}
+Set how to display filenames coming from the inferior executable, as set by the
+@ref{file command}, when the inferior executable uses embedded debug info as
+found in binaries compiled normally.
+
+@item show filename-display executable
+Show the current way to display filenames coming from the inferior executable
+with embedded debug info.
+
+@item set filename-display libraries @{relative|basename|absolute@}
+Set how to display filenames coming from inferior shared libraries, when the
+shared libraries use embedded debug info as found in binaries compiled
+normally.
+
+@item show filename-display libraries
+Show the current way to display filenames coming from the inferior shared
+libraries with embedded debug info.
+
+@item set filename-display executable-with-separate-debug-info @{@dots{}@}
+Set how to display filenames coming from the inferior executable, as set by the
+@ref{file command}, when the inferior executable uses separate debug info file
+which is usually optionally provided by operating system debug info packages.
+
+@item show filename-display executable-with-separate-debug-info
+Show the current way to display filenames coming from the inferior executable
+with separate debug info file.
+
+@item set filename-display libraries-with-separate-debug-info @{@dots{}@}
+Set how to display filenames coming from inferior shared libraries, when the
+shared libraries use separate debug info files which are usually optionally
+provided by operating system debug info packages.
+
+@item show filename-display libraries-with-separate-debug-info
+Show the current way to display filenames coming from the inferior shared
+libraries with separate debug info file.
@end table
@node Selection
@@ -15941,6 +15991,7 @@ Program}). In these situations the @value{GDBN} commands to specify
new files are useful.
@table @code
+@anchor{file command}
@cindex executable file
@kindex file
@item file @var{filename}
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -43,6 +43,8 @@
#include "completer.h"
#include "ui-out.h"
#include "readline/readline.h"
+#include "cli/cli-decode.h"
+#include "cli/cli-setshow.h"
#include "psymtab.h"
@@ -121,13 +123,72 @@ static const char *const filename_display_kind_names[] = {
NULL
};
-static const char *filename_display_string = filename_display_relative;
+/* Setting for "set filename-display executable". */
+static const char *filename_display_executable_string =
+ filename_display_relative;
+
+/* Setting for "set filename-display libraries". */
+static const char *filename_display_libraries_string =
+ filename_display_relative;
+
+/* Setting for "set filename-display executable-with-separate-debug-info". */
+static const char *filename_display_executable_sepdebug_string =
+ filename_display_relative;
+
+/* Setting for "set filename-display libraries-with-separate-debug-info". */
+static const char *filename_display_libraries_sepdebug_string =
+ filename_display_relative;
+
+/* Implement command "show filename-display executable". */
+
+static void
+show_filename_display_executable_string (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("Filenames in executable with embedded "
+ "debug info are displayed as \"%s\".\n"),
+ value);
+}
+
+/* Implement command "show filename-display libraries". */
static void
-show_filename_display_string (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_filename_display_libraries_string (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
- fprintf_filtered (file, _("Filenames are displayed as \"%s\".\n"), value);
+ fprintf_filtered (file, _("Filenames in shared libraries with embedded "
+ "debug info are displayed as \"%s\".\n"),
+ value);
+}
+
+/* Implement command
+ "show filename-display executable-with-separate-debug-info". */
+
+static void
+show_filename_display_executable_sepdebug_string (struct ui_file *file,
+ int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("Filenames in executable with separate "
+ "debug info are displayed as \"%s\".\n"),
+ value);
+}
+
+/* Implement command
+ "show filename-display libraries-with-separate-debug-info". */
+
+static void
+show_filename_display_libraries_sepdebug_string (struct ui_file *file,
+ int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("Filenames in shared libraries with separate "
+ "debug info are displayed as \"%s\".\n"),
+ value);
}
/* Line number of last line printed. Default for various commands.
@@ -1138,14 +1199,34 @@ symtab_to_fullname (struct symtab *s)
const char *
symtab_to_filename_for_display (struct symtab *symtab)
{
- if (filename_display_string == filename_display_basename)
+ struct objfile *objfile = symtab->objfile;
+ int has_sepdebug, is_executable;
+ const char *setting;
+
+ if (objfile->separate_debug_objfile_backlink != NULL)
+ objfile = objfile->separate_debug_objfile_backlink;
+ has_sepdebug = objfile->separate_debug_objfile != NULL;
+ is_executable = objfile == symfile_objfile;
+
+ if (is_executable && !has_sepdebug)
+ setting = filename_display_executable_string;
+ if (!is_executable && !has_sepdebug)
+ setting = filename_display_libraries_string;
+ if (is_executable && has_sepdebug)
+ setting = filename_display_executable_sepdebug_string;
+ if (!is_executable && has_sepdebug)
+ setting = filename_display_libraries_sepdebug_string;
+ if (setting == NULL)
+ internal_error (__FILE__, __LINE__,
+ _("symtab_to_filename_for_display setting == NULL"));
+
+ if (setting == filename_display_basename)
return lbasename (symtab->filename);
- else if (filename_display_string == filename_display_absolute)
+ else if (setting == filename_display_absolute)
return symtab_to_fullname (symtab);
- else if (filename_display_string == filename_display_relative)
+ else if (setting == filename_display_relative)
return symtab->filename;
- else
- internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
+ internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
}
\f
/* Create and initialize the table S->line_charpos that records
@@ -1945,11 +2026,85 @@ set_substitute_path_command (char *args, int from_tty)
forget_cached_source_info ();
}
+/* The list of commands prefixed by "set filename-display". */
+static struct cmd_list_element *filename_display_set_cmdlist;
+
+/* The list of commands prefixed by "show filename-display". */
+static struct cmd_list_element *filename_display_show_cmdlist;
+
+/* Implement command "set filename-display" itself. */
+
+static void
+set_filename_display_cmd (char *args, int from_tty)
+{
+ error (_("Value \"basename\", \"relative\" or \"absolute\" set for all "
+ "sub-categories expected.\n"
+ "More specific category \"executable\", \"libraries\", "
+ "\"executable-with-separate-debug-info\" or "
+ "\"libraries-with-separate-debug-info\" may be also specified."));
+}
+
+/* Set all sub-values of the "set filename-display" setting to KIND. */
+
+static void
+set_filename_display_1 (const char *kind, int from_tty)
+{
+ struct cmd_list_element *list;
+
+ for (list = filename_display_set_cmdlist; list != NULL; list = list->next)
+ if (list->type == set_cmd)
+ do_set_command ((char *) kind, from_tty, list);
+}
+
+/* Implement command "set filename-display basename". */
+
+static void
+set_filename_display_basename_string (char *args, int from_tty)
+{
+ if (args != NULL && *args != 0)
+ error (_("Command has no parameters."));
+
+ set_filename_display_1 ("basename", from_tty);
+}
+
+/* Implement command "set filename-display relative". */
+
+static void
+set_filename_display_relative_string (char *args, int from_tty)
+{
+ if (args != NULL && *args != 0)
+ error (_("Command has no parameters."));
+
+ set_filename_display_1 ("relative", from_tty);
+}
+
+/* Implement command "set filename-display absolute". */
+
+static void
+set_filename_display_absolute_string (char *args, int from_tty)
+{
+ if (args != NULL && *args != 0)
+ error (_("Command has no parameters."));
+
+ set_filename_display_1 ("absolute", from_tty);
+}
+
+/* Command "show filename-display" displays summary of all the current
+ "show filename-display " settings. */
+
+static void
+show_filename_display_cmd (char *args, int from_tty)
+{
+ cmd_show_list (filename_display_show_cmdlist, from_tty, "");
+}
+
\f
void
_initialize_source (void)
{
struct cmd_list_element *c;
+ const char *filename_display_doc;
+ char *doc;
current_source_symtab = 0;
init_source_path ();
@@ -2062,18 +2217,87 @@ Print the rule for substituting FROM in source file names. If FROM\n\
is not specified, print all substitution rules."),
&showlist);
- add_setshow_enum_cmd ("filename-display", class_files,
- filename_display_kind_names,
- &filename_display_string, _("\
-Set how to display filenames."), _("\
-Show how to display filenames."), _("\
+ filename_display_doc = _("\
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\
By default, relative filenames are displayed."),
- NULL,
- show_filename_display_string,
- &setlist, &showlist);
+ doc = xstrprintf (_("\
+Set how to display filenames for all categories of files.\n\
+%s"),
+ filename_display_doc);
+ add_prefix_cmd ("filename-display", class_files, set_filename_display_cmd,
+ doc, &filename_display_set_cmdlist, "set filename-display ",
+ 0/*allow-unknown*/, &setlist);
+ xfree (doc);
+
+ doc = xstrprintf (_("\
+Show how to display filenames for all categories of files.\n\
+%s"),
+ filename_display_doc);
+ add_prefix_cmd ("filename-display", class_files, show_filename_display_cmd,
+ doc, &filename_display_show_cmdlist, "show filename-display ",
+ 0/*allow-unknown*/, &showlist);
+ xfree (doc);
+
+ add_setshow_enum_cmd ("executable", class_files,
+ filename_display_kind_names,
+ &filename_display_executable_string, _("\
+Set how to display filenames in executable with embedded debug info."), _("\
+Show how to display filenames in executable with embedded debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_executable_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_setshow_enum_cmd ("libraries", class_files,
+ filename_display_kind_names,
+ &filename_display_libraries_string, _("\
+Set how to display filenames in libraries with embedded debug info."), _("\
+Show how to display filenames in libraries with embedded debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_libraries_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_setshow_enum_cmd ("executable-with-separate-debug-info", class_files,
+ filename_display_kind_names,
+ &filename_display_executable_sepdebug_string, _("\
+Set how to display filenames in executable with separate debug info."), _("\
+Show how to display filenames in executable with separate debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_executable_sepdebug_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_setshow_enum_cmd ("libraries-with-separate-debug-info", class_files,
+ filename_display_kind_names,
+ &filename_display_libraries_sepdebug_string, _("\
+Set how to display filenames in libraries with separate debug info."), _("\
+Show how to display filenames in libraries with separate debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_libraries_sepdebug_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_cmd ("basename", class_files, set_filename_display_basename_string,
+ _("\
+Set displaying of filenames to basename for all categories of files.\n\
+See \"help set display-filename\" for other options of this setting."),
+ &filename_display_set_cmdlist);
+
+ add_cmd ("relative", class_files, set_filename_display_relative_string,
+ _("\
+Set displaying of filenames as relative for all categories of files.\n\
+Filename is displayed relative to the compilation directory\n\
+See \"help set display-filename\" for other options of this setting."),
+ &filename_display_set_cmdlist);
+
+ add_cmd ("absolute", class_files, set_filename_display_absolute_string,
+ _("\
+Set displaying of filenames as absolute for all categories of files.\n\
+See \"help set display-filename\" for other options of this setting."),
+ &filename_display_set_cmdlist);
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-02-18 14:33 ` Jan Kratochvil
@ 2013-02-18 16:27 ` Eli Zaretskii
0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2013-02-18 16:27 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
> Date: Mon, 18 Feb 2013 15:32:34 +0100
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb-patches@sourceware.org
>
> On Sat, 16 Feb 2013 09:32:34 +0100, Eli Zaretskii wrote:
> > Here and elsewhere, I think, instead of a separate sentence saying "FOO
> > has to use BAR debug info", it is better to say "... when FOO uses BAR
> > debug info" in the same sentence. For example:
> >
> > Set how to display filenames coming from the inferior executable, as
> > set by the @ref{file command}, when the inferior executable uses
> > embedded debug info as found in binaries compiled normally.
>
> Done; the changed parts may need a new review.
The documentation parts are OK, thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-02-15 20:25 [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug} Jan Kratochvil
2013-02-16 8:33 ` Eli Zaretskii
@ 2013-02-27 19:38 ` Jan Kratochvil
2013-02-27 19:50 ` Doug Evans
1 sibling, 1 reply; 15+ messages in thread
From: Jan Kratochvil @ 2013-02-27 19:38 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
Hi Doug,
do you consider the new 2 patch parts address your original concern?
[patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
http://sourceware.org/ml/gdb-patches/2013-02/msg00413.html
Message-ID: <20130215202536.GA20435@host2.jankratochvil.net>
[patch+doc 2/2] filename-display: default *-sepdebug to absolute
http://sourceware.org/ml/gdb-patches/2013-02/msg00414.html
Message-ID: <20130215202613.GB20435@host2.jankratochvil.net>
Thanks,
Jan
------------------------------------------------------------------------------
On Fri, 15 Feb 2013 21:25:36 +0100, Jan Kratochvil wrote:
Hi,
this mail obsoletes:
[patchv2 12/11] New options {relative,basename}-with-system-absolute
http://sourceware.org/ml/gdb-patches/2013-01/msg00700.html
Message-ID: <20130129221019.GA27463@host2.jankratochvil.net>
to address Doug's argument
http://sourceware.org/ml/gdb-patches/2013-02/msg00193.html
Message-ID: <CADPb22TatUwO6qL6sJEr8HRhjJR_Q66de7zhFdLA81hToNuJjA@mail.gmail.com>
> "system" is being conflated with "separate debug info", and I'm not
> comfortable with that.
In the patch below I had optimization of "show filename-display" to display a
single line if all the 4 options were set to the same value.
(gdb) show filename-display
Filenames are displayed as "relative".
But later I found it rather confusing and despite one can type:
(gdb) set filename-display relative
GDB will then still display now explicitly:
(gdb) show filename-display
executable: Filenames in executable with embedded debug info are displayed as "relative".
executable-with-separate-debug-info: Filenames in executable with separate debug info are displayed as "relative".
libraries: Filenames in shared libraries with embedded debug info are displayed as "relative".
libraries-with-separate-debug-info: Filenames in shared libraries with separate debug info are displayed as "relative".
I can return the single-line display back if anyone thinks so.
No regressions on {x86_64,x86_64-m32,i686}-fedora19pre-linux-gnu.
Thanks,
Jan
gdb/
2013-02-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (set filename-display executable)
(set filename-display libraries)
(set filename-display executable-with-separate-debug-info)
(set filename-display libraries-with-separate-debug-info)
(show filename-display executable)
(show filename-display libraries)
(show filename-display executable-with-separate-debug-info)
(show filename-display libraries-with-separate-debug-info): New. Also
say for all the options.
* source.c: Include cli/cli-decode.h and cli/cli-setshow.h.
(filename_display_string): Remove.
(filename_display_executable_string)
(filename_display_libraries_string)
(filename_display_executable_sepdebug_string)
(filename_display_libraries_sepdebug_string): New.
(show_filename_display_string): Remove.
(show_filename_display_executable_string)
(show_filename_display_libraries_string)
(show_filename_display_executable_sepdebug_string)
(show_filename_display_libraries_sepdebug_string): New.
(symtab_to_filename_for_display): Follow the new variables.
(filename_display_set_cmdlist, filename_display_show_cmdlist)
(set_filename_display_cmd, set_filename_display_1)
(set_filename_display_basename_string)
(set_filename_display_relative_string)
(set_filename_display_absolute_string, show_filename_display_cmd): New.
(_initialize_source): New variables filename_display_doc and doc.
Initialize filename_display_doc. Remove add_setshow_enum_cmd for
filename-display. Add filename_display_set_cmdlist and
filename_display_show_cmdlist initializations by add_prefix_cmd.
Add add_setshow_enum_cmd for executable, libraries,
executable-with-separate-debug-info and
libraries-with-separate-debug-info. Add add_cmd for basename, relative
and absolute.
gdb/doc/
2013-02-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Backtrace): Extend the show filename-display description.
New description for set filename-display executable, set
filename-display libraries, set filename-display
executable-with-separate-debug-info, set filename-display
libraries-with-separate-debug-info, show filename-display executable,
show filename-display libraries, show filename-display
executable-with-separate-debug-info and show filename-display
libraries-with-separate-debug-info.
(Files): New anchor file command.
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -123,9 +123,20 @@ show print type typedefs
The default is to show them.
set filename-display basename|relative|absolute
+set filename-display executable basename|relative|absolute
+set filename-display libraries basename|relative|absolute
+set filename-display executable-with-separate-debug-info basename|relative
+ |absolute
+set filename-display libraries-with-separate-debug-info basename|relative
+ |absolute
show filename-display
+show filename-display executable
+show filename-display libraries
+show filename-display executable-with-separate-debug-info
+show filename-display libraries-with-separate-debug-info
Control the way in which filenames is displayed.
- The default is "relative", which preserves previous behavior.
+ The default is "relative" for all the options, which preserves previous
+ behavior.
* MI changes
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -6539,7 +6539,11 @@ You can control how file names are displayed.
@table @code
@item set filename-display
-@itemx set filename-display relative
+Set how to display filenames coming from any file. One can make this setting
+more specific to the inferior file kind below. Using this command will set the
+same value for all the four kinds of inferior files as described below.
+
+@item set filename-display relative
@cindex filename-display
Display file names relative to the compilation directory. This is the default.
@@ -6550,7 +6554,53 @@ Display only basename of a filename.
Display an absolute filename.
@item show filename-display
-Show the current way to display filenames.
+Show the current way to display filenames. Setting for each of the four kinds
+of inferior files (as described below) will be displayed.
+@end table
+
+If you want to set the displayed filenames kind more specifically you can use
+the following option.
+
+Files having separate debug information file usually come from system shared
+libraries where may be more appropriate to display filenames in their absolute
+form.
+
+@table @code
+@item set filename-display executable @{relative|basename|absolute@}
+Set how to display filenames coming from the inferior executable, as set by the
+@ref{file command}. Inferior executable has to use embedded debug info as is
+usually found in binaries compiled by @value{GDBN} user.
+
+@item show filename-display executable
+Show the current way to display filenames coming from the inferior executable
+with embedded debug info.
+
+@item set filename-display libraries @{relative|basename|absolute@}
+Set how to display filenames coming from inferior shared libraries. The shared
+libraries have to use embedded debug info as is usually found in shared
+libraries compiled by @value{GDBN} user.
+
+@item show filename-display libraries
+Show the current way to display filenames coming from the inferior shared
+libraries with embedded debug info.
+
+@item set filename-display executable-with-separate-debug-info @{@dots{}@}
+Set how to display filenames coming from the inferior executable, as set by the
+@ref{file command}. Inferior executable has to use separate debug info file as
+is usually optionally provided by operating system debug info packages.
+
+@item show filename-display executable-with-separate-debug-info
+Show the current way to display filenames coming from the inferior executable
+with separate debug info file.
+
+@item set filename-display libraries-with-separate-debug-info @{@dots{}@}
+Set how to display filenames coming from inferior shared libraries. The shared
+libraries have to use separate debug info files as are usually found in shared
+libraries optionally provided by operating system debug info packages.
+
+@item show filename-display libraries-with-separate-debug-info
+Show the current way to display filenames coming from the inferior shared
+libraries with separate debug info file.
@end table
@node Selection
@@ -15941,6 +15991,7 @@ Program}). In these situations the @value{GDBN} commands to specify
new files are useful.
@table @code
+@anchor{file command}
@cindex executable file
@kindex file
@item file @var{filename}
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -43,6 +43,8 @@
#include "completer.h"
#include "ui-out.h"
#include "readline/readline.h"
+#include "cli/cli-decode.h"
+#include "cli/cli-setshow.h"
#include "psymtab.h"
@@ -121,13 +123,72 @@ static const char *const filename_display_kind_names[] = {
NULL
};
-static const char *filename_display_string = filename_display_relative;
+/* Setting for "set filename-display executable". */
+static const char *filename_display_executable_string =
+ filename_display_relative;
+
+/* Setting for "set filename-display libraries". */
+static const char *filename_display_libraries_string =
+ filename_display_relative;
+
+/* Setting for "set filename-display executable-with-separate-debug-info". */
+static const char *filename_display_executable_sepdebug_string =
+ filename_display_relative;
+
+/* Setting for "set filename-display libraries-with-separate-debug-info". */
+static const char *filename_display_libraries_sepdebug_string =
+ filename_display_relative;
+
+/* Implement command "show filename-display executable". */
+
+static void
+show_filename_display_executable_string (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("Filenames in executable with embedded "
+ "debug info are displayed as \"%s\".\n"),
+ value);
+}
+
+/* Implement command "show filename-display libraries". */
static void
-show_filename_display_string (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_filename_display_libraries_string (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
- fprintf_filtered (file, _("Filenames are displayed as \"%s\".\n"), value);
+ fprintf_filtered (file, _("Filenames in shared libraries with embedded "
+ "debug info are displayed as \"%s\".\n"),
+ value);
+}
+
+/* Implement command
+ "show filename-display executable-with-separate-debug-info". */
+
+static void
+show_filename_display_executable_sepdebug_string (struct ui_file *file,
+ int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("Filenames in executable with separate "
+ "debug info are displayed as \"%s\".\n"),
+ value);
+}
+
+/* Implement command
+ "show filename-display libraries-with-separate-debug-info". */
+
+static void
+show_filename_display_libraries_sepdebug_string (struct ui_file *file,
+ int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("Filenames in shared libraries with separate "
+ "debug info are displayed as \"%s\".\n"),
+ value);
}
/* Line number of last line printed. Default for various commands.
@@ -1138,14 +1199,34 @@ symtab_to_fullname (struct symtab *s)
const char *
symtab_to_filename_for_display (struct symtab *symtab)
{
- if (filename_display_string == filename_display_basename)
+ struct objfile *objfile = symtab->objfile;
+ int has_sepdebug, is_executable;
+ const char *setting;
+
+ if (objfile->separate_debug_objfile_backlink != NULL)
+ objfile = objfile->separate_debug_objfile_backlink;
+ has_sepdebug = objfile->separate_debug_objfile != NULL;
+ is_executable = objfile == symfile_objfile;
+
+ if (is_executable && !has_sepdebug)
+ setting = filename_display_executable_string;
+ if (!is_executable && !has_sepdebug)
+ setting = filename_display_libraries_string;
+ if (is_executable && has_sepdebug)
+ setting = filename_display_executable_sepdebug_string;
+ if (!is_executable && has_sepdebug)
+ setting = filename_display_libraries_sepdebug_string;
+ if (setting == NULL)
+ internal_error (__FILE__, __LINE__,
+ _("symtab_to_filename_for_display setting == NULL"));
+
+ if (setting == filename_display_basename)
return lbasename (symtab->filename);
- else if (filename_display_string == filename_display_absolute)
+ else if (setting == filename_display_absolute)
return symtab_to_fullname (symtab);
- else if (filename_display_string == filename_display_relative)
+ else if (setting == filename_display_relative)
return symtab->filename;
- else
- internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
+ internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
}
\f
/* Create and initialize the table S->line_charpos that records
@@ -1945,11 +2026,85 @@ set_substitute_path_command (char *args, int from_tty)
forget_cached_source_info ();
}
+/* The list of commands prefixed by "set filename-display". */
+static struct cmd_list_element *filename_display_set_cmdlist;
+
+/* The list of commands prefixed by "show filename-display". */
+static struct cmd_list_element *filename_display_show_cmdlist;
+
+/* Implement command "set filename-display" itself. */
+
+static void
+set_filename_display_cmd (char *args, int from_tty)
+{
+ error (_("Value \"basename\", \"relative\" or \"absolute\" set for all "
+ "sub-categories expected.\n"
+ "More specific category \"executable\", \"libraries\", "
+ "\"executable-with-separate-debug-info\" or "
+ "\"libraries-with-separate-debug-info\" may be also specified."));
+}
+
+/* Set all sub-values of the "set filename-display" setting to KIND. */
+
+static void
+set_filename_display_1 (const char *kind, int from_tty)
+{
+ struct cmd_list_element *list;
+
+ for (list = filename_display_set_cmdlist; list != NULL; list = list->next)
+ if (list->type == set_cmd)
+ do_set_command ((char *) kind, from_tty, list);
+}
+
+/* Implement command "set filename-display basename". */
+
+static void
+set_filename_display_basename_string (char *args, int from_tty)
+{
+ if (args != NULL && *args != 0)
+ error (_("Command has no parameters."));
+
+ set_filename_display_1 ("basename", from_tty);
+}
+
+/* Implement command "set filename-display relative". */
+
+static void
+set_filename_display_relative_string (char *args, int from_tty)
+{
+ if (args != NULL && *args != 0)
+ error (_("Command has no parameters."));
+
+ set_filename_display_1 ("relative", from_tty);
+}
+
+/* Implement command "set filename-display absolute". */
+
+static void
+set_filename_display_absolute_string (char *args, int from_tty)
+{
+ if (args != NULL && *args != 0)
+ error (_("Command has no parameters."));
+
+ set_filename_display_1 ("absolute", from_tty);
+}
+
+/* Command "show filename-display" displays summary of all the current
+ "show filename-display " settings. */
+
+static void
+show_filename_display_cmd (char *args, int from_tty)
+{
+ cmd_show_list (filename_display_show_cmdlist, from_tty, "");
+}
+
\f
void
_initialize_source (void)
{
struct cmd_list_element *c;
+ const char *filename_display_doc;
+ char *doc;
current_source_symtab = 0;
init_source_path ();
@@ -2062,18 +2217,87 @@ Print the rule for substituting FROM in source file names. If FROM\n\
is not specified, print all substitution rules."),
&showlist);
- add_setshow_enum_cmd ("filename-display", class_files,
- filename_display_kind_names,
- &filename_display_string, _("\
-Set how to display filenames."), _("\
-Show how to display filenames."), _("\
+ filename_display_doc = _("\
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\
By default, relative filenames are displayed."),
- NULL,
- show_filename_display_string,
- &setlist, &showlist);
+ doc = xstrprintf (_("\
+Set how to display filenames for all categories of files.\n\
+%s"),
+ filename_display_doc);
+ add_prefix_cmd ("filename-display", class_files, set_filename_display_cmd,
+ doc, &filename_display_set_cmdlist, "set filename-display ",
+ 0/*allow-unknown*/, &setlist);
+ xfree (doc);
+
+ doc = xstrprintf (_("\
+Show how to display filenames for all categories of files.\n\
+%s"),
+ filename_display_doc);
+ add_prefix_cmd ("filename-display", class_files, show_filename_display_cmd,
+ doc, &filename_display_show_cmdlist, "show filename-display ",
+ 0/*allow-unknown*/, &showlist);
+ xfree (doc);
+
+ add_setshow_enum_cmd ("executable", class_files,
+ filename_display_kind_names,
+ &filename_display_executable_string, _("\
+Set how to display filenames in executable with embedded debug info."), _("\
+Show how to display filenames in executable with embedded debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_executable_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_setshow_enum_cmd ("libraries", class_files,
+ filename_display_kind_names,
+ &filename_display_libraries_string, _("\
+Set how to display filenames in libraries with embedded debug info."), _("\
+Show how to display filenames in libraries with embedded debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_libraries_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_setshow_enum_cmd ("executable-with-separate-debug-info", class_files,
+ filename_display_kind_names,
+ &filename_display_executable_sepdebug_string, _("\
+Set how to display filenames in executable with separate debug info."), _("\
+Show how to display filenames in executable with separate debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_executable_sepdebug_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_setshow_enum_cmd ("libraries-with-separate-debug-info", class_files,
+ filename_display_kind_names,
+ &filename_display_libraries_sepdebug_string, _("\
+Set how to display filenames in libraries with separate debug info."), _("\
+Show how to display filenames in libraries with separate debug info."),
+ filename_display_doc, NULL,
+ show_filename_display_libraries_sepdebug_string,
+ &filename_display_set_cmdlist,
+ &filename_display_show_cmdlist);
+
+ add_cmd ("basename", class_files, set_filename_display_basename_string,
+ _("\
+Set displaying of filenames to basename for all categories of files.\n\
+See \"help set display-filename\" for other options of this setting."),
+ &filename_display_set_cmdlist);
+
+ add_cmd ("relative", class_files, set_filename_display_relative_string,
+ _("\
+Set displaying of filenames as relative for all categories of files.\n\
+Filename is displayed relative to the compilation directory\n\
+See \"help set display-filename\" for other options of this setting."),
+ &filename_display_set_cmdlist);
+
+ add_cmd ("absolute", class_files, set_filename_display_absolute_string,
+ _("\
+Set displaying of filenames as absolute for all categories of files.\n\
+See \"help set display-filename\" for other options of this setting."),
+ &filename_display_set_cmdlist);
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-02-27 19:38 ` Jan Kratochvil
@ 2013-02-27 19:50 ` Doug Evans
2013-02-27 20:06 ` Jan Kratochvil
0 siblings, 1 reply; 15+ messages in thread
From: Doug Evans @ 2013-02-27 19:50 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
Hi. twas away for awhile and didn't see the patch.
Potentially, but some questions first:
1) How common/useful would it be to distinguish shared libs of an app
I've just built and installed in some private dir (or maybe
/usr/local) from system shared libs?
IOW treating, e.g., files in $HOME/lib/mumble different from /usr/lib/mumble.
I'm not sure it's a useful distinction, just wondering.
2) How do you see {with,without}-separate-debuginfo being used in practice?
I'm just wondering if this choice is the core of the problem or
whether it's system vs non-system.
[I understand the reasoning behind the previous version of the patch,
it's a problem that I as a distro user would want solved.
with-separate-debuginfo is a good proxy for system files, it's just
not good enough for me. Sorry!]
On Wed, Feb 27, 2013 at 10:53 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> Hi Doug,
>
> do you consider the new 2 patch parts address your original concern?
>
> [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
> http://sourceware.org/ml/gdb-patches/2013-02/msg00413.html
> Message-ID: <20130215202536.GA20435@host2.jankratochvil.net>
>
> [patch+doc 2/2] filename-display: default *-sepdebug to absolute
> http://sourceware.org/ml/gdb-patches/2013-02/msg00414.html
> Message-ID: <20130215202613.GB20435@host2.jankratochvil.net>
>
>
> Thanks,
> Jan
>
> ------------------------------------------------------------------------------
>
> On Fri, 15 Feb 2013 21:25:36 +0100, Jan Kratochvil wrote:
> Hi,
>
> this mail obsoletes:
> [patchv2 12/11] New options {relative,basename}-with-system-absolute
> http://sourceware.org/ml/gdb-patches/2013-01/msg00700.html
> Message-ID: <20130129221019.GA27463@host2.jankratochvil.net>
>
> to address Doug's argument
> http://sourceware.org/ml/gdb-patches/2013-02/msg00193.html
> Message-ID: <CADPb22TatUwO6qL6sJEr8HRhjJR_Q66de7zhFdLA81hToNuJjA@mail.gmail.com>
> > "system" is being conflated with "separate debug info", and I'm not
> > comfortable with that.
>
> In the patch below I had optimization of "show filename-display" to display a
> single line if all the 4 options were set to the same value.
> (gdb) show filename-display
> Filenames are displayed as "relative".
> But later I found it rather confusing and despite one can type:
> (gdb) set filename-display relative
> GDB will then still display now explicitly:
> (gdb) show filename-display
> executable: Filenames in executable with embedded debug info are displayed as "relative".
> executable-with-separate-debug-info: Filenames in executable with separate debug info are displayed as "relative".
> libraries: Filenames in shared libraries with embedded debug info are displayed as "relative".
> libraries-with-separate-debug-info: Filenames in shared libraries with separate debug info are displayed as "relative".
> I can return the single-line display back if anyone thinks so.
>
> No regressions on {x86_64,x86_64-m32,i686}-fedora19pre-linux-gnu.
>
>
> Thanks,
> Jan
>
>
> gdb/
> 2013-02-15 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * NEWS (set filename-display executable)
> (set filename-display libraries)
> (set filename-display executable-with-separate-debug-info)
> (set filename-display libraries-with-separate-debug-info)
> (show filename-display executable)
> (show filename-display libraries)
> (show filename-display executable-with-separate-debug-info)
> (show filename-display libraries-with-separate-debug-info): New. Also
> say for all the options.
> * source.c: Include cli/cli-decode.h and cli/cli-setshow.h.
> (filename_display_string): Remove.
> (filename_display_executable_string)
> (filename_display_libraries_string)
> (filename_display_executable_sepdebug_string)
> (filename_display_libraries_sepdebug_string): New.
> (show_filename_display_string): Remove.
> (show_filename_display_executable_string)
> (show_filename_display_libraries_string)
> (show_filename_display_executable_sepdebug_string)
> (show_filename_display_libraries_sepdebug_string): New.
> (symtab_to_filename_for_display): Follow the new variables.
> (filename_display_set_cmdlist, filename_display_show_cmdlist)
> (set_filename_display_cmd, set_filename_display_1)
> (set_filename_display_basename_string)
> (set_filename_display_relative_string)
> (set_filename_display_absolute_string, show_filename_display_cmd): New.
> (_initialize_source): New variables filename_display_doc and doc.
> Initialize filename_display_doc. Remove add_setshow_enum_cmd for
> filename-display. Add filename_display_set_cmdlist and
> filename_display_show_cmdlist initializations by add_prefix_cmd.
> Add add_setshow_enum_cmd for executable, libraries,
> executable-with-separate-debug-info and
> libraries-with-separate-debug-info. Add add_cmd for basename, relative
> and absolute.
>
> gdb/doc/
> 2013-02-15 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * gdb.texinfo (Backtrace): Extend the show filename-display description.
> New description for set filename-display executable, set
> filename-display libraries, set filename-display
> executable-with-separate-debug-info, set filename-display
> libraries-with-separate-debug-info, show filename-display executable,
> show filename-display libraries, show filename-display
> executable-with-separate-debug-info and show filename-display
> libraries-with-separate-debug-info.
> (Files): New anchor file command.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-02-27 19:50 ` Doug Evans
@ 2013-02-27 20:06 ` Jan Kratochvil
2013-03-06 19:54 ` Doug Evans
0 siblings, 1 reply; 15+ messages in thread
From: Jan Kratochvil @ 2013-02-27 20:06 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
On Wed, 27 Feb 2013 20:40:08 +0100, Doug Evans wrote:
> 1) How common/useful would it be to distinguish shared libs of an app
> I've just built and installed in some private dir (or maybe
> /usr/local) from system shared libs?
> IOW treating, e.g., files in $HOME/lib/mumble different from /usr/lib/mumble.
> I'm not sure it's a useful distinction, just wondering.
I was more considering shared libraries in $HOME/src/elfutils which are part
of the project one is currently debugging. Absolute pathnames are excessive
there, one knows the (elfutils) source tree (s)he is debugging.
/usr/local/lib/mumble.so I cannot reliably distinguish from $HOME/lib/mumble
so /usr/local/lib/mumble.so will not be handled too well by default.
But /usr/local/lib/mumble.so will be handled the same way as it is so it is
not a regression.
> 2) How do you see {with,without}-separate-debuginfo being used in practice?
> I'm just wondering if this choice is the core of the problem or
> whether it's system vs non-system.
The goal is to apply the [patch 2/2] so what "with-separate-debuginfo" is used
as identification of system libraries and therefore print absolute source
pathnames for them with GDB by default.
> [I understand the reasoning behind the previous version of the patch,
> it's a problem that I as a distro user would want solved.
> with-separate-debuginfo is a good proxy for system files, it's just
> not good enough for me. Sorry!]
I still do not understand what solution would be good for you, what is your
usecase?
This patchset tries to fix the obviously wrong case - displaying relative
source pathnames for system libraries of common distros.
This patchset does not automatically fix some other /usr/local or $HOME cases
as I have not found a safe auto-detection for them. You can use
echo >>~/.gdbinit set filename-display absolute
or
echo >>$HOME/src/project/bin-gdb.gdb set filename-display absolute
for such cases.
Thanks,
Jan
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-02-27 20:06 ` Jan Kratochvil
@ 2013-03-06 19:54 ` Doug Evans
2013-03-07 9:52 ` Jan Kratochvil
2013-03-07 10:30 ` Pedro Alves
0 siblings, 2 replies; 15+ messages in thread
From: Doug Evans @ 2013-03-06 19:54 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
Jan Kratochvil writes:
> On Wed, 27 Feb 2013 20:40:08 +0100, Doug Evans wrote:
> > 1) How common/useful would it be to distinguish shared libs of an app
> > I've just built and installed in some private dir (or maybe
> > /usr/local) from system shared libs?
> > IOW treating, e.g., files in $HOME/lib/mumble different from /usr/lib/mumble.
> > I'm not sure it's a useful distinction, just wondering.
>
> I was more considering shared libraries in $HOME/src/elfutils which are part
> of the project one is currently debugging. Absolute pathnames are excessive
> there, one knows the (elfutils) source tree (s)he is debugging.
>
> /usr/local/lib/mumble.so I cannot reliably distinguish from $HOME/lib/mumble
> so /usr/local/lib/mumble.so will not be handled too well by default.
We have various parameters that together specify where to find separate debug info.
Is it possible to piggyback on that?
E.g., Something minimal for now like specifying which ones are
displayed as relative with the default being none?
[And thus by default everything with separate debug info will
be displayed using absolute file names.]
Or something like that.
I wrote:
> 2) How do you see {with,without}-separate-debuginfo being used in practice?
> I'm just wondering if this choice is the core of the problem or
> whether it's system vs non-system.
Oops. I also meant to ask about executable-vs-library.
IOW, the distinction between executables and shared libs in your patch.
There's a 2x2 matrix of {executable,shared-lib} x {embedded-debug-info,separate-debug-info}.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-03-06 19:54 ` Doug Evans
@ 2013-03-07 9:52 ` Jan Kratochvil
2013-03-07 10:26 ` Pedro Alves
2013-03-07 10:30 ` Pedro Alves
1 sibling, 1 reply; 15+ messages in thread
From: Jan Kratochvil @ 2013-03-07 9:52 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
On Wed, 06 Mar 2013 20:54:16 +0100, Doug Evans wrote:
> We have various parameters that together specify where to find separate debug info.
> Is it possible to piggyback on that?
> E.g., Something minimal for now like specifying which ones are
> displayed as relative with the default being none?
> [And thus by default everything with separate debug info will
> be displayed using absolute file names.]
> Or something like that.
It all comes from the problem both /usr/local and $HOME directories look the
same for GDB but they should behaves differentely.
Some 'where to find separate debug info' based decisions were proposed in:
http://sourceware.org/ml/gdb-patches/2013-02/msg00123.html
Message-ID: <20130205182245.GA19307@host2.jankratochvil.net>
such as:
no sepdebug => relative filenames
sepdebug in /usr/lib/debug => absolute filenames
sepdebug from .debug or .debug/ => relative filenames
That will work for your stated binary with sepdebug in $HOME (although I still
cannot imagine how that looks / why is it built that way).
But that will still not work for /usr/local/lib/mumble.so not using sepdebug
where absolute filenames are appropriate but GDB will use relative filenames.
> Oops. I also meant to ask about executable-vs-library.
> IOW, the distinction between executables and shared libs in your patch.
> There's a 2x2 matrix of {executable,shared-lib} x {embedded-debug-info,separate-debug-info}.
I find shared libraries uncommon in $HOME so using
set filename-display libraries absolute
will fix the /usr/local/lib/mumble.so problem while it will still keep
relative filenames for hello.c examples. I did not intend to make the
"libraries absolute" setting a default but maybe we can.
That still will not fix /usr/local/bin/mumble problem where we would also like
absolute filenames.
There could be very many complicated settings, there could be done some
per-directory setting like there is 'set auto-load safe-path'. But I find
that needlessly complicated, in fact I believe any experienced GDB user should
just do:
echo >>~/.gdbinit set filename-display absolute
and be done with it. Just I did not want to break first GDB experience with
hello.c example code by displaying absolute pathname for ~/hello.c.
Rather than those 2x2 settings personally I still prefer the former
[patchv2 12/11] New options {relative,basename}-with-system-absolute
http://sourceware.org/ml/gdb-patches/2013-01/msg00700.html
Message-ID: <20130129221019.GA27463@host2.jankratochvil.net>
+
[patchv2 13/11] Make relative-with-system-absolute the default
http://sourceware.org/ml/gdb-patches/2013-01/msg00701.html
Message-ID: <20130129221118.GB27463@host2.jankratochvil.net>
possibly just renaming it s/system/separate-debuginfo/.
Thanks,
Jan
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-03-07 9:52 ` Jan Kratochvil
@ 2013-03-07 10:26 ` Pedro Alves
2013-03-07 12:01 ` Jan Kratochvil
0 siblings, 1 reply; 15+ messages in thread
From: Pedro Alves @ 2013-03-07 10:26 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Doug Evans, gdb-patches
On 03/07/2013 09:52 AM, Jan Kratochvil wrote:
> That will work for your stated binary with sepdebug in $HOME (although I still
> cannot imagine how that looks / why is it built that way).
For distro builds, I don't either. But, non-distro,
relocatable toolchains installable anywhere the user wants
can easily be installed under $HOME. I can picture
the debug-file-directory pointing somewhere under $HOME
for those cases.
--
Pedro Alves
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-03-06 19:54 ` Doug Evans
2013-03-07 9:52 ` Jan Kratochvil
@ 2013-03-07 10:30 ` Pedro Alves
2013-03-07 12:04 ` Jan Kratochvil
1 sibling, 1 reply; 15+ messages in thread
From: Pedro Alves @ 2013-03-07 10:30 UTC (permalink / raw)
To: Doug Evans; +Cc: Jan Kratochvil, gdb-patches
On 03/06/2013 07:54 PM, Doug Evans wrote:
> Jan Kratochvil writes:
> > On Wed, 27 Feb 2013 20:40:08 +0100, Doug Evans wrote:
> > > 1) How common/useful would it be to distinguish shared libs of an app
> > > I've just built and installed in some private dir (or maybe
> > > /usr/local) from system shared libs?
> > > IOW treating, e.g., files in $HOME/lib/mumble different from /usr/lib/mumble.
> > > I'm not sure it's a useful distinction, just wondering.
> >
> > I was more considering shared libraries in $HOME/src/elfutils which are part
> > of the project one is currently debugging. Absolute pathnames are excessive
> > there, one knows the (elfutils) source tree (s)he is debugging.
> >
> > /usr/local/lib/mumble.so I cannot reliably distinguish from $HOME/lib/mumble
> > so /usr/local/lib/mumble.so will not be handled too well by default.
>
> We have various parameters that together specify where to find separate debug info.
> Is it possible to piggyback on that?
> E.g., Something minimal for now like specifying which ones are
> displayed as relative with the default being none?
I've not really been following the discussion closely, but
I was also wondering the same. The ultimate goal seems to be to
detect system vs non-system binaries ("system" is the word used
in the new proposed knobs even). Isn't the definitive answer
making GDB consider files under "/usr/"
system binaries (the --prefix by default, but could be somewhere
else, thus should be tunable), and everything else, non-system?
> [And thus by default everything with separate debug info will
> be displayed using absolute file names.]
> Or something like that.
--
Pedro Alves
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-03-07 10:26 ` Pedro Alves
@ 2013-03-07 12:01 ` Jan Kratochvil
0 siblings, 0 replies; 15+ messages in thread
From: Jan Kratochvil @ 2013-03-07 12:01 UTC (permalink / raw)
To: Pedro Alves; +Cc: Doug Evans, gdb-patches
On Thu, 07 Mar 2013 11:26:03 +0100, Pedro Alves wrote:
> On 03/07/2013 09:52 AM, Jan Kratochvil wrote:
> > That will work for your stated binary with sepdebug in $HOME (although I still
> > cannot imagine how that looks / why is it built that way).
>
> For distro builds, I don't either. But, non-distro,
> relocatable toolchains installable anywhere the user wants
> can easily be installed under $HOME. I can picture
> the debug-file-directory pointing somewhere under $HOME
> for those cases.
The question here was whether anyone will have files with .gnu_debuglink (even
if just the binary file) in $HOME.
In $HOME one does "configure --prefix=$HOME;make install or install-strip"
which does not bring .gnu_debuglink in.
Jan
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-03-07 10:30 ` Pedro Alves
@ 2013-03-07 12:04 ` Jan Kratochvil
2013-03-07 13:36 ` Pedro Alves
0 siblings, 1 reply; 15+ messages in thread
From: Jan Kratochvil @ 2013-03-07 12:04 UTC (permalink / raw)
To: Pedro Alves; +Cc: Doug Evans, gdb-patches
On Thu, 07 Mar 2013 11:29:48 +0100, Pedro Alves wrote:
> On 03/06/2013 07:54 PM, Doug Evans wrote:
> > We have various parameters that together specify where to find separate debug info.
> > Is it possible to piggyback on that?
> > E.g., Something minimal for now like specifying which ones are
> > displayed as relative with the default being none?
>
> I've not really been following the discussion closely, but
> I was also wondering the same. The ultimate goal seems to be to
> detect system vs non-system binaries ("system" is the word used
> in the new proposed knobs even). Isn't the definitive answer
> making GDB consider files under "/usr/"
> system binaries (the --prefix by default, but could be somewhere
> else, thus should be tunable), and everything else, non-system?
Besides /usr you need also /bin, /lib, /lib64, /libx32, /opt etc. etc.
I was thinking rather about the opposite way, consider non-system binaries
those that are under /usr/local, /root and /home .
But that is all non-trivial number of directories which will never catch all
the distros/setups out there.
Thanks,
Jan
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-03-07 12:04 ` Jan Kratochvil
@ 2013-03-07 13:36 ` Pedro Alves
2013-03-07 15:07 ` Jan Kratochvil
0 siblings, 1 reply; 15+ messages in thread
From: Pedro Alves @ 2013-03-07 13:36 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Doug Evans, gdb-patches
On 03/07/2013 12:04 PM, Jan Kratochvil wrote:
> On Thu, 07 Mar 2013 11:29:48 +0100, Pedro Alves wrote:
>> On 03/06/2013 07:54 PM, Doug Evans wrote:
>>> We have various parameters that together specify where to find separate debug info.
>>> Is it possible to piggyback on that?
>>> E.g., Something minimal for now like specifying which ones are
>>> displayed as relative with the default being none?
>>
>> I've not really been following the discussion closely, but
>> I was also wondering the same. The ultimate goal seems to be to
>> detect system vs non-system binaries ("system" is the word used
>> in the new proposed knobs even). Isn't the definitive answer
>> making GDB consider files under "/usr/"
>> system binaries (the --prefix by default, but could be somewhere
>> else, thus should be tunable), and everything else, non-system?
>
> Besides /usr you need also /bin, /lib, /lib64, /libx32, /opt etc. etc.
True, though I don't think there's much more than that.
> I was thinking rather about the opposite way, consider non-system binaries
> those that are under /usr/local, /root and /home .
The set of system paths is defined by the OS
integrator, so seemed closer to being bounded to me.
The user can well put files wherever it wants.
Other components "know" paths in the system as well, like
gcc with the system includes and the native lib dir paths,
or even the linker and the loader. Note these tools usually
think of /usr/local as "system", and I'd think for this case
that apply too.
Irrespective of glass half empty vs half full, I guess the first
question is whether by-path is a better approach than by
have-sep-debug. It _feels_ more to the point, therefore better to
me, but I'm not really trying to impose it or block the other
approach. I wonder what others think.
> But that is all non-trivial number of directories which will never catch all
> the distros/setups out there.
Using sepdebug for system/non-system also feels like will always
have corner cases, though.
--
Pedro Alves
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug}
2013-03-07 13:36 ` Pedro Alves
@ 2013-03-07 15:07 ` Jan Kratochvil
0 siblings, 0 replies; 15+ messages in thread
From: Jan Kratochvil @ 2013-03-07 15:07 UTC (permalink / raw)
To: Pedro Alves; +Cc: Doug Evans, gdb-patches
On Thu, 07 Mar 2013 14:36:07 +0100, Pedro Alves wrote:
> The set of system paths is defined by the OS
> integrator, so seemed closer to being bounded to me.
> The user can well put files wherever it wants.
[...]
> Irrespective of glass half empty vs half full, I guess the first
> question is whether by-path is a better approach than by
> have-sep-debug. It _feels_ more to the point, therefore better to
> me, but I'm not really trying to impose it or block the other
> approach. I wonder what others think.
[...]
> Using sepdebug for system/non-system also feels like will always
> have corner cases, though.
It complex to configure - it will need setting it by distros (from gdb.spec
and similar files) and after all it is also not foolproof, people install
their own binaries to /usr/bin and one may ask how should those be displayed.
The primary problem is that making the setup non-trivial is IMO not worth it
as the "relative" setting does not work correctly anyway. It should be IMO
relative to the package build directory but in reality it is:
* either "absolute" anyway if package always calls: gcc $PWD/parser/file.c
* or "basename" if package always calls: cd parser; gcc file.c
* or what is expected as relative if package calls: gcc parser/file.c
(BTW sure one can always detect the full $PWD/parser/file.c path by looking
also at DW_AT_comp_dir but that is not what "relative" does.)
So if some complex solution should be done one should first fix the "relative"
behavior so that it makes sense (=introduce a 4th new option). I hope
everyone agrees the correct behavior is to display source filesnames relative
to the unpacked package base source directory.
If we already get configured distro-configurable system directories I have an
idea - strip all common directories of all the source files but excluding
source files which come from the distro-configurable system directories. This
is where I failed with the common directories stripping draft patch before as
one gets included files like
/builddir/build/BUILD/glibc-2.15-a316c1f/malloc/mcheck-init.c:
[patch FYI not for commit] Attempt to properly relativize executable's filenames
http://sourceware.org/ml/gdb-patches/2013-02/msg00412.html
Message-ID: <20130215195801.GA18966@host2.jankratochvil.net>
It goes all a bit more far than I planned but OK, when you ask for it.
Thanks,
Jan
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2013-03-07 15:07 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-15 20:25 [patch+doc 1/2] filename-display: 1->4 options {inferior,libs}{,-sepdebug} Jan Kratochvil
2013-02-16 8:33 ` Eli Zaretskii
2013-02-18 14:33 ` Jan Kratochvil
2013-02-18 16:27 ` Eli Zaretskii
2013-02-27 19:38 ` Jan Kratochvil
2013-02-27 19:50 ` Doug Evans
2013-02-27 20:06 ` Jan Kratochvil
2013-03-06 19:54 ` Doug Evans
2013-03-07 9:52 ` Jan Kratochvil
2013-03-07 10:26 ` Pedro Alves
2013-03-07 12:01 ` Jan Kratochvil
2013-03-07 10:30 ` Pedro Alves
2013-03-07 12:04 ` Jan Kratochvil
2013-03-07 13:36 ` Pedro Alves
2013-03-07 15:07 ` Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox