This is the mail archive of the gdb@sourceware.cygnus.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: i386 debugging registers


Mark,

I can see one situation where one may want to look at or set debugger registers:
when debugging a debugger's hardware breakpoint support.  So, I believe we should
leave these registers out of the users sight.

As a compromise, I suggest that we add (I will do the same on my targets around
here) a pair of "qQ" packets to read/write those registers.

What I mean is:
qDEBUGREG...tbd...
QDEBUGREG...tbd..=<new value>

We can add a maintenance command to access that.  That is what maintenance 
commands are for.

What do you think?  Would that solve your problem?

Regards,
Fernando


Mark Kettenis wrote:
> 
> Hi,
> 
> While trying to build a generic layer for implementing hardware
> watchpoint for the various i386 native ports, I found myself starting
> to implement some sort of register cache for the debugging registers.
> Instead actually doing so, I wondered whether it would be a good idea
> to add the debug registers to the standard register cache.
> 
> Pros:
> 
>  * It makes my life easier :-)
> 
>  * They are, you know, erh... registers.
> 
>  * Some people might actually want to fiddle with them, especially
>    with the control register which has some bits that control the
>    instruction pipeline.
> 
> Cons:
> 
>  * It might confuse our users.  Fiddling with the debug registers
>    might interfere with the hardware watchpoint support.  For example,
>    Assigning to one of the address registers will probably make GDB
>    forget about some hardware watchpoints and produce some weird
>    warnings.  It will also likely cause some spurious SIGTRAPS.
> 
>  * The exact effect of modifying the debugging registers is somewhat
>    dependent on the underlying OS.  To make sure GDB's hardware
>    watchpoints work as expected, some additional frobbing of the
>    debugging might be necessary in the code that actually fetches
>    and/or stores the registers.  The user will see those frobbed
>    registers instead of the real ones.
> 
> Comments?
> 
> Mark

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@cygnus.com
2323 Yonge Street, Suite #300           Tel:  416-482-2661 ext. 311
Toronto, Ontario   M4P 2C9              Fax:  416-482-6299

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