kgdb: Add kgdb_has_hit_break function
The break instruction in RISC-V does not have an immediate value field, so the kernel cannot identify the purpose of each trap exception through the opcode. This makes the existing identification schemes in other architecture unsuitable for the RISC-V kernel. To solve this problem, this patch adds kgdb_has_hit_break(), which can help RISC-V kernel identify the KGDB trap exception. Signed-off-by: Vincent Chen <vincent.chen@sifive.com> Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com> Acked-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
This commit is contained in:
parent
eb077c9c38
commit
f83b04d36e
|
@ -417,6 +417,18 @@ int kgdb_isremovedbreak(unsigned long addr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int kgdb_has_hit_break(unsigned long addr)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) {
|
||||||
|
if (kgdb_break[i].state == BP_ACTIVE &&
|
||||||
|
kgdb_break[i].bpt_addr == addr)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int dbg_remove_all_break(void)
|
int dbg_remove_all_break(void)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
Loading…
Reference in a new issue