Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Alexander Fedotov via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] gdb/gdbsupport: Use LOCALAPPDATA for index cache on windows
Date: Tue, 8 Dec 2020 13:16:54 +0300	[thread overview]
Message-ID: <CAN8C2CoSNvObanakpyCBGxTwFpefGp1CT7ddC8sU0eUjLxL=Dw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 247 bytes --]

Hi all

When running GDB on Windows using native command line (not Msys2 or
another) I see nasty warning Couldn't determine a path for index
cached directory"

So I have decided to use  LOCALAPPDATA as a last resort.

Comments are welcomed.

Alex

[-- Attachment #2: 0001-gdb-gdbsupport-pathstuff.cc-Use-LOCALAPPDATA-environ.patch --]
[-- Type: text/x-patch, Size: 1706 bytes --]

From 9c78154311c6315e8aae627fada5c339e932f887 Mon Sep 17 00:00:00 2001
From: Alexander Fedotov <alfedotov@gmail.com>
Date: Tue, 8 Dec 2020 13:07:23 +0300
Subject: [PATCH] gdb/gdbsupport/pathstuff.cc: Use LOCALAPPDATA environment
 variable when running on Windows with native command line, otherwise nasty
 warning "Couldn't determine a path for index cached directory" appears.

---
 gdbsupport/ChangeLog    |  6 ++++++
 gdbsupport/pathstuff.cc | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog
index 88a0413e8b..cc1035d0ae 100644
--- a/gdbsupport/ChangeLog
+++ b/gdbsupport/ChangeLog
@@ -1,3 +1,9 @@
+2020-12-08  Alexander Fedotov  <alfedotov@gmail.com>
+
+	* pathstuff.cc (get_standard_cache_dir): Use LOCALAPPDATA environment
+	variable when running on Windows with native command line, otherwise nasty
+	warning "Couldn't determine a path for index cached directory" appears.
+
 2020-12-01  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* tdesc.cc (print_xml_feature::visit): Print enum fields using
diff --git a/gdbsupport/pathstuff.cc b/gdbsupport/pathstuff.cc
index 311456720e..994ddff300 100644
--- a/gdbsupport/pathstuff.cc
+++ b/gdbsupport/pathstuff.cc
@@ -238,6 +238,16 @@ get_standard_cache_dir ()
       return string_printf ("%s/" HOME_CACHE_DIR "/gdb", abs.get ());
     }
 
+#ifdef _WIN32
+  const char *win_home = getenv ("LOCALAPPDATA");
+  if (win_home != NULL)
+    {
+      /* Make sure the path is absolute and tilde-expanded.  */
+      gdb::unique_xmalloc_ptr<char> abs (gdb_abspath (win_home));
+      return string_printf ("%s/" HOME_CACHE_DIR "/gdb", abs.get ());
+    }
+#endif
+    
   return {};
 }
 
-- 
2.25.1


             reply	other threads:[~2020-12-08 10:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 10:16 Alexander Fedotov via Gdb-patches [this message]
2020-12-08 14:46 ` Simon Marchi via Gdb-patches
2020-12-08 14:48   ` Simon Marchi via Gdb-patches
2020-12-08 14:51     ` Alexander Fedotov via Gdb-patches
2020-12-08 15:10       ` Simon Marchi via Gdb-patches
2020-12-08 15:12         ` Alexander Fedotov via Gdb-patches
2020-12-08 15:16           ` Simon Marchi via Gdb-patches
2020-12-08 15:31   ` Eli Zaretskii via Gdb-patches
2020-12-09  9:15     ` Alexander Fedotov via Gdb-patches
2020-12-09 12:45       ` Christian Biesinger via Gdb-patches

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='CAN8C2CoSNvObanakpyCBGxTwFpefGp1CT7ddC8sU0eUjLxL=Dw@mail.gmail.com' \
    --to=gdb-patches@sourceware.org \
    --cc=alfedotov@gmail.com \
    /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