[PATCH 2/2] Fix advance/until and multiple locations (PR gdb/26524)

Tom de Vries tdevries@suse.de
Fri Aug 28 08:49:52 GMT 2020


On 8/28/20 10:31 AM, Tom de Vries wrote:
> On 8/22/20 10:38 PM, Pedro Alves wrote:
>> 	* gdb.base/advance-until-multiple-locations.cc: New.
>> 	* gdb.base/advance-until-multiple-locations.exp: New.
> 
> Hi,
> 
> just to note that this fails for me with gcc 7, gcc 4.8 and clang 10:
> ...
> Breakpoint 10, test () at advance-until-multiple-locations.cc:45^M
> 45        int i = 0;^M
> (gdb) until ovld_func^M
> main () at advance-until-multiple-locations.cc:61^M
> 61      }^M
> (gdb) FAIL: gdb.base/advance-until-multiple-locations.exp:
> until_overload: until ovld_func
> ...
> 
> It passes with gcc-8, gcc-9, gcc-10 and gcc-11.

OK, this is due to the difference in line number info between gcc-7 and
gcc-8, a known issue: with gcc-8, we have additional "recommended
breakpoint locations".

This fixes it for me:
...
diff --git a/gdb/testsuite/gdb.base/advance-until-multiple-locations.cc
b/gdb/t
estsuite/gdb.base/advance-until-multiple-locations.cc
index a90493805f..15e651abae 100644
--- a/gdb/testsuite/gdb.base/advance-until-multiple-locations.cc
+++ b/gdb/testsuite/gdb.base/advance-until-multiple-locations.cc
@@ -58,4 +58,4 @@ int
 main ()
 {
   return test ();
-}
+} // main
diff --git a/gdb/testsuite/gdb.base/advance-until-multiple-locations.exp
b/gdb/
testsuite/gdb.base/advance-until-multiple-locations.exp
index a6a1de6653..037b81947e 100644
--- a/gdb/testsuite/gdb.base/advance-until-multiple-locations.exp
+++ b/gdb/testsuite/gdb.base/advance-until-multiple-locations.exp
@@ -129,7 +129,7 @@ proc_with_prefix until_overload {} {
     # ovld_func is a different frame, so it shouldn't cause a stop.
     # Instead, the program should stop at the caller frame.
     gdb_test "until ovld_func" \
-       "main .* at .*return test \\(\\);.*"
+       "main .* at .*(return test \\(\\);|\} // main)"
 }

 foreach_with_prefix cmd {"until" "advance"} {
...


More information about the Gdb-patches mailing list