public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* hardware watchpoints for ppc
@ 2004-07-04  9:06 Wolfgang Schmieder
  2004-07-06 14:51 ` Cal Erickson
       [not found] ` <200407062229.18395.wolfgang.schmieder@onlinehome.de>
  0 siblings, 2 replies; 6+ messages in thread
From: Wolfgang Schmieder @ 2004-07-04  9:06 UTC (permalink / raw)
  To: gdb

Hello,

is there anybody who knows how I can set hardware watchpoints on ppc boards ? 
I have a mpc855 board running a multithreaded application. It appears that 
one thread (always the same thread) has a corrupted stack (always at the same 
address). I guess I need to set a hardware watchpoint in a remote debugging 
session to find the piece of code which is corrupting the stack.

There is one gdb mailing list thread about "supporting hw break/watch for 
embedded ppc", which makes me think that there is at least a patch or 
workaround available to set hardware watchpoints on a ppc board.

Thanks,

Wolfgang

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

* Re: hardware watchpoints for ppc
  2004-07-04  9:06 hardware watchpoints for ppc Wolfgang Schmieder
@ 2004-07-06 14:51 ` Cal Erickson
  2004-07-07  0:28   ` Steven Johnson
       [not found] ` <200407062229.18395.wolfgang.schmieder@onlinehome.de>
  1 sibling, 1 reply; 6+ messages in thread
From: Cal Erickson @ 2004-07-06 14:51 UTC (permalink / raw)
  To: Wolfgang Schmieder; +Cc: gdb

Wolfgang,
 From what I know there are no hardware watchpoints available on the PPC
target boards. You might just try watch which will create a software
watchpoint. These do work on PPC processors.

Cal

Wolfgang Schmieder wrote:

> Hello,
> 
> is there anybody who knows how I can set hardware watchpoints on ppc boards ? 
> I have a mpc855 board running a multithreaded application. It appears that 
> one thread (always the same thread) has a corrupted stack (always at the same 
> address). I guess I need to set a hardware watchpoint in a remote debugging 
> session to find the piece of code which is corrupting the stack.
> 
> There is one gdb mailing list thread about "supporting hw break/watch for 
> embedded ppc", which makes me think that there is at least a patch or 
> workaround available to set hardware watchpoints on a ppc board.
> 
> Thanks,
> 
> Wolfgang
> 
> 


-- 
===========================================================================
Cal Erickson                 MontaVista Software Inc.
Linux Consultant             1237 E. Arques Ave.
Phone (408) 328-0304         Sunnyvale CA 94085
Fax   (408) 328-9204         web http://www.mvista.com
===========================================================================

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

* Re: hardware watchpoints for ppc
  2004-07-06 14:51 ` Cal Erickson
@ 2004-07-07  0:28   ` Steven Johnson
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Johnson @ 2004-07-07  0:28 UTC (permalink / raw)
  To: cerickson; +Cc: Wolfgang Schmieder, gdb

Cal,

The MPC855, being a varient of the MPC860 Family does have hardware 
watchpoint support.  If you debug stub doesnt support it, you are going 
to have to program the registers up manually. (It can be done, but you 
will need to trial and error it).  I suggest reading the section of the 
MPC855 Manual (or MPC860 Manual) on the Breakpoint/Watchpoint 
registers.  It is with the stuff on BDM Debugging.  I have a custom GDB 
Stub that uses BDM to debug the target, it supports it, but I dont know 
anything about commercial stubs or non BDM Stubs support for it.  If you 
are using your own custom stub, or have the code of your stub, you could 
always implement it.

For a once off, I would just manually tweak the SPR registers. 
[CMPA/B/C/D ICR DER COUNTA/B CMPE/F/G/H LCTRL1/2 and ICTRL] to achieve 
what you want.  In my MPC862 book, it is documented in section 45.5 
Development Support Programming Model.  All of these should be able to 
be set from GDB like any other register, if your target is an MPC8XX 
(and not Generic PowerPC).

Steven


Cal Erickson wrote:

> Wolfgang,
> From what I know there are no hardware watchpoints available on the PPC
> target boards. You might just try watch which will create a software
> watchpoint. These do work on PPC processors.
>
> Cal
>
> Wolfgang Schmieder wrote:
>
>> Hello,
>>
>> is there anybody who knows how I can set hardware watchpoints on ppc 
>> boards ? I have a mpc855 board running a multithreaded application. 
>> It appears that one thread (always the same thread) has a corrupted 
>> stack (always at the same address). I guess I need to set a hardware 
>> watchpoint in a remote debugging session to find the piece of code 
>> which is corrupting the stack.
>>
>> There is one gdb mailing list thread about "supporting hw break/watch 
>> for embedded ppc", which makes me think that there is at least a 
>> patch or workaround available to set hardware watchpoints on a ppc 
>> board.
>>
>> Thanks,
>>
>> Wolfgang
>>
>>
>
>

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

* Re: hardware watchpoints for ppc
       [not found]   ` <40EB0C0D.8020806@mvista.com>
