public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb] Fix assert in delete_breakpoint
@ 2023-11-13 15:26 Tom de Vries
  2023-11-14 15:09 ` Simon Marchi
  0 siblings, 1 reply; 18+ messages in thread
From: Tom de Vries @ 2023-11-13 15:26 UTC (permalink / raw)
  To: gdb-patches

On a pinebook (aarch64 with 64-bit kernel and 32-bit userland) with test-case
gdb.base/gdb-sigterm.exp I run into:
...
intrusive_list.h:458: internal-error: erase_element: \
  Assertion `elem_node->prev != INTRUSIVE_LIST_UNLINKED_VALUE' failed.^M
...

Fix this similar to:
- commit c0afd99439f ("[gdb/tui] Fix assert in ~gdbpy_tui_window_maker"), and
- commit 995a34b1772 ("Guard against frame.c destructors running before
  frame-info.c's"
by checking is_linked () before attempting to remove from breakpoint_chain.

Tested on the pinebook and x86_64-linux.

PR gdb/31061
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31061
---
 gdb/breakpoint.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index fe09dbcbeee..0a58821fc00 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -12633,7 +12633,8 @@ delete_breakpoint (struct breakpoint *bpt)
   if (bpt->number)
     notify_breakpoint_deleted (bpt);
 
-  breakpoint_chain.erase (breakpoint_chain.iterator_to (*bpt));
+  if (bpt->is_linked ())
+    breakpoint_chain.erase (breakpoint_chain.iterator_to (*bpt));
 
   /* Be sure no bpstat's are pointing at the breakpoint after it's
      been freed.  */

base-commit: 6b682bbf86f37982ce1d270fb47f363413490bda
-- 
2.35.3


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

end of thread, other threads:[~2023-11-30 17:08 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 15:26 [PATCH] [gdb] Fix assert in delete_breakpoint Tom de Vries
2023-11-14 15:09 ` Simon Marchi
2023-11-15 11:12   ` Tom de Vries
2023-11-15 12:12     ` Tom de Vries
2023-11-21 12:22     ` Tom de Vries
2023-11-21 16:11     ` Simon Marchi
2023-11-21 16:52       ` Tom de Vries
2023-11-22 12:44         ` Tom de Vries
2023-11-22 14:49           ` Tom de Vries
2023-11-27 10:19           ` Tom de Vries
2023-11-27 16:29             ` Simon Marchi
2023-11-28 15:22               ` Tom de Vries
2023-11-28 15:30               ` Tom Tromey
2023-11-29 12:08                 ` Tom de Vries
2023-11-29 20:46                   ` Tom de Vries
2023-11-29 21:33                 ` Tom de Vries
2023-11-30 17:08                 ` Simon Marchi
2023-11-21 16:40   ` Luis Machado

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).