History

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.

Vincent Chen committed 6 years ago

Commit f83b04d1 parent eb077c91 file · +12 −0Browse files

Showing the changes to kernel/debug/debug_core.c (1 of 1 file). Show all

Unified · Split

kernel/debug/debug_core.c+12−0
@@ -417,6 +417,18 @@ int kgdb_isremovedbreak(unsigned long addr) · 416 unmodified lines
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;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t