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]: Make Linux use the new unified x86 watchpoint support



On Wed, 28 Mar 2001, Mark Salter wrote:

> > Is there any reason that you can't define HAVE_NONSTEPPABLE_WATCHPOINT 
> > (or some of its other brethren; see infrun.c) and get GDB to DTRT for 
> > your target?
> 
> Hmm. So, what are the meanings of HAVE_NONSTEPPABLE_WATCHPOINT and
> HAVE_STEPPABLE_WATCHPOINT? It seems if you have one, you don't have
> the other, but infrun.c doesn't see it that way.

IMVHO, infrun.c is somewhat messy in this area; see the comments around 
that code.  A target should have either of these two or none, but not 
both.  However, in practice, if you don't define any of these constants, 
it automatically gets defined to zero by infrun.c (see the beginning of 
the file), so the compiler will simply optimize the wrong if clauses out 
of existence when you build GDB.

>   int foo = 3;
> 
>   main()
>   {
>      printf("%d\n", foo);
>   }
[...]
> If I define HAVE_NONSTEPPABLE_WATCHPOINT, I get:
> 
>   (gdb) c
>   Continuing.
>   Hardware read watchpoint 1: foo
> 
>   Value = 3
>   0xa0020c4c in printf () at ....
>   (gdb)

This looks like what you should get.

> Note that gdb stopped inside printf. This seems suboptimal but at least
> there's not error.

Why suboptimal?  Does disassembly show that the debuggee stopped on a 
wrong insn?  That is, do you indeed see an instruction before 0x0020c4c 
which accesses the value of `foo'?  Can you show the instructions near 
this point?


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