@ 2004-07-12 20:38     ` Wolfgang Schmieder
  2004-07-12 23:15       ` Steven Johnson
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schmieder @ 2004-07-12 20:38 UTC (permalink / raw)
  To: cerickson; +Cc: gdb

Hello Cal,

thanks for the hint. I caught the problem in the meanwhile by checking the 
respective address in piece of code which is called very often. It took a lot 
of time and luck.
This way of catching bugs is really hard. Do you know  how I could
obtain the know how to implement hardware watchpoints into the gdb ?

Regards
	Wolfgang


Am Dienstag, 6. Juli 2004 22:31 schrieben Sie:
> Wolfgang,
> We had a similar problem here with some benchmarks we were doing. A
> particular address was being changed at random and we had to find
> what was doing it. So we put a watchpoint on the address and when
> it changed we stopped the process and did a bt to find the culprit.
> It took a while but it worked. This was on a PPC 860 target board
> using a cross built gdb and gdbserver. So it can be done it just
> takes time and patience.
>
> The only processor family that I know that has hardware watchpoints is
> x86. We work here with x86, ppc, mips, arm, xscale, crusoe, and sh.
>
> Cal
>
> Wolfgang Schmieder wrote:
> > Hello Cal,
> >
> > thanks for your anwer, even if it's bad news for me !
> >
> >
> > Regards
> > 	Wolfgang
> >
> > Am Dienstag, 6. Juli 2004 16:45 schrieb Cal Erickson:
> >>Wolfgang,
> >> From what I know there are no hardware watchpoints available on the PPC
> >>target boards. You might just try watch which will create a software
> >>watchpoint. These do work on PPC processors.
> >>
> >>Cal
> >>
> >>Wolfgang Schmieder wrote:
> >>>Hello,
> >>>
> >>>is there anybody who knows how I can set hardware watchpoints on ppc
> >>>boards ? I have a mpc855 board running a multithreaded application. It
> >>>appears that one thread (always the same thread) has a corrupted stack
> >>>(always at the same address). I guess I need to set a hardware
> >>> watchpoint in a remote debugging session to find the piece of code
> >>> which is corrupting the stack.
> >>>
> >>>There is one gdb mailing list thread about "supporting hw break/watch
> >>> for embedded ppc", which makes me think that there is at least a patch
> >>> or workaround available to set hardware watchpoints on a ppc board.
> >>>
> >>>Thanks,
> >>>
> >>>Wolfgang

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

* Re: hardware watchpoints for ppc
  2004-07-12 20:38     ` Wolfgang Schmieder
@ 2004-07-12 23:15       ` Steven Johnson
  2004-09-25 15:08         ` Wolfgang Schmieder
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Johnson @ 2004-07-12 23:15 UTC (permalink / raw)
  To: Wolfgang Schmieder; +Cc: cerickson, gdb

Wolfgang,

Are you running GDB on your PowerPC Target? Or are you using a stub of 
some kind?

The Stub isnt GDB.

What PowerPC chip are you talking about, they all have different 
features when it comes to debug units, there is no standard "watchpoint" 
unit that all PowerPC's have.

I would guess you are using  GDB on you PC, and it is talking to your 
target using the Remote Serial Protocol.  If so, the place for your 
watchpoint code is in the stub, not in GDB.  The remote serial protocol 
already has support for hardware watchpoints, my stub on PowerPC uses it 
to implement them for an MPC860 Family processor.  You need to add the 
support to your stub, alternatively write some macros in GDB to manually 
set up the watchpoint units, using register read/write operations.  GDB 
wont know you have done this, but if when they hit its causes your stub 
to stop you have achieved what you want.

As for the know how, the MPC860 documentation details that family of 
processor's watchpoint unit, and what it does.  Its cryptic, and you 
have to trial and error it a bit, but that is usually the way with these 
things.  Your processor should have a document that describes if it has 
a hardware watchpoint unit, and if so how to set it up.  Then it is a 
matter of implementing the Remote Serial protocol watchpoint commands.

Steven.


Wolfgang Schmieder wrote:

>Hello Cal,
>
>thanks for the hint. I caught the problem in the meanwhile by checking the 
>respective address in piece of code which is called very often. It took a lot 
>of time and luck.
>This way of catching bugs is really hard. Do you know  how I could
>obtain the know how to implement hardware watchpoints into the gdb ?
>
>Regards
>	Wolfgang
>
>
>Am Dienstag, 6. Juli 2004 22:31 schrieben Sie:
>  
>
>>Wolfgang,
>>We had a similar problem here with some benchmarks we were doing. A
>>particular address was being changed at random and we had to find
>>what was doing it. So we put a watchpoint on the address and when
>>it changed we stopped the process and did a bt to find the culprit.
>>It took a while but it worked. This was on a PPC 860 target board
>>using a cross built gdb and gdbserver. So it can be done it just
>>takes time and patience.
>>
>>The only processor family that I know that has hardware watchpoints is
>>x86. We work here with x86, ppc, mips, arm, xscale, crusoe, and sh.
>>
>>Cal
>>
>>Wolfgang Schmieder wrote:
>>    
>>
>>>Hello Cal,
>>>
>>>thanks for your anwer, even if it's bad news for me !
>>>
>>>
>>>Regards
>>>	Wolfgang
>>>
>>>Am Dienstag, 6. Juli 2004 16:45 schrieb Cal Erickson:
>>>      
>>>
>>>>Wolfgang,
>>>From what I know there are no hardware watchpoints available on the PPC
>>>>target boards. You might just try watch which will create a software
>>>>watchpoint. These do work on PPC processors.
>>>>
>>>>Cal
>>>>
>>>>Wolfgang Schmieder wrote:
>>>>        
>>>>
>>>>>Hello,
>>>>>
>>>>>is there anybody who knows how I can set hardware watchpoints on ppc
>>>>>boards ? I have a mpc855 board running a multithreaded application. It
>>>>>appears that one thread (always the same thread) has a corrupted stack
>>>>>(always at the same address). I guess I need to set a hardware
>>>>>watchpoint in a remote debugging session to find the piece of code
>>>>>which is corrupting the stack.
>>>>>
>>>>>There is one gdb mailing list thread about "supporting hw break/watch
>>>>>for embedded ppc", which makes me think that there is at least a patch
>>>>>or workaround available to set hardware watchpoints on a ppc board.
>>>>>
>>>>>Thanks,
>>>>>
>>>>>Wolfgang
>>>>>          
>>>>>
>
>
>
>  
>

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

* Re: hardware watchpoints for ppc
  2004-07-12 23:15       ` Steven Johnson
