This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Fix hw watchpoints in process record.

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

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:

		  if (breakpoint_inserted_here_p (get_regcache_aspace (regcache),
		      /* 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]