Skip to content

Commit f83b04d

Browse files
VincentZWCpalmer-dabbelt
authored andcommitted
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 <[email protected]> Reviewed-by: Palmer Dabbelt <[email protected]> Acked-by: Daniel Thompson <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent eb077c9 commit f83b04d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

kernel/debug/debug_core.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,18 @@ int kgdb_isremovedbreak(unsigned long addr)
417417
return 0;
418418
}
419419

420+
int kgdb_has_hit_break(unsigned long addr)
421+
{
422+
int i;
423+
424+
for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) {
425+
if (kgdb_break[i].state == BP_ACTIVE &&
426+
kgdb_break[i].bpt_addr == addr)
427+
return 1;
428+
}
429+
return 0;
430+
}
431+
420432
int dbg_remove_all_break(void)
421433
{
422434
int error;

0 commit comments

Comments
 (0)