@ 2004-09-25 15:08         ` Wolfgang Schmieder
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schmieder @ 2004-09-25 15:08 UTC (permalink / raw)
  To: Steven Johnson; +Cc: cerickson, gdb, jan.schneider

Hello Steven,

I am sorry for answering very late. In the meanwhile I found my bug
without enabling watchpoints. Nevertheless I will keep on working
on hardware watchpoints for ppc, but not by myself. Jan Schneider has
taken the task to enhance the gdb regarding hardware watchpoints. 
He is in this mailing list since beginning of september.

Thanks and regards 
	Wolfgang Schmieder


> Wolfgang,
>
> Are you running GDB on your PowerPC Target? Or are you using a stub of
> some kind?
>
> The Stub isnt GDB.
>
> What PowerPC chip are you talking about, they all have different
> features when it comes to debug units, there is no standard "watchpoint"
> unit that all PowerPC's have.
>
> I would guess you are using  GDB on you PC, and it is talking to your
> target using the Remote Serial Protocol.  If so, the place for your
> watchpoint code is in the stub, not in GDB.  The remote serial protocol
> already has support for hardware watchpoints, my stub on PowerPC uses it
> to implement them for an MPC860 Family processor.  You need to add the
> support to your stub, alternatively write some macros in GDB to manually
> set up the watchpoint units, using register read/write operations.  GDB
> wont know you have done this, but if when they hit its causes your stub
> to stop you have achieved what you want.
>
> As for the know how, the MPC860 documentation details that family of
> processor's watchpoint unit, and what it does.  Its cryptic, and you
> have to trial and error it a bit, but that is usually the way with these
> things.  Your processor should have a document that describes if it has
> a hardware watchpoint unit, and if so how to set it up.  Then it is a
> matter of implementing the Remote Serial protocol watchpoint commands.
>
> Steven.
>
> Wolfgang Schmieder wrote:
> >Hello Cal,
> >
> >thanks for the hint. I caught the problem in the meanwhile by checking the
> >respective address in piece of code which is called very often. It took a
> > lot of time and luck.
> >This way of catching bugs is really hard. Do you know  how I could
> >obtain the know how to implement hardware watchpoints into the gdb ?
> >
> >Regards
> >	Wolfgang
> >
> >Am Dienstag, 6. Juli 2004 22:31 schrieben Sie:
> >>Wolfgang,
> >>We had a similar problem here with some benchmarks we were doing. A
> >>particular address was being changed at random and we had to find
> >>what was doing it. So we put a watchpoint on the address and when
> >>it changed we stopped the process and did a bt to find the culprit.
> >>It took a while but it worked. This was on a PPC 860 target board
> >>using a cross built gdb and gdbserver. So it can be done it just
> >>takes time and patience.
> >>
> >>The only processor family that I know that has hardware watchpoints is
> >>x86. We work here with x86, ppc, mips, arm, xscale, crusoe, and sh.
> >>
> >>Cal
> >>
> >>Wolfgang Schmieder wrote:
> >>>Hello Cal,
> >>>
> >>>thanks for your anwer, even if it's bad news for me !
> >>>
> >>>
> >>>Regards
> >>>	Wolfgang
> >>>
> >>>Am Dienstag, 6. Juli 2004 16:45 schrieb Cal Erickson:
> >>>>Wolfgang,
> >>>>From what I know there are no hardware watchpoints available on the PPC
> >>>>target boards. You might just try watch which will create a software
> >>>>watchpoint. These do work on PPC processors.
> >>>>
> >>>>Cal
> >>>>
> >>>>Wolfgang Schmieder wrote:
> >>>>>Hello,
> >>>>>
> >>>>>is there anybody who knows how I can set hardware watchpoints on ppc
> >>>>>boards ? I have a mpc855 board running a multithreaded application. It
> >>>>>appears that one thread (always the same thread) has a corrupted stack
> >>>>>(always at the same address). I guess I need to set a hardware
> >>>>>watchpoint in a remote debugging session to find the piece of code
> >>>>>which is corrupting the stack.
> >>>>>
> >>>>>There is one gdb mailing list thread about "supporting hw break/watch
> >>>>>for embedded ppc", which makes me think that there is at least a patch
> >>>>>or workaround available to set hardware watchpoints on a ppc board.
> >>>>>
> >>>>>Thanks,
> >>>>>
> >>>>>Wolfgang

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

end of thread, other threads:[~2004-09-25 15:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-04  9:06 hardware watchpoints for ppc Wolfgang Schmieder
2004-07-06 14:51 ` Cal Erickson
2004-07-07  0:28   ` Steven Johnson
     [not found] ` <200407062229.18395.wolfgang.schmieder@onlinehome.de>
     [not found]   ` <40EB0C0D.8020806@mvista.com>
2004-07-12 20:38     ` Wolfgang Schmieder
2004-07-12 23:15       ` Steven Johnson
2004-09-25 15:08         ` Wolfgang Schmieder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).