This is the mail archive of the
insight@sourceware.org
mailing list for the Insight project.
Re: insight 6.8 crash on setting breakpoint in shared library
- From: Denis PILAT <denis dot pilat at st dot com>
- To: Robert Bu <robert dot bu at gmail dot com>, Keith Seitz <keiths at redhat dot com>
- Cc: insight at sourceware dot org
- Date: Wed, 03 Sep 2008 15:56:46 +0200
- Subject: Re: insight 6.8 crash on setting breakpoint in shared library
- References: <a0319f700809020300y72c43a35j10e58caf789803c2@mail.gmail.com>
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 "<PENDING>" 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
2008-09-03 Denis Pilat <denis.pilat@st.com>
* 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 "<PENDING>" 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 ("<PENDING>", -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));