Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Some questions w.r.t remote watchpoint support in i386
@ 2006-04-25 12:54 Wu Zhou
  2006-04-25 19:34 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Wu Zhou @ 2006-04-25 12:54 UTC (permalink / raw)
  To: gdb

Hello all,

I am playing with remote debugging on i386 platform.  At the very first, I 
start gdbserver and gdb on two different i386 machines.  In this configuration, 
local gdb client can connect to remote gdb server.  But after I set a 
breakpoint and issue "cont" command, remote debuggee get a SIGV error.

Then I start gdbserver and gdb on the same machine.  There is no such 
error any more.  And it seems that most gdb commands work ok.  But I 
encounter some problems with h/w watchpoint operations.  I did some 
search, and don't find much information about my problems.  So I choose to 
ask here:

1. The first error I encounter is: "Couldn't write debug register: No such
process". 

After some tracking, I found gdb client is calling target_insert_watchpoint
defined in config/i386/nm-i386.h, instead of the remote_insert_watchpoint 
defined in remote.c

I guess this is a more general problem.  Whenever you change target under 
i386 platform, you will always get the i386_insert_watchpoint (and other 
three target operations) executed.

Maybe we can put these target operation into the target_ops, instead of 
defining them as macro in config/i386/nm-i386.h?  

Any comments on this thought?  Thanks.

2. Following the above thought, I comment out these four macros in 
config/i386/nm-i386.h, and add them into i386-linux-nat.c

This time, local gdb will call remote_insert_watchpoint indeed, but I get 
another error:

 Can't clear hardware watchpoints without the 'Z2' (write-watchpoint) packet.

"set debug remote 1" tell me that Packet Z2 (write-watchpoint) is NOT 
supported

I tried to use "set remote  write-watchpoint-packet 1", but it won't work 
either:

 Enabled packet Z2 (write-watchpoint) not recognized by stub

my question here is:

What is the stub refered to here?  Is it the gdbserver?  And how can 
gdbserver determine which packat he will support, which won't?  

As far as I understand,  now that the underlying target support hardware 
watchpoint, there is not any practical obstacle for gdbserver on i386 to 
support this kind of packets.  If I am wrong, please forgive me and 
correct me. (I am no expert in this field anyway.  :-)

3. I also have a question about the overall status of gdb's support for 
remote debugging on different platforms.

The available documents (gdb manual, gdb internal) don't mention much 
information about this.  I had thought that all commands avaialbe in local 
gdb will also work in remote mode.  But the practice prove that I am 
wrong.  Playing with remote debugging always make me feel a little 
frustrated.  (I am not very sure what other feels.  I guess embedded 
people will feel more comfortable. :-)

Regards
- Wu Zhou


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Some questions w.r.t remote watchpoint support in i386
  2006-04-25 12:54 Some questions w.r.t remote watchpoint support in i386 Wu Zhou
@ 2006-04-25 19:34 ` Daniel Jacobowitz
  2006-05-22 16:39   ` Wu Zhou
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2006-04-25 19:34 UTC (permalink / raw)
  To: Wu Zhou; +Cc: gdb

On Tue, Apr 25, 2006 at 06:19:53PM +0800, Wu Zhou wrote:
> I am playing with remote debugging on i386 platform.  At the very first, I 
> start gdbserver and gdb on two different i386 machines.  In this configuration, 
> local gdb client can connect to remote gdb server.  But after I set a 
> breakpoint and issue "cont" command, remote debuggee get a SIGV error.

Mismatched libraries between the two is the likely cause.  You can copy
the target libraries to the host and use set solib-absolute-prefix.

> 1. The first error I encounter is: "Couldn't write debug register: No such
> process". 
> 
> After some tracking, I found gdb client is calling target_insert_watchpoint
> defined in config/i386/nm-i386.h, instead of the remote_insert_watchpoint 
> defined in remote.c
> 
> I guess this is a more general problem.  Whenever you change target under 
> i386 platform, you will always get the i386_insert_watchpoint (and other 
> three target operations) executed.
> 
> Maybe we can put these target operation into the target_ops, instead of 
> defining them as macro in config/i386/nm-i386.h?  

