linux-mips
[Top] [All Lists]

Re: Using hardware watchpoint for applications debugging

To: colin <colin@realtek.com.tw>
Subject: Re: Using hardware watchpoint for applications debugging
From: Nigel Stephens <nigel@mips.com>
Date: Thu, 30 Mar 2006 11:49:22 +0100
Cc: linux-mips@linux-mips.org
In-reply-to: <002d01c6539f$d040a200$106215ac@realtek.com.tw>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <024c01c65337$63931c90$106215ac@realtek.com.tw> <442A94D0.1020106@mips.com> <002d01c6539f$d040a200$106215ac@realtek.com.tw>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 1.5 (Windows/20051201)

colin wrote:
> As to adding watchpoint to kernel, there will be another problem.
> ASID in kernel is variable. Therefore, we cannot indicate which thread we
> want to watch by ASID.
> What we can do is setting G (global) bit to WatchHi Register and then all
> threads accessing that address will cause the exception.
> In the exception, it will filter the threads by PID to find out the thread
> we are watching.
>
>   

They're variable, but not very variable: the PID->ASID mapping will only
change when the ASIDs roll over and the ASID gets reallocated to a
different process, which will only happen after another 256 processes
have been created. But in that case your watched process will have to be
allocated a new ASID before it can run again. So you could, perhaps,
modify the TLB management code to clear the Watch registers whenever an
ASID belong to a process with watchpoints is recycled, and then
reprogram the Watch registers when such a process is allocated a new
ASID. Alternatively you could maintain pre-process copies of the Watch
registers, and context switch them along with other per-process register
state -- though that is adding context switch overhead to processes
which don't use watchpoints, and might not be popular with the maintainer.

Nigel



<Prev in Thread] Current Thread [Next in Thread>