Hi,
I am sorry, I didn't explain it very clearly.
In current implementation for i386, a table for hardware breakpoints
is defined as follows:
kdbhard_bp_t kdb_hardbreaks[KDB_MAXHARDBPT];
This means all CPUs share the same data structure of hardware
breakpoints. For example, the breakpoint in DR0 of each CPU refers to
kdb_hardbreaks[0], DR1 refers to kdb_hardbreaks[1], etc. The
kdb_hardbreaks[0] is installed to each CPU, when the CPU leaves KDB. Then,
all hardware breakpoints are global. And you can not create a local one for
one CPU and a different local one for the other CPU. So I change this data
structure into:
kdbhard_bp_t kdb_hardbreaks[KDB_MAXHARDBPT][NR_CPUS];
In addition, each CPU executes kdb_bp_install_local() and
kdb_bp_remove_local() in kdb(), while only the initial CPU executes
kdb_bp_install_global() and kdb_bp_remove_global(). That means only the
initial CPU can install and remove a global breakpoint. But a hardware
global breakpoint must be installed and removed by each CPU itself. So, I
guess that you consider the global breakpoint the same as a instruction
breakpoint. Don't you think it doesn't accord with the definition of KDB
commands "bpa" and "bpha". That's why I rename the string "local" with
"dbreg" and "global" with "inst".
Thanks.
Regards.
Sonic Zhang
-----Original Message-----
From: Keith Owens [mailto:[EMAIL PROTECTED]]
Sent: 2003?2?13? 18:02
To: Zhang, Sonic
Cc: KDB (E-mail)
Subject: Re: About KDB global and local hardware breakpoint support in IA32.
On Thu, 13 Feb 2003 15:59:45 +0800,
"Zhang, Sonic" <[EMAIL PROTECTED]> wrote:
> Current implementation in kdb-v3.0-2.4.20 sees a local breakpoint as
>an equivalence of a global breakpoint. All CPUs share the same data
>structure for hardware debug registers. And each CPU sets its debug
register
>for a hardware breakpoint, no matter whether it is a local one of the other
>CPUs.
Where do you get that from? kdb_bp_install_local() is
void
kdb_bp_install_local(struct pt_regs *regs)
{
int i;
for(i=0; i<KDB_MAXBPT; i++) {
if (KDB_DEBUG(BP)) {
kdb_printf("kdb_bp_install_local bp %d bp_enabled %d
bp_global %d cpu %d bp_cpu %d\n",
i, kdb_breakpoints[i].bp_enabled,
kdb_breakpoints[i].bp_global,
smp_processor_id(),
kdb_breakpoints[i].bp_cpu);
}
if (kdb_breakpoints[i].bp_enabled
&& kdb_breakpoints[i].bp_cpu == smp_processor_id()
&& !kdb_breakpoints[i].bp_global){
kdba_installbp(regs, &kdb_breakpoints[i]);
}
}
}
That function is called for each cpu as it leaves kdb. It only
installs local breakpoints for the current cpu.
kdb_bp() has
if (hardware && !global) {
bp->bp_global = 0;
bp->bp_cpu = smp_processor_id();
}
marking local breakpoints by their cpu number.