Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Hui Zhu <hui_zhu@mentor.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] breakpoint remove fail handle bug fix
Date: Wed, 11 Apr 2012 10:53:00 -0000	[thread overview]
Message-ID: <4F85607A.3090205@codesourcery.com> (raw)
In-Reply-To: <4F8549BC.3050003@mentor.com>

Here are some my thoughts on this problem.  I didn't read patch
carefully, so have no comments on it.

On 04/11/2012 05:07 PM, Hui Zhu wrote:
> This because is when GDB got fail when it remove the breakpoint, it give
> up the control of this breakpoint.

You are removing breakpoints when inferior is in background execution.
It is expected or reasonable that GBD is unable to remove breakpoint
instructions from inferior when it is running (due to ptrace limitation
IIRC).

> There are 2 issues about it:
> 1. When the GDB stop, this breakpoint is not be removed.

This is because breakpoint instances (not breakpoint instructions
written in inferior) was remove when inferior is running.  When inferior
stops, breakpoint instructions are not removed from inferior, because
there is no breakpoint instances in GDB.  Current policy in GDB is that
even we get something wrong in removing breakpoints, still remove them
from global list.  See the comment in breakpoint.c:

	      if (remove_breakpoint (old_loc, mark_uninserted))
		{
		  /* This is just about all we can do.  We could keep
		     this location on the global list, and try to
		     remove it next time, but there's no particular
		     reason why we will succeed next time.
		
		     Note that at this point, old_loc->owner is still
		     valid, as delete_breakpoint frees the breakpoint
		     only after calling us.  */
		  printf_filtered (_("warning: Error removing "
				     "breakpoint %d\n"),
				   old_loc->owner->number);
		}

If we change the policy to "keep breakpoint instances if fail to remove
from inferior", this problem may be fixed.

> 2. If inferior is stoped by this breakpoint, adjust_pc_after_break
> didn't know this stop is beauce the breakpoint, so the pc address will
> not be adjust to the right value.

adjust_pc_after_break doesn't know because there is no breakpoint
instance in GDB.

-- 
Yao (齐尧)


  reply	other threads:[~2012-04-11 10:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11  9:32 Hui Zhu
2012-04-11 10:53 ` Yao Qi [this message]
2012-04-11 21:33 ` Jan Kratochvil
2012-04-12  4:04   ` Hui Zhu
2012-04-16 10:01     ` Jan Kratochvil
2012-04-16 16:42       ` Hui Zhu
2012-04-17 21:15     ` Jan Kratochvil
2012-04-12  4:45   ` Doug Evans
2012-04-12  4:35 ` Doug Evans
2012-04-16  9:50   ` Hui Zhu

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=4F85607A.3090205@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=hui_zhu@mentor.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