[gdb/breakpoints] Handle glibc with debuginfo in create_exception_master_breakpoint
authorTom de Vries <tdevries@suse.de>
Fri, 5 Feb 2021 16:47:07 +0000 (17:47 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 5 Feb 2021 16:47:07 +0000 (17:47 +0100)
The test-case nextoverthrow.exp is failing on targets with unstripped libc.

This is a regression since commit 1940319c0ef "[gdb] Fix internal-error in
process_event_stop_test".

The problem is that this code in create_exception_master_breakpoint:
...
      for (objfile *sepdebug = obj->separate_debug_objfile;
          sepdebug != nullptr; sepdebug = sepdebug->separate_debug_objfile)
        if (create_exception_master_breakpoint_hook (sepdebug))
...
iterates over all the separate debug object files, but fails to handle the
case that obj itself has the debug info we're looking for.

Fix this by using the separate_debug_objfiles () range instead, which does
iterate both over obj and the obj->separate_debug_objfile chain.

Tested on x86_64-linux.

gdb/ChangeLog:

2021-02-05  Tom de Vries  <tdevries@suse.de>

PR breakpoints/27330
* breakpoint.c (create_exception_master_breakpoint): Handle case that
glibc object file has debug info.

gdb/ChangeLog
gdb/breakpoint.c

index 8c2953aa8cc58eb22335654516e73d887baf6136..1f5840e57017b53de59c7dfd535e27f604ce0775 100644 (file)
@@ -1,3 +1,9 @@
+2021-02-05  Tom de Vries  <tdevries@suse.de>
+
+       PR breakpoints/27330
+       * breakpoint.c (create_exception_master_breakpoint): Handle case that
+       glibc object file has debug info.
+
 2021-02-05  Tom de Vries  <tdevries@suse.de>
 
        PR symtab/27333
index f318a125319e2843226ea0ffd0ab86924034bf7e..c20c0d7d6498104ce58c910979c8f75f52c54e0c 100644 (file)
@@ -3625,11 +3625,10 @@ create_exception_master_breakpoint (void)
       if (create_exception_master_breakpoint_probe (obj))
        continue;
 
-      /* Iterate over separate debug objects and try an _Unwind_DebugHook
-        kind breakpoint.  */
-      for (objfile *sepdebug = obj->separate_debug_objfile;
-          sepdebug != nullptr; sepdebug = sepdebug->separate_debug_objfile)
-       if (create_exception_master_breakpoint_hook (sepdebug))
+      /* Iterate over main and separate debug objects and try an
+        _Unwind_DebugHook kind breakpoint.  */
+      for (objfile *debug_objfile : obj->separate_debug_objfiles ())
+       if (create_exception_master_breakpoint_hook (debug_objfile))
          break;
     }
 }
This page took 0.031209 seconds and 4 git commands to generate.