public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* insight 6.8 crash on setting breakpoint in shared library
@ 2008-09-17  6:34 Robert Bu
  2008-09-17 15:04 ` Denis PILAT
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Bu @ 2008-09-17  6:34 UTC (permalink / raw)
  To: insight

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

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

* Re: insight 6.8 crash on setting breakpoint in shared library
  2008-09-17  6:34 insight 6.8 crash on setting breakpoint in shared library Robert Bu
@ 2008-09-17 15:04 ` Denis PILAT
  2008-09-17 16:47   ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Denis PILAT @ 2008-09-17 15:04 UTC (permalink / raw)
  To: Robert Bu, Keith Seitz; +Cc: insight

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

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

[-- Attachment #2: gdbtk-bp.c.patch --]
[-- Type: text/plain, Size: 3540 bytes --]

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

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

* Re: insight 6.8 crash on setting breakpoint in shared library
  2008-09-17 15:04 ` Denis PILAT
@ 2008-09-17 16:47   ` Keith Seitz
  2008-09-20  4:03     ` Denis PILAT
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Seitz @ 2008-09-17 16:47 UTC (permalink / raw)
  To: Denis PILAT; +Cc: insight

Denis PILAT wrote:

> Waiting for your feedback,

That looks good. Please commit. I'll work on getting everything 100% 
after your patch is in.

Thank you for the patch.

Keith

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

* Re: insight 6.8 crash on setting breakpoint in shared library
  2008-09-17 16:47   ` Keith Seitz
@ 2008-09-20  4:03     ` Denis PILAT
  0 siblings, 0 replies; 4+ messages in thread
From: Denis PILAT @ 2008-09-20  4:03 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

Hello,

I've just committed that patch,
sorry for the delay.
Normally insight should not crash anymore when setting pending BP (from 
the console for instance)

Cheers
Denis

Keith Seitz wrote:
> Denis PILAT wrote:
>
>> Waiting for your feedback,
>
> That looks good. Please commit. I'll work on getting everything 100% 
> after your patch is in.
>
> Thank you for the patch.
>
> Keith
>

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

end of thread, other threads:[~2008-09-19  7:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-17  6:34 insight 6.8 crash on setting breakpoint in shared library Robert Bu
2008-09-17 15:04 ` Denis PILAT
2008-09-17 16:47   ` Keith Seitz
2008-09-20  4:03     ` Denis PILAT

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