summaryrefslogtreecommitdiff
path: root/gdb/gnulib/import/getcwd.c
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2019-07-11 16:54:41 +0200
committerChristophe Lyon <christophe.lyon@linaro.org>2019-07-11 16:54:41 +0200
commit68b4faa22a21ef0bd103f1dce50bb4a263559395 (patch)
treeaa9edd74014f72d99e478210c95ec82cf9af1540 /gdb/gnulib/import/getcwd.c
parent548c794021c606a2aae2cb9c44e2b0ac338a75d6 (diff)
downloadbinutils-gdb-68b4faa22a21ef0bd103f1dce50bb4a263559395.tar.gz
Diffstat (limited to 'gdb/gnulib/import/getcwd.c')
-rw-r--r--gdb/gnulib/import/getcwd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/gnulib/import/getcwd.c b/gdb/gnulib/import/getcwd.c
index e1265fdd3a4..0c4775b6a19 100644
--- a/gdb/gnulib/import/getcwd.c
+++ b/gdb/gnulib/import/getcwd.c
@@ -66,6 +66,7 @@
#endif
#include "pathmax.h"
+#include <stdio.h>
/* In this file, PATH_MAX only serves as a threshold for choosing among two
algorithms. */
@@ -212,6 +213,8 @@ __getcwd (char *buf, size_t size)
rootdev = st.st_dev;
rootino = st.st_ino;
+ // printf("TOTO GDB: thisdev %d thisino %d\n", thisdev, thisino);
+ // printf("TOTO GDB: rootdev %d rootino %d\n", rootdev, rootino);
while (!(thisdev == rootdev && thisino == rootino))
{
struct dirent *d;
@@ -223,6 +226,7 @@ __getcwd (char *buf, size_t size)
size_t namlen;
bool use_d_ino = true;
+ // printf("TOTO GDB: going up\n");
/* Look at the parent directory. */
#if HAVE_OPENAT_SUPPORT
fd = openat (fd, "..", O_RDONLY);
@@ -249,6 +253,7 @@ __getcwd (char *buf, size_t size)
dotdev = st.st_dev;
dotino = st.st_ino;
mount_point = dotdev != thisdev;
+ // printf("TOTO GDB: mount_point: %d dotdev %d dotino %d\n", mount_point, dotdev, dotino);
/* Search for the last directory. */
#if HAVE_OPENAT_SUPPORT
@@ -267,6 +272,7 @@ __getcwd (char *buf, size_t size)
/* Clear errno to distinguish EOF from error if readdir returns
NULL. */
__set_errno (0);
+ // printf("TOTO GDB before readdir\n");
d = __readdir (dirstream);
/* When we've iterated through all directory entries without finding
@@ -278,11 +284,13 @@ __getcwd (char *buf, size_t size)
via lstat. */
if (d == NULL && errno == 0 && use_d_ino)
{
+ // printf("TOTO GDB weird: d=%p errno=%d\n", d, errno);
use_d_ino = false;
rewinddir (dirstream);
d = __readdir (dirstream);
}
+ // printf("TOTO GDB: d=%p errno=%d name %s\n", d, errno, d != NULL ? d->d_name : "null");
if (d == NULL)
{
if (errno == 0)