aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorThiago Jung Bauermann <bauerman@br.ibm.com>2012-05-30 03:42:21 +0000
committerThiago Jung Bauermann <bauerman@br.ibm.com>2012-05-30 03:42:21 +0000
commitebd86fb5688dac848266e6a902ea192fe9aa1576 (patch)
tree358233d17205d9744bed552ecc76e78fb6325437 /gdb
parentb887615911bfb54624c7efa905eaf543d40fcb06 (diff)
downloadgdb-ebd86fb5688dac848266e6a902ea192fe9aa1576.zip
gdb-ebd86fb5688dac848266e6a902ea192fe9aa1576.tar.gz
gdb-ebd86fb5688dac848266e6a902ea192fe9aa1576.tar.bz2
* source.c (openp): Expand tilde in path entries.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/source.c19
2 files changed, 23 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b199f87..c2f01b9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-30 Thiago Jung Bauermann <thiago.bauermann@linaro.org>
+
+ * source.c (openp): Expand tilde in path entries.
+
2012-05-29 Doug Evans <dje@google.com>
* buildsym.c (block_compar): Fix comment.
diff --git a/gdb/source.c b/gdb/source.c
index 27c5b0e..7de86b4 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -769,6 +769,25 @@ openp (const char *path, int opts, const char *string,
}
strcpy (filename, current_directory);
}
+ else if (strchr(dir, '~'))
+ {
+ /* See whether we need to expand the tilde. */
+ int newlen;
+ char *tilde_expanded;
+
+ tilde_expanded = tilde_expand (dir);
+
+ /* First, realloc the filename buffer if too short. */
+ len = strlen (tilde_expanded);
+ newlen = len + strlen (string) + 2;
+ if (newlen > alloclen)
+ {
+ alloclen = newlen;
+ filename = alloca (alloclen);
+ }
+ strcpy (filename, tilde_expanded);
+ xfree (tilde_expanded);
+ }
else
{
/* Normal file name in path -- just use it. */