Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/breakpoints] Handle glibc with debuginfo in create_exception_master_breakpoint
Date: Fri, 5 Feb 2021 13:30:18 +0100	[thread overview]
Message-ID: <20210205123017.GA19341@delia> (raw)

Hi,

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.

Also needs to be backported to gdb-10-branch.

Any comments?

Thanks,
- Tom

[gdb/breakpoints] Handle glibc with debuginfo in create_exception_master_breakpoint

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/breakpoint.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index f318a125319..c20c0d7d649 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -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;
     }
 }

             reply	other threads:[~2021-02-05 12:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 12:30 Tom de Vries [this message]
2021-02-05 16:32 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210205123017.GA19341@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox