Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@is.elta.co.il>
To: Jiri Smid <smid@suse.cz>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA]: x86_64 target - multiarch
Date: Wed, 05 Sep 2001 07:38:00 -0000	[thread overview]
Message-ID: <Pine.SUN.3.91.1010905172637.15665G-100000@is> (raw)
In-Reply-To: <s8vr8tlenxi.fsf@naga.suse.cz>

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.


  reply	other threads:[~2001-09-05  7:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-05  7:02 Jiri Smid
2001-09-05  7:38 ` Eli Zaretskii [this message]
2001-09-05 15:31 ` Mark Kettenis
2001-09-05 18:05   ` Andrew Cagney
2001-09-06  0:30   ` Eli Zaretskii
2001-09-11  5:13     ` Jiri Smid
2001-09-11  5:43       ` Eli Zaretskii
2001-09-12  2:31         ` Jiri Smid
2001-09-05 17:55 ` Andrew Cagney

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=Pine.SUN.3.91.1010905172637.15665G-100000@is \
    --to=eliz@is.elta.co.il \
    --cc=gdb-patches@sources.redhat.com \
    --cc=smid@suse.cz \
    /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