Yes, someone needs to fix this.

> 2. Following the above thought, I comment out these four macros in 
> config/i386/nm-i386.h, and add them into i386-linux-nat.c
> 
> This time, local gdb will call remote_insert_watchpoint indeed, but I get 
> another error:
> 
>  Can't clear hardware watchpoints without the 'Z2' (write-watchpoint) packet.
> 
> "set debug remote 1" tell me that Packet Z2 (write-watchpoint) is NOT 
> supported
> 
> I tried to use "set remote  write-watchpoint-packet 1", but it won't work 
> either:
> 
>  Enabled packet Z2 (write-watchpoint) not recognized by stub
> 
> my question here is:
> 
> What is the stub refered to here?  Is it the gdbserver?  And how can 
> gdbserver determine which packat he will support, which won't?  

The stub is gdbserver, yes.  It supports what it supports, and does not
support what no one has implemented!  And no one has implemented i386
watchpoints for gdbserver.

> 3. I also have a question about the overall status of gdb's support for 
> remote debugging on different platforms.

Mostly it depends on the stub.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Some questions w.r.t remote watchpoint support in i386
  2006-04-25 19:34 ` Daniel Jacobowitz
@ 2006-05-22 16:39   ` Wu Zhou
  0 siblings, 0 replies; 3+ messages in thread
From: Wu Zhou @ 2006-05-22 16:39 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb


> > 1. The first error I encounter is: "Couldn't write debug register: No such
> > process". 
> > 
> > After some tracking, I found gdb client is calling target_insert_watchpoint
> > defined in config/i386/nm-i386.h, instead of the remote_insert_watchpoint 
> > defined in remote.c
> > 
> > I guess this is a more general problem.  Whenever you change target under 
> > i386 platform, you will always get the i386_insert_watchpoint (and other 
> > three target operations) executed.
> > 
> > Maybe we can put these target operation into the target_ops, instead of 
> > defining them as macro in config/i386/nm-i386.h?  
> 
> Yes, someone needs to fix this.

I had a closer look at this.  It seems this will involve quite a few gdb 
configs.  Almost all the native header files in config/i386 include 
nm-i386.h, but their responsive native c source are very different.  To 
delete these macros in nm-i386.h, I believe we need to put their 
counterpart target vectore into all these responsive native c source.
And we also need to test that all relevant configs are ok after the 
changes.  It seems hard to me.  Anyone have any good idea?

> 
> > 2. Following the above thought, I comment out these four macros in 
> > config/i386/nm-i386.h, and add them into i386-linux-nat.c
> > 
> > This time, local gdb will call remote_insert_watchpoint indeed, but I get 
> > another error:
> > 
> >  Can't clear hardware watchpoints without the 'Z2' (write-watchpoint) packet.
> > 
> > "set debug remote 1" tell me that Packet Z2 (write-watchpoint) is NOT 
> > supported
> > 
> > I tried to use "set remote  write-watchpoint-packet 1", but it won't work 
> > either:
> > 
> >  Enabled packet Z2 (write-watchpoint) not recognized by stub
> > 
> > my question here is:
> > 
> > What is the stub refered to here?  Is it the gdbserver?  And how can 
> > gdbserver determine which packat he will support, which won't?  
> 
> The stub is gdbserver, yes.  It supports what it supports, and does not
> support what no one has implemented!  And no one has implemented i386
> watchpoints for gdbserver.

It seems that there is not many requirement for this?  Maybe i386 is not a 
very popular gdbserver platform.  :-)


Regards
- Wu Zhou


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-21 14:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-25 12:54 Some questions w.r.t remote watchpoint support in i386 Wu Zhou
2006-04-25 19:34 ` Daniel Jacobowitz
2006-05-22 16:39   ` Wu Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox