This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA]: x86_64 target - multiarch
- To: Jiri Smid <smid at suse dot cz>
- Subject: Re: [RFA]: x86_64 target - multiarch
- From: Eli Zaretskii <eliz at is dot elta dot co dot il>
- Date: Wed, 5 Sep 2001 17:38:40 +0300 (IDT)
- cc: gdb-patches at sources dot redhat dot com
On 5 Sep 2001, Jiri Smid wrote:
> * config/djgpp/fnchange.lst: Add entries for x86_64-linux-tdep.c
> and x86_64-linux-nat.c
These changes are approved.
> + int
> + x86_64_insert_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rw)
> + {
> + return x86_64_insert_aligned_watchpoint (ptid, addr, addr, len, rw);
> + }
> +
> + static int
> + x86_64_insert_aligned_watchpoint (ptid_t ptid, CORE_ADDR waddr,
> + CORE_ADDR addr, int len, int rw)
> + {
> + int i;
> + int read_write_bits, len_bits;
> + int free_debug_register;
> + int register_number;
> +
> + /* Look for a free debug register. */
> + for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++)
> + {
> + if (address_lookup[i - DR_FIRSTADDR] == 0)
> + break;
> + }
> +
> + /* No more debug registers! */
> + if (i > DR_LASTADDR)
> + return -1;
> +
> + read_write_bits = (rw & 1) ? DR_RW_READ : DR_RW_WRITE;
> +
> + if (len == 1)
> + len_bits = DR_LEN_1;
> + else if (len == 2)
> + {
> + if (addr % 2)
> + return x86_64_insert_nonaligned_watchpoint (ptid, waddr, addr, len,
> + rw);
> + len_bits = DR_LEN_2;
> + }
I think I already mentioned this in earlier discussions: why did you base
the watchpoint support on the old SysV stuff instead of the newer code in
i386-nat.c? Don't you want the additional features supported by
i386-nat.c, like debug register sharing between watchpoints? Try this,
for example:
(gdb) watch a == 1
(gdb) watch a == 2
(gdb) watch a == 3
(gdb) watch a == 4
In your implementation, this takes 4 debug registers, whereas i386-nat.c
will only use one. Also, with your implementation, even if you are ready
to waste 3 debug registers, GDB might become confused if you decide to
remove one of these watchpoints (since the remove_watchpoint code will
zero out all the debug registers because they watch the same address).
Also, I think this implementation doesn't support watching regions larger
than 8 bytes very well, because the code which removes watchpoints
doesn't break the region into smaller regions the same way
x86_64_insert_nonaligned_watchpoint does.
So I suggest to use the code in i386-nat.c as the starting point.