Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb/gdbsupport: Use LOCALAPPDATA for index cache on windows
@ 2020-12-08 10:16 Alexander Fedotov via Gdb-patches
  2020-12-08 14:46 ` Simon Marchi via Gdb-patches
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Fedotov via Gdb-patches @ 2020-12-08 10:16 UTC (permalink / raw)
  To: gdb-patches

[-- 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


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

end of thread, other threads:[~2020-12-09 12:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 10:16 [PATCH] gdb/gdbsupport: Use LOCALAPPDATA for index cache on windows Alexander Fedotov via Gdb-patches
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

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