public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Change in binutils-gdb[master]: [gdb/breakpoints] Fix fullname.exp when run from symlink dir
@ 2019-10-15 15:18 Tom de Vries (Code Review)
  2019-10-22 18:10 ` [review] " Tom Tromey (Code Review)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom de Vries (Code Review) @ 2019-10-15 15:18 UTC (permalink / raw)
  To: gdb-patches

Tom de Vries has uploaded a new change for review.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/82
......................................................................

[gdb/breakpoints] Fix fullname.exp when run from symlink dir

I run into this error with gdb.base/fullname.exp:
...
(gdb) file /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/fullname
Reading symbols from /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/fullname...
(gdb) break /data/gdb_versions/devel/build/gdb/testsuite/\
  outputs/gdb.base/fullname/tmp-fullname.c:21
No source file named /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/tmp-fullname.c.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) FAIL: gdb.base/fullname.exp: set breakpoint by full path before loading symbols - built relative
...

The FAIL is due to this comparison in iterate_over_some_symtabs failing:
...
481                   if (FILENAME_CMP (real_path, fullname) == 0)
(gdb) p real_path
$2 = 0x1a201f0 "/data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/tmp-fullname.c"
(gdb) p fullname
$3 = 0x1a1de80 "/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/tmp-fullname.c"
...

The difference in pathnames is due to having a symlink dir:
...
$ ls -la /home/vries/gdb_versions
lrwxrwxrwx 1 vries users 18 26 jun  2018 /home/vries/gdb_versions -> /data/gdb_versions
...
and the test passses when eliminating it:
...
$ ( cd $(pwd -P); make check RUNTESTFLAGS=gdb.base/fullname.exp )
...

The FAIL is a regression from commit a0c1ffedcf1 "Only compute realpath when
basenames_may_differ is set".  Before, find_and_open_source was returning a
real-path, resulting in variable 'fullname' being the same as varible
'real_path' in the comparison listed above.  But after, that's no longer the
case.

Fix the FAIL by applying gdb_realpath on the fullname variable before the
comparison.

Tested on x86_64-linux.

I wasn't able to write a test-case.  The FAIL starts at:
...
$ cd build/gdb
$ mv testsuite testsuite.bla
$ ln -s testsuite.bla testsuite
...
but already this doesn't trigger it anymore:
...
$ cd build/gdb/outputs
$ mv outputs outputs.bla
$ ln -s outputs.bla outputs
...

gdb/ChangeLog:

2019-10-15  Tom de Vries  <tdevries@suse.de>

	PR breakpoints/24687
	* symtab.c (iterate_over_some_symtabs): Apply gdb_realpath on fullname.

Change-Id: I1ace62a234458781e958980f3b425edf1490df27
---
M gdb/symtab.c
1 file changed, 3 insertions(+), 0 deletions(-)



diff --git a/gdb/symtab.c b/gdb/symtab.c
index 8a551f1..22c09aa 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -478,6 +478,9 @@
 
 	      gdb_assert (IS_ABSOLUTE_PATH (real_path));
 	      gdb_assert (IS_ABSOLUTE_PATH (name));
+	      gdb::unique_xmalloc_ptr<char> fullname_real_path
+		= gdb_realpath (fullname);
+	      fullname = fullname_real_path.get ();
 	      if (FILENAME_CMP (real_path, fullname) == 0)
 		{
 		  if (callback (s))

-- 
To view, visit https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/82
To unsubscribe, or for help writing mail filters, visit https://gnutoolchain-gerrit.osci.io/r/settings

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

* [review] [gdb/breakpoints] Fix fullname.exp when run from symlink dir
  2019-10-15 15:18 Change in binutils-gdb[master]: [gdb/breakpoints] Fix fullname.exp when run from symlink dir Tom de Vries (Code Review)
@ 2019-10-22 18:10 ` Tom Tromey (Code Review)
  2019-10-23  7:34 ` [pushed] " Sourceware to Gerrit sync (Code Review)
  2019-10-23  7:34 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-10-22 18:10 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/82
......................................................................


Patch Set 1: Code-Review+2

Thank you for the patch.  I'm sorry it took so long to review.
This is a tricky area and I procrastinated a while.

I think this patch is OK.  In the long run, I think I'd prefer that
we move the fullname out of the symtab and instead have a dedicated
cache for it (perhaps in source_cache).  Then we could compute both
the user-facing name and the canonical ("real") name, and efficiently
choose the one needed at any given point.

However, that's reasonably involved and, I think, not required for this to land.


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

* [pushed] [gdb/breakpoints] Fix fullname.exp when run from symlink dir
  2019-10-15 15:18 Change in binutils-gdb[master]: [gdb/breakpoints] Fix fullname.exp when run from symlink dir Tom de Vries (Code Review)
  2019-10-22 18:10 ` [review] " Tom Tromey (Code Review)
