This is the mail archive of the gdb-patches@sources.redhat.com 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]

RE: Patch for gdb5.0; enable hardware watchpoints on UnixWare


Eli Zaretskii writes:
> Note that I'm working on a unified watchpoint implementation for all
> ia32 targets, based on the code written for the DJGPP port (see
> go32-nat.c).

Ah good.  I saw the stuff in TODO yesterday and was trying to work up
the courage to propose doing this myself.

> I am trying to make this happen for v5.1, so perhaps changes like this
> one should be witheld and not committed, at least until we decide that
> I'm not living up to my promises.

Oh, please ignore my patch then, could you steal the svr42mp specific
bits of it for 5.1?  (debug registers held in pr_family element of
proc status, PCSDEBUG operation to write debug registers).

Looking at version 1.6 of go32-nat.c I've got a couple of comments:

1. Why not zap the waddr arg to go32_..._watchpoint?  It's not used.

2. In go32_insert_aligned_watchpoint (and ...remove_aligned...) you
   have a "switch" to work out the len_bits for the watchpoint, then a
   loop to find an existing watchpoint that might match, then an
   "if" to check for non-aligned watchpoints.  (Which could not have
   matched in the loop).

   It seems to me this could be simplified to:

  ...
  if (addr % len)
    return go32_handle_nonaligned_watchpoint (wp_insert, addr, len, rw);

  switch (len)
  {
  case 4:
    len_bits = DR_LEN_4;
    break;
  case 2:
    len_bits = DR_LEN_2;
    break;
  case 1:
    len_bits = DR_LEN_1;
    break;
  default:
    return go32_handle_nonaligned_watchpoint (wp_insert, addr, len, rw);
  }

  /* Look for an occupied debug register with the same address and the
     same RW and LEN definitions.  If we find one, we can use it for
     this watchpoint as well (and save a register).  */
  ...

3. You're not using the DR_FIRSADDR/DR_LASTADDR defines.

4. You have a define DR_RW_READWRITE, other people (SVR3/SVR4/SVR5) seem
   to have DR_RW_READ with the same value (0x3).

5. Not everybody has DR_CONTROL_MASK.

	#define DR_CONTROL_MASK ((1<<DR_CONTROL_SIZE) - 1)

-- 
John Hughes <john@Calva.COM>, 
        CalvaEDI SA.                            Tel: +33-1-4313-3131
        66 rue du Moulin de la Pointe,          Fax: +33-1-4313-3139
        75013 PARIS.


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