From 6760ae43c50958a39db9de2d166a17bd88832359 Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Jan 06 2020 19:46:01 +0000 Subject: Fix 'Paths for breakpoints are not resolved' (RHBZ 1785768). --- diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index d90d564..ed69043 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -414,3 +414,8 @@ Patch101: gdb-rhbz1553104-s390x-arch12-test.patch # Sergio Durigan Junior, RHBZ 1765117. Patch102: gdb-rhbz1765117-fix-core-tui-run.patch +# Fix for 'Paths for breakpoints are not resolved' (RHBZ 1785768). +# Reported directly to me (Sergio) by Jonah Graham from Eclipse CDT. +# Fixed upstream. +Patch103: gdb-rhbz1785768-path-breakpoints-resolved-eclipse-cdt.patch + diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index 48f09cd..0557da6 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -100,3 +100,4 @@ %patch100 -p1 %patch101 -p1 %patch102 -p1 +%patch103 -p1 diff --git a/_patch_order b/_patch_order index 5be339e..50c07aa 100644 --- a/_patch_order +++ b/_patch_order @@ -100,3 +100,4 @@ gdb-archer.patch gdb-vla-intel-fix-print-char-array.patch gdb-rhbz1553104-s390x-arch12-test.patch gdb-rhbz1765117-fix-core-tui-run.patch +gdb-rhbz1785768-path-breakpoints-resolved-eclipse-cdt.patch diff --git a/gdb-rhbz1785768-path-breakpoints-resolved-eclipse-cdt.patch b/gdb-rhbz1785768-path-breakpoints-resolved-eclipse-cdt.patch new file mode 100644 index 0000000..966a739 --- /dev/null +++ b/gdb-rhbz1785768-path-breakpoints-resolved-eclipse-cdt.patch @@ -0,0 +1,92 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Sergio Durigan Junior +Date: Fri, 20 Dec 2019 16:14:05 -0500 +Subject: gdb-rhbz1785768-path-breakpoints-resolved-eclipse-cdt.patch + +;; Fix for 'Paths for breakpoints are not resolved' (RHBZ 1785768). +;; Reported directly to me (Sergio) by Jonah Graham from Eclipse CDT. +;; Fixed upstream. + +[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 + + PR breakpoints/24687 + * symtab.c (iterate_over_some_symtabs): Apply gdb_realpath on fullname. + +Change-Id: I1ace62a234458781e958980f3b425edf1490df27 + +diff --git a/gdb/symtab.c b/gdb/symtab.c +--- a/gdb/symtab.c ++++ b/gdb/symtab.c +@@ -478,6 +478,9 @@ iterate_over_some_symtabs (const char *name, + + gdb_assert (IS_ABSOLUTE_PATH (real_path)); + gdb_assert (IS_ABSOLUTE_PATH (name)); ++ gdb::unique_xmalloc_ptr fullname_real_path ++ = gdb_realpath (fullname); ++ fullname = fullname_real_path.get (); + if (FILENAME_CMP (real_path, fullname) == 0) + { + if (callback (s)) diff --git a/gdb.spec b/gdb.spec index 1213a0a..b17bab0 100644 --- a/gdb.spec +++ b/gdb.spec @@ -35,7 +35,7 @@ Version: 8.3.50.%{snapsrc} # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 25%{?dist} +Release: 26%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL # Do not provide URL for snapshots as the file lasts there only for 2 days. @@ -1142,6 +1142,9 @@ fi %endif %changelog +* Mon Jan 6 2020 Sergio Durigan Junior - 8.3.50.20190824-26 +- Fix 'Paths for breakpoints are not resolved' (RHBZ 1785768). + * Thu Nov 21 2019 Sergio Durigan Junior - 8.3.50.20190824-25 - Fix '[abrt] gdb-headless: target_ops::shortname(): gdb killed by SIGSEGV' (Sergio Durigan Junior, RHBZ 1765117).