public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Roland Schwingel <roland@onevision.com>
To: insight@sourceware.org
Subject: [PATCH/gdbtk] Fix crash when running insight with pending breakpoints
Date: Wed, 11 Apr 2012 12:28:00 -0000	[thread overview]
Message-ID: <4F8578E5.5070707@onevision.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

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  <roland.schwingel@onevision.com>

	* 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

[-- Attachment #2: pending_bp_crash.patch --]
[-- Type: text/plain, Size: 792 bytes --]

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,

             reply	other threads:[~2012-04-11 12:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 12:28 Roland Schwingel [this message]
2012-04-19  0:12 ` Keith Seitz
2012-04-19  9:45 Roland Schwingel

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=4F8578E5.5070707@onevision.com \
    --to=roland@onevision.com \
    --cc=insight@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).