public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] Only leave dprintf inserted if it is marked as persistent (PR breakpoints/17012)
@ 2014-08-22 19:05 Simon Marchi
  2014-08-22 19:05 ` [PATCH v3 2/2] Add dprintf and detach test " Simon Marchi
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Simon Marchi @ 2014-08-22 19:05 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

On Linux native, if dprintf are inserted when detaching, they are left
in the inferior which causes it to crash from a SIGTRAP. It also happens
with dprintfs on remote targets, when set disconnected-dprintf is off.

I believe that the rationale of the line I modified was to leave dprinfs
inserted in order to support disconnected dprintfs. This adds a check to
see if the dprintf should actually stay inserted or not.

bl->target_info.persist will be 1 only if disconnected-dprintf is on and
we are debugging a remote target. On native, it will always be 0,
regardless of the value of disconnected-dprintf. This makes sense, since
disconnected dprintfs are not supported by the native target.

New in v3:
* Follow-up Pedro's review
  * Remove == 1 for check on boolean.

gdb/Changelog:

	PR breakpoints/17012
	* breakpoint.c (remove_breakpoints_pid): Only skip removing
	dprintf if it is marked as persistent.
---
 gdb/breakpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 683ed2b..01e9b36 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3110,7 +3110,7 @@ remove_breakpoints_pid (int pid)
     if (bl->pspace != inf->pspace)
       continue;
 
-    if (bl->owner->type == bp_dprintf)
+    if (bl->owner->type == bp_dprintf && bl->target_info.persist)
       continue;
 
     if (bl->inserted)
-- 
2.1.0

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

end of thread, other threads:[~2014-12-10 21:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-22 19:05 [PATCH v3 1/2] Only leave dprintf inserted if it is marked as persistent (PR breakpoints/17012) Simon Marchi
2014-08-22 19:05 ` [PATCH v3 2/2] Add dprintf and detach test " Simon Marchi
2014-09-04 16:46   ` Pedro Alves
2014-09-04 18:37     ` Simon Marchi
2014-09-05 15:41       ` Pedro Alves
2014-12-10 21:14         ` Simon Marchi
2014-09-02 14:13 ` [PATCH v3 1/2] Only leave dprintf inserted if it is marked as persistent " Simon Marchi
2014-09-04 16:45 ` Pedro Alves
2014-09-04 18:33   ` Simon Marchi

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