From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30837 invoked by alias); 3 Sep 2008 13:57:42 -0000 Received: (qmail 30820 invoked by uid 22791); 3 Sep 2008 13:57:41 -0000 X-Spam-Check-By: sourceware.org Received: from s200bog13.obsmtp.com (HELO s200bog13.obsmtp.com) (207.126.150.127) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 03 Sep 2008 13:56:55 +0000 Received: from source ([164.129.1.35]) (using TLSv1) by eu2sys200bob013.postini.com ([207.126.147.11]) with SMTP; Wed, 03 Sep 2008 13:56:47 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 18DC1DAC5; Wed, 3 Sep 2008 13:56:47 +0000 (GMT) Received: from mail1.cro.st.com (mail1.cro.st.com [164.129.40.131]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E0ECC4C150; Wed, 3 Sep 2008 13:56:46 +0000 (GMT) Received: from crx595.cro.st.com (crx595.cro.st.com [164.129.44.95]) by mail1.cro.st.com (MOS 3.8.7a) with ESMTP id CPQ62523 (AUTH "denis pilat"); Wed, 3 Sep 2008 15:57:22 +0200 (CEST) Message-ID: <48BE979E.3050303@st.com> Date: Wed, 17 Sep 2008 15:04:00 -0000 From: Denis PILAT User-Agent: Thunderbird 2.0.0.16 (X11/20080707) MIME-Version: 1.0 To: Robert Bu , Keith Seitz Cc: insight@sourceware.org Subject: Re: insight 6.8 crash on setting breakpoint in shared library References: In-Reply-To: Content-Type: multipart/mixed; boundary="------------080602010705010509080209" X-IsSubscribed: yes Mailing-List: contact insight-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sourceware.org X-SW-Source: 2008-q3/txt/msg00057.txt.bz2 This is a multi-part message in MIME format. --------------080602010705010509080209 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1715 Hello everybody, This bugs occurs for any pending breakpoints. If you do "break printf" before the program is being run, then insight crashes. It was not present in the 6.7.1 version of insight. I've just implemented a fix for that. It's not a perfect support for pending breakpoints into insight, but it's better than before. Attached the proposed patch. It's based on the 6.8 version of insight. I did not had time to rebase it on the cvs head, but if it's suitable, I can do it. So with this patch, Eclipse does not crash anymore, and the breakpoint window display "" in the FileName column and the entered user expression into the Function field of the breakpoint view. Zeros are displayed into the line number and address field. There is just one thing I'm not satisfied with: when the breakpoint becomes not pending, then the Breakpoint view is not refreshed. User needs to close and open it. I'm not familiar enough with this part of gdb to handle that correctly, may be Keith can help. Waiting for your feedback, -- Denis Robert Bu wrote: > Hello All, > > When I try to set a breakpoint, which is in a shared library not loaded > in yet, such as > > In GDB console window of insight, type: > b test_file.cpp:20 > > Insight pops up a window saying: > Make breakpoint pending on future shared library load? > > I click Yes. Then insight crashes with "Segmentation fault". GDB 6.8 can > set the breakpoint on the shared library. > > My insight version is 6.8 under Linux. > To reproduce the problem, just open an executable file with insight > (e.g. insight test, set a breakpoint on even an un-existed shared > library (e.g. b hello.cpp:20). > > Best regards. > > Robert > > --------------080602010705010509080209 Content-Type: text/plain; name="gdbtk-bp.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdbtk-bp.c.patch" Content-length: 3540 2008-09-03 Denis Pilat * generic/gdbtk-bp.c (gdb_get_breakpoint_info): Manage the case of NULL location to handle pending breakpoint in a better way. (gdb_find_bp_at_addr): Likewise. Index: generic/gdbtk-bp.c =================================================================== --- generic/gdbtk-bp.c (revision 695) +++ generic/gdbtk-bp.c (working copy) @@ -220,7 +220,7 @@ gdb_find_bp_at_addr (ClientData clientDa Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL); for (i = 0; i < breakpoint_list_size; i++) { - if (breakpoint_list[i] != NULL + if (breakpoint_list[i] != NULL && breakpoint_list[i]->loc != NULL && breakpoint_list[i]->loc->address == addr) Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewIntObj (i)); @@ -289,6 +289,7 @@ gdb_get_breakpoint_info (ClientData clie int bpnum; struct breakpoint *b; char *funcname, *filename; + int isPending = 0; Tcl_Obj *new_obj; @@ -311,27 +312,42 @@ gdb_get_breakpoint_info (ClientData clie return TCL_ERROR; } - sal = find_pc_line (b->loc->address, 0); - - filename = symtab_to_filename (sal.symtab); - if (filename == NULL) - filename = ""; - + isPending = (b->loc == NULL); Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL); - Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, - Tcl_NewStringObj (filename, -1)); + /* Pending breakpoints will display "" as the file name and the + user expression into the Function field of the breakpoint view. + "0" and "0" in the line number and address field. */ + if (isPending) + { + Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, + Tcl_NewStringObj ("", -1)); + Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, + Tcl_NewStringObj (b->addr_string, -1)); + Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, + Tcl_NewIntObj (0)); + Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, + Tcl_NewIntObj (0)); + } + else + { + sal = find_pc_line (b->loc->address, 0); - funcname = pc_function_name (b->loc->address); - new_obj = Tcl_NewStringObj (funcname, -1); - Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, new_obj); + filename = symtab_to_filename (sal.symtab); + if (filename == NULL) + filename = ""; + Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, + Tcl_NewStringObj (filename, -1)); + funcname = pc_function_name (b->loc->address); + Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, + Tcl_NewStringObj (funcname, -1)); + Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, + Tcl_NewIntObj (b->line_number)); + Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, + Tcl_NewStringObj (core_addr_to_string + (b->loc->address), -1)); + } Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, - Tcl_NewIntObj (b->line_number)); - Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, - Tcl_NewStringObj (core_addr_to_string - (b->loc->address), - -1)); - Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewStringObj (bptypes[b->type], -1)); Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewBooleanObj (b->enable_state == bp_enabled)); --------------080602010705010509080209--