Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [Windows/RFA/commit] Deprecate windows-specific dll-symbols command and aliases
Date: Fri, 31 Jan 2014 09:48:00 -0000	[thread overview]
Message-ID: <1391161706-340-1-git-send-email-brobecker@adacore.com> (raw)

Hello,

The "dll-symbols" command, specific to native Windows platforms,
gives the impression that the symbols were not loaded, first
because it completes silently, and second because the "info shared"
output does not get updated after the command completes:

    (gdb) dll-symbols C:\WINDOWS\syswow64\rpcrt4.dll
    (gdb) info shared
    From        To          Syms Read   Shared Object Library
    [...]
    0x77e51000  0x77ee2554  No          C:\WINDOWS\system32\rpcrt4.dll

(we exected the "Syms Read" column to read "Yes").

As far as I can tell, the symbols actually do get loaded, but completely
independently from the solib framework, which explains the silent
loading and the fact that the "Syms Read" column does not get updated.
See windows-nat.c::safe_symbol_file_add_stub, which calls symbol_file_add
instead of calling solib_add.

But, aside from the fact that the "Syms Read" status does not get
updated, I also noticed that it does not take into account the DLL's
actual load address when loading its symbols. As a result, I believe
that we get it wrong if the DLL does not get loaded at the prefered
address.

Rather than trying to fix this command, there does not seem to be
a reason other than historical for having Windows-specific commands
which essentially re-implements the "sharedlibrary" command. The
command interface is slightly different (the latter takes a regexp
rather than a plain filename), but it should be just as easy to use
the "sharedlibrary" command, or its "share" alias, as usisng the
"dll-symbols" command. For instance:

    (gdb) share rpcrt4.dll
    Reading symbols from C:\WINDOWS\system32\rpcrt4.dll...(no debugging symbols found)...done.
    Loaded symbols for C:\WINDOWS\system32\rpcrt4.dll
    (gdb) info shared
    From        To          Syms Read   Shared Object Library
    [...]
    0x77e51000  0x77ee2554  Yes (*)     C:\WINDOWS\system32\rpcrt4.dll

This patch therefore deprecates the "dll-symbols" command, as well
as its two aliases "add-shared-symbol-files" and "assf", with a view
of deleting them as soon as the 7.8 branch gets cut.

Another option is to port this patch to the gdb-7.7 branch to make it
deprecated in the 7.7 release, allowing us to remove support for these
commands from master now.

gdb/ChangeLog:

	* windows-nat.c (_initialize_windows_nat): Deprecate the
	"dll-symbols" command.  Turn the "add-shared-symbol-files"
	and "assf" aliases into commands, and deprecate them as well.
	* NEWS: Add entry explaining that "dll-symbols" and its two
	aliases are now deprecated.

Tested on x86-windows. Thoughts?

Thanks,
-- 
Joel

---
 gdb/NEWS          |  4 ++++
 gdb/windows-nat.c | 13 +++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index 5062e02..14af602 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -51,6 +51,10 @@ qXfer:btrace:read's annex
   The qXfer:btrace:read packet supports a new annex 'delta' to read
   branch trace incrementally.
 
+* The "dll-symbols" command, and its two aliases ("add-shared-symbol-files"
+  and "assf"), have been deprecated.  Use the "sharedlibrary" command, or
+  its alias "share", instead.
+
 *** Changes in GDB 7.7
 
 * Improved support for process record-replay and reverse debugging on
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 5bcb7b7..68a567b 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2666,12 +2666,17 @@ _initialize_windows_nat (void)
   c = add_com ("dll-symbols", class_files, dll_symbol_command,
 	       _("Load dll library symbols from FILE."));
   set_cmd_completer (c, filename_completer);
+  deprecate_cmd (c, "sharedlibrary");
 
-  add_com_alias ("sharedlibrary", "dll-symbols", class_alias, 1);
-
-  add_com_alias ("add-shared-symbol-files", "dll-symbols", class_alias, 1);
+  c = add_com ("add-shared-symbol-files", class_files, dll_symbol_command,
+	       _("Load dll library symbols from FILE."));
+  set_cmd_completer (c, filename_completer);
+  deprecate_cmd (c, "sharedlibrary");
 
-  add_com_alias ("assf", "dll-symbols", class_alias, 1);
+  c = add_com ("assf", class_files, dll_symbol_command,
+	       _("Load dll library symbols from FILE."));
+  set_cmd_completer (c, filename_completer);
+  deprecate_cmd (c, "sharedlibrary");
 
 #ifdef __CYGWIN__
   add_setshow_boolean_cmd ("shell", class_support, &useshell, _("\
-- 
1.8.3.2


             reply	other threads:[~2014-01-31  9:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-31  9:48 Joel Brobecker [this message]
2014-01-31 11:30 ` Eli Zaretskii
2014-01-31 11:39   ` Joel Brobecker
2014-01-31 11:49     ` Eli Zaretskii
2014-01-31 12:22       ` Joel Brobecker
2014-01-31 14:33         ` Eli Zaretskii
2014-02-04 20:20       ` Pedro Alves
2014-02-10 14:34         ` Joel Brobecker
2014-02-12 14:44           ` Pedro Alves
2014-02-12 17:17             ` Joel Brobecker
2014-02-13 12:01               ` Joel Brobecker
2014-02-13 16:02                 ` Eli Zaretskii
2014-02-13 16:43                   ` Joel Brobecker
2014-02-13 17:03                     ` Eli Zaretskii
2014-02-13 17:24                       ` Pedro Alves
2014-02-13 17:40                         ` Eli Zaretskii
2014-02-19  9:43                           ` Joel Brobecker
2014-02-19 16:44                             ` Eli Zaretskii
2014-02-20  8:34                               ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391161706-340-1-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox