[PATCH/gdbtk] Fix crash when running insight with pending breakpoints
Roland Schwingel <[email protected]> Wed, 11 Apr 2012 14:28:21 +0200
| Newsgroups | gmane.comp.debugging.insight |
|---|---|
| Message-ID | <[email protected]> |
Hi... When I set breakpoints in insight it remembers it after restart. If the breakpoint is in a shared library (dll) it is created as pending breakpoint after restart. But when I restart insight it is crashing as soon as I click the "Run" button top left in the source window. This is reasoned by the fact that pending breakpoint has a NULL location pointer, but the location is dereferenced by. The attached simple patch fixes this. Changelog: 2012-04-11 Roland Schwingel <[email protected]> * generic/gdbtk-bp.c: Updated copyright. (gdb_find_bp_at_line): Don't access location struct of breakpoint if it is NULL. Any comments? Is this ok? Roland
pending_bp_crash.patch
(text/plain, 792 B)
diff -ruNp gdbtk_orig/generic/gdbtk-bp.c gdbtk/generic/gdbtk-bp.c
--- gdbtk_orig/generic/gdbtk-bp.c 2012-03-20 15:17:33.000000000 +0100
+++ gdbtk/generic/gdbtk-bp.c 2012-04-11 14:02:19.285142700 +0200
@@ -1,6 +1,5 @@
/* Tcl/Tk command definitions for Insight - Breakpoints.
- Copyright (C) 2001, 2002, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 2001-2012 Free Software Foundation, Inc.
This file is part of GDB.
@@ -254,7 +253,7 @@ gdb_find_bp_at_line (ClientData clientDa
Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL);
ALL_BREAKPOINTS (b)
{
- if (b->loc->line_number == line
+ if (b->loc && b->loc->line_number == line
&& !strcmp (b->loc->source_file, s->filename))
{
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,