Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: drow@false.org,  gdb-patches@sources.redhat.com
Subject: Re: [RFA] Keep breakpoints always inserted.
Date: Wed, 02 Apr 2008 13:02:00 -0000	[thread overview]
Message-ID: <200804021626.07579.vladimir@codesourcery.com> (raw)
In-Reply-To: <uabl0hvm5.fsf@gnu.org>

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

On Saturday 15 March 2008 18:09:38 Eli Zaretskii wrote:
> > From: Vladimir Prus <vladimir@codesourcery.com>
> > Date: Sat, 15 Mar 2008 13:12:14 +0300
> > Cc: gdb-patches@sources.redhat.com
> > 
> > I've added NEW and documentation.
> 
> Thanks.
> 
> > +set breakpoint always-inserted
> > +show breakpoint always-inserted
> > +  Keep breakpoints always inserted in the target.
> 
> This entry is not detailed enough to be useful.  Please keep in mind
> that GDB users are not necessarily aware of the fact that GDB removes
> the breakpoints whenever the inferior stops and reinserts them before
> resuming it.
> 
> > +By default, @value{GDBN} inserts breakpoints in the target only when
> > +resuming the target, and removes breakpoints whenever the target stop.
>                                                                     ^^^^
> "stops".
> 
> > +This behaviour guards against leaving breakpoints inserted in the
> > +target should gdb abrubptly disconnect, which is possible with remote
> > +targets.
> 
> Without explaining that a breakpoint replaces a portion of code with a
> breakpoint instruction, the reader will not understand what is
> dangerous about this.
> 
> >                      This bevaious can be controlled with the following
>                             ^^^^^^^^
> You mean "behavior", right?
> 
> > +This is the default behaviour.  All breakpoints, including newly added
>                        ^^^^^^^^^
> Please use the US spelling ("behavior"), for consistency.
> 
> > +@item set breakpoint always-inserted on
> > +Causes all breakpoints to be inserted in the target at all times.  If
> > +the user adds a new breakpoint, or changes an existing breakpoint, the
> > +breakpoints in the target are updated immediately.  A breakpoint is
> > +removed from the target only when breakpoint itself is removed.
> 
> It would be good to give the reader a hint when this behavior is
> useful.
> 
> Otherwise, okay with me.

I have clarified this a bit. Does the attached looks OK for you (I have omitted
the code bits since they were not changed).

- Volodya


 



[-- Attachment #2: always_inserted_docs.diff --]
[-- Type: text/x-diff, Size: 4766 bytes --]

commit 24adf67c1cec1bca65dc4bae7611e59733c9986c
Author: Vladimir Prus <vladimir@codesourcery.com>
Date:   Fri Nov 30 21:35:52 2007 +0300

    Keep breakpoints always inserted.
    
    	* breakpoint.h (bp_location_p): New typedef.
    	Register a vector of bp_location_p.
    	* breakpoint.c (always_inserted_mode)
    	(show_always_inserted_mode): New.
    	(unlink_locations_from_global_list): Remove.
    	(update_global_location_list)
    	(update_global_location_list_nothrow): New.
    	(update_watchpoint): Don't free locations.
    	(should_insert_location): New.
    	(insert_bp_location): Use should_insert_location.
    	(insert_breakpoint_locations): Copied from
    	insert_breakpoints.
    	(insert_breakpoint): Use insert_breakpoint_locations.
    	(bpstat_stop_status): Call update_global_location_list
    	when disabling breakpoint.
    	(allocate_bp_location): Don't add to bp_location_chain.
    	(set_raw_breakpoint)
    	(create_longjmp_breakpoint, enable_longjmp_breakpoint)
    	(disable_longjmp_breakpoint, create_overlay_event_breakpoint)
    	(enable_overlay_breakpoints, disable_overlay_breakpoints)
    	(set_longjmp_resume_breakpoint)
    	(enable_watchpoints_after_interactive_call_stop)
    	(disable_watchpoints_before_interactive_call_start)
    	(create_internal_breakpoint)
    	(create_fork_vfork_event_catchpoint)
    	(create_exec_event_catchpoint, set_momentary_breakpoint)
    	(create_breakpoints, break_command_1, watch_command_1)
    	(create_exception_catchpoint)
    	(handle_gnu_v3_exceptions)
    	(disable_breakpoint, breakpoint_re_set_one)
    	(create_thread_event_breakpoint, create_solib_event_breakpoint)
    	(create_ada_exception_breakpoint): : Don't call check_duplicates.
    	Call update_global_location_list.
    	(delete_breakpoint): Don't remove locations and don't
    	try to reinsert them. Call update_global_location_list.
    	(update_breakpoint_locations): Likewise.
    	(restore_always_inserted_mode): New.
    	(update_breakpoints_after_exec): Temporary disable
    	always inserted mode.
    	* Makefile.in: Update dependencies.
    
    	* infrun.c (proceed): Remove breakpoints while stepping
    	over breakpoint.
    	(handle_inferior_event): Don't remove or insert
    	breakpoints.
    	* linux-fork.c (checkpoint_command): Remove breakpoints
    	before fork and insert after.
    	(linux_fork_context): Remove breakpoints before switch
    	and insert after.
    	* target.c (target_disconnect, target_detach): Remove
    	breakpoints from target.

diff --git a/gdb/NEWS b/gdb/NEWS
index 232e201..ff468d0 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -25,6 +25,12 @@ show exec-wrapper
 unset exec-wrapper
   Use a wrapper program to launch programs for debugging.
 
+set breakpoint always-inserted
+show breakpoint always-inserted
+  Keep breakpoints always inserted in the target, as opposed to inserting
+  them when resuming the target, and removing them when the target stops.
+  This option can improve debugger performance on slow remote targets.
+
 *** Changes in GDB 6.8
 
 * New native configurations
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index db5cdd4..c73a6d9 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -3205,6 +3205,30 @@ type.  If the target provides a memory map, @value{GDBN} will warn when
 trying to set software breakpoint at a read-only address.
 @end table
 
+@value{GDBN} normally implements breakpoints by replacing the program code
+at the breakpoint address with a special instruction, which, when
+executed, given control to the debugger.  By default, the program
+code is so modified only when the program is resumed.  As soon as
+the program stops, @value{GDBN} restores the original instructions.  This
+behaviour guards against leaving breakpoints inserted in the
+target should gdb abrubptly disconnect.  However, with slow remote
+targets, inserting and removing breakpoint can reduce the performance.
+This behavior can be controlled with the following commands::
+
+@kindex set breakpoint always-inserted
+@kindex show breakpoint always-inserted
+@table @code
+@item set breakpoint always-inserted off
+This is the default behaviour.  All breakpoints, including newly added
+by the user, are inserted in the target only when the target is
+resumed.  All breakpoints are removed from the target when it stops.
+
+@item set breakpoint always-inserted on
+Causes all breakpoints to be inserted in the target at all times.  If
+the user adds a new breakpoint, or changes an existing breakpoint, the
+breakpoints in the target are updated immediately.  A breakpoint is
+removed from the target only when breakpoint itself is removed.
+@end table
 
 @cindex negative breakpoint numbers
 @cindex internal @value{GDBN} breakpoints

  reply	other threads:[~2008-04-02 12:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-28 14:18 Vladimir Prus
2008-03-10 21:09 ` Daniel Jacobowitz
2008-03-14 20:22   ` Vladimir Prus
2008-03-15 10:13   ` Vladimir Prus
2008-03-15 15:10     ` Eli Zaretskii
2008-04-02 13:02       ` Vladimir Prus [this message]
2008-04-02 18:18         ` Eli Zaretskii
2008-03-17 22:21     ` Daniel Jacobowitz
2008-03-18  4:15       ` Eli Zaretskii
2008-03-18  6:06         ` Vladimir Prus
2008-04-03 18:10       ` Vladimir Prus
2008-04-07 15:32         ` Daniel Jacobowitz
2008-04-09 23:45           ` Vladimir Prus
2008-04-10  8:16             ` Luis Machado
2008-04-17 16:50             ` Daniel Jacobowitz
2008-04-23 21:18               ` Pedro Alves
2008-04-23 21:24                 ` Daniel Jacobowitz
2008-04-24 11:22                   ` Vladimir Prus
2008-04-24 12:10                     ` Vladimir Prus

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=200804021626.07579.vladimir@codesourcery.com \
    --to=vladimir@codesourcery.com \
    --cc=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    /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