@ 2019-10-23  7:34 ` Sourceware to Gerrit sync (Code Review)
  2019-10-23  7:34 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-10-23  7:34 UTC (permalink / raw)
  To: Tom de Vries, Tom Tromey, gdb-patches

The original change was created by Tom de Vries.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/82
......................................................................

[gdb/breakpoints] Fix fullname.exp when run from symlink dir

I run into this error with gdb.base/fullname.exp:
...
(gdb) file /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/fullname
Reading symbols from /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/fullname...
(gdb) break /data/gdb_versions/devel/build/gdb/testsuite/\
  outputs/gdb.base/fullname/tmp-fullname.c:21
No source file named /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/tmp-fullname.c.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) FAIL: gdb.base/fullname.exp: set breakpoint by full path before loading symbols - built relative
...

The FAIL is due to this comparison in iterate_over_some_symtabs failing:
...
481                   if (FILENAME_CMP (real_path, fullname) == 0)
(gdb) p real_path
$2 = 0x1a201f0 "/data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/tmp-fullname.c"
(gdb) p fullname
$3 = 0x1a1de80 "/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/tmp-fullname.c"
...

The difference in pathnames is due to having a symlink dir:
...
$ ls -la /home/vries/gdb_versions
lrwxrwxrwx 1 vries users 18 26 jun  2018 /home/vries/gdb_versions -> /data/gdb_versions
...
and the test passses when eliminating it:
...
$ ( cd $(pwd -P); make check RUNTESTFLAGS=gdb.base/fullname.exp )
...

The FAIL is a regression from commit a0c1ffedcf1 "Only compute realpath when
basenames_may_differ is set".  Before, find_and_open_source was returning a
real-path, resulting in variable 'fullname' being the same as varible
'real_path' in the comparison listed above.  But after, that's no longer the
case.

Fix the FAIL by applying gdb_realpath on the fullname variable before the
comparison.

Tested on x86_64-linux.

I wasn't able to write a test-case.  The FAIL starts at:
...
$ cd build/gdb
$ mv testsuite testsuite.bla
$ ln -s testsuite.bla testsuite
...
but already this doesn't trigger it anymore:
...
$ cd build/gdb/outputs
$ mv outputs outputs.bla
$ ln -s outputs.bla outputs
...

gdb/ChangeLog:

2019-10-23  Tom de Vries  <tdevries@suse.de>

	PR breakpoints/24687
	* symtab.c (iterate_over_some_symtabs): Apply gdb_realpath on fullname.

Change-Id: I1ace62a234458781e958980f3b425edf1490df27
---
M gdb/ChangeLog
M gdb/symtab.c
2 files changed, 8 insertions(+), 0 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9cd38a3..253c74f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-23  Tom de Vries  <tdevries@suse.de>
+
+	PR breakpoints/24687
+	* symtab.c (iterate_over_some_symtabs): Apply gdb_realpath on fullname.
+
 2019-10-22  Christian Biesinger  <cbiesinger@google.com>
 
 	* symtab.c (struct demangled_name_entry) <language>: Change from
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 0a87fec..160a4c0 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -480,6 +480,9 @@
 
 	      gdb_assert (IS_ABSOLUTE_PATH (real_path));
 	      gdb_assert (IS_ABSOLUTE_PATH (name));
+	      gdb::unique_xmalloc_ptr<char> fullname_real_path
+		= gdb_realpath (fullname);
+	      fullname = fullname_real_path.get ();
 	      if (FILENAME_CMP (real_path, fullname) == 0)
 		{
 		  if (callback (s))

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

* [pushed] [gdb/breakpoints] Fix fullname.exp when run from symlink dir
  2019-10-15 15:18 Change in binutils-gdb[master]: [gdb/breakpoints] Fix fullname.exp when run from symlink dir Tom de Vries (Code Review)
  2019-10-22 18:10 ` [review] " Tom Tromey (Code Review)
  2019-10-23  7:34 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-10-23  7:34 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-10-23  7:34 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Tom Tromey

Sourceware to Gerrit sync has submitted this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/82
......................................................................

[gdb/breakpoints] Fix fullname.exp when run from symlink dir

I run into this error with gdb.base/fullname.exp:
...
(gdb) file /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/fullname
Reading symbols from /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/fullname...
(gdb) break /data/gdb_versions/devel/build/gdb/testsuite/\
  outputs/gdb.base/fullname/tmp-fullname.c:21
No source file named /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/tmp-fullname.c.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) FAIL: gdb.base/fullname.exp: set breakpoint by full path before loading symbols - built relative
...

The FAIL is due to this comparison in iterate_over_some_symtabs failing:
...
481                   if (FILENAME_CMP (real_path, fullname) == 0)
(gdb) p real_path
$2 = 0x1a201f0 "/data/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/tmp-fullname.c"
(gdb) p fullname
$3 = 0x1a1de80 "/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/\
  gdb.base/fullname/tmp-fullname.c"
...

The difference in pathnames is due to having a symlink dir:
...
$ ls -la /home/vries/gdb_versions
lrwxrwxrwx 1 vries users 18 26 jun  2018 /home/vries/gdb_versions -> /data/gdb_versions
...
and the test passses when eliminating it:
...
$ ( cd $(pwd -P); make check RUNTESTFLAGS=gdb.base/fullname.exp )
...

The FAIL is a regression from commit a0c1ffedcf1 "Only compute realpath when
basenames_may_differ is set".  Before, find_and_open_source was returning a
real-path, resulting in variable 'fullname' being the same as varible
'real_path' in the comparison listed above.  But after, that's no longer the
case.

Fix the FAIL by applying gdb_realpath on the fullname variable before the
comparison.

Tested on x86_64-linux.

I wasn't able to write a test-case.  The FAIL starts at:
...
$ cd build/gdb
$ mv testsuite testsuite.bla
$ ln -s testsuite.bla testsuite
...
but already this doesn't trigger it anymore:
...
$ cd build/gdb/outputs
$ mv outputs outputs.bla
$ ln -s outputs.bla outputs
...

gdb/ChangeLog:

2019-10-23  Tom de Vries  <tdevries@suse.de>

	PR breakpoints/24687
	* symtab.c (iterate_over_some_symtabs): Apply gdb_realpath on fullname.

Change-Id: I1ace62a234458781e958980f3b425edf1490df27
---
M gdb/ChangeLog
M gdb/symtab.c
2 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9cd38a3..253c74f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-23  Tom de Vries  <tdevries@suse.de>
+
+	PR breakpoints/24687
+	* symtab.c (iterate_over_some_symtabs): Apply gdb_realpath on fullname.
+
 2019-10-22  Christian Biesinger  <cbiesinger@google.com>
 
 	* symtab.c (struct demangled_name_entry) <language>: Change from
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 0a87fec..160a4c0 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -480,6 +480,9 @@
 
 	      gdb_assert (IS_ABSOLUTE_PATH (real_path));
 	      gdb_assert (IS_ABSOLUTE_PATH (name));
+	      gdb::unique_xmalloc_ptr<char> fullname_real_path
+		= gdb_realpath (fullname);
+	      fullname = fullname_real_path.get ();
 	      if (FILENAME_CMP (real_path, fullname) == 0)
 		{
 		  if (callback (s))

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

end of thread, other threads:[~2019-10-23  7:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 15:18 Change in binutils-gdb[master]: [gdb/breakpoints] Fix fullname.exp when run from symlink dir Tom de Vries (Code Review)
2019-10-22 18:10 ` [review] " Tom Tromey (Code Review)
2019-10-23  7:34 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-10-23  7:34 ` Sourceware to Gerrit sync (Code Review)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).