Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Hui Zhu <teawater@gmail.com>
Cc: Michael Snyder <msnyder@vmware.com>,
	 "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] Fix hw watchpoints in process record.
Date: Sun, 22 Nov 2009 12:56:00 -0000	[thread overview]
Message-ID: <200911221255.25826.pedro@codesourcery.com> (raw)
In-Reply-To: <daef60380911211810i5ee040cfk7f646bc6011489e1@mail.gmail.com>

On Sunday 22 November 2009 02:10:23, Hui Zhu wrote:
> I think this patch still not OK.
...
> (gdb) hb *0x000000000040055b
> During symbol reading, incomplete CFI data; unspecified registers
> (e.g., rax) at 0x400550.
> Hardware assisted breakpoint 2 at 0x40055b: file 1.c, line 21.
> (gdb) record
> (gdb) c
> Continuing.
> 
> Program received signal SIGTRAP, Trace/breakpoint trap.
> 0x000000000040055c in main () at 1.c:21
> 21	       int     c = 1;
> (gdb) info reg pc
> pc: 0x40055c
> 
> The stop pc is not right.  Looks we need do some special works when
> this is a simple hb.

You're confusing hardware watchpoints with hardware breakpoints.
The patch handles hardware _watchpoints_ only.

Fixing hardware breakpoints is a different and unrelated
issue.

Actually, the problem you're seeing sounds simple: The
breakpoint is set at 0x40055b, but GDB shows the SIGTRAP trigger
at 0x40055c.  Off by one, that is.  Completelly untested,
but I bet that something like this fixes it:

record_wait:
		  if (breakpoint_inserted_here_p (get_regcache_aspace (regcache),
						  tmp_pc))
		    {
		      /* There is a breakpoint.  GDB will want to stop.  */
+		  if (software_breakpoint_inserted_here_p (get_regcache_aspace (regcache),
+						  tmp_pc))

		      struct gdbarch *gdbarch = get_regcache_arch (regcache);
		      CORE_ADDR decr_pc_after_break
			= gdbarch_decr_pc_after_break (gdbarch);
		      if (decr_pc_after_break)
			regcache_write_pc (regcache,
					   tmp_pc + decr_pc_after_break);
+	           }
		    }

-- 
Pedro Alves


  reply	other threads:[~2009-11-22 12:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-01  1:23 Michael Snyder
2009-11-04  3:01 ` Hui Zhu
2009-11-04 17:51   ` Michael Snyder
2009-11-05  1:41     ` Hui Zhu
2009-11-05 18:41   ` Michael Snyder
2009-11-05 19:09     ` Pedro Alves
2009-11-12  0:27       ` Pedro Alves
2009-11-20 18:11         ` Michael Snyder
2009-11-21  9:41           ` Hui Zhu
2009-11-21 12:05             ` Pedro Alves
2009-11-21 19:50             ` Michael Snyder
2009-11-22  2:11               ` Hui Zhu
2009-11-22 12:56                 ` Pedro Alves [this message]
2009-11-22 15:45                   ` Pedro Alves
2009-11-22 19:22                     ` Eli Zaretskii
2009-11-24  1:58                     ` Pedro Alves
2009-11-26  2:28                       ` Hui Zhu
2009-11-22 15:50                   ` Pedro Alves
2009-11-22 20:21                 ` Michael Snyder
2009-11-22 23:03                   ` Pedro Alves
2009-11-23  3:17                     ` Hui Zhu
2009-11-09  3:18     ` Hui Zhu
2009-11-09 21:20       ` Michael Snyder
2009-11-10  7:39         ` Hui Zhu
2009-11-09 17:48     ` Tom Tromey
2009-11-10 23:32       ` Michael Snyder
2009-11-11  8:49         ` Hui Zhu
2009-11-12  0:05           ` Pedro Alves

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=200911221255.25826.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.com \
    --cc=teawater@gmail.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