diff options
-rw-r--r-- | drivers/misc/kgdbts.c | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c index 3f7ad83ed740..997e94d618ba 100644 --- a/drivers/misc/kgdbts.c +++ b/drivers/misc/kgdbts.c | |||
@@ -885,6 +885,22 @@ static void run_singlestep_break_test(void) | |||
885 | kgdbts_break_test(); | 885 | kgdbts_break_test(); |
886 | } | 886 | } |
887 | 887 | ||
888 | static void test_debug_rodata(void) | ||
889 | { | ||
890 | #ifdef CONFIG_DEBUG_RODATA | ||
891 | /* Until there is an api to write to read-only text segments, use | ||
892 | * HW breakpoints for the remainder of any tests, else print a | ||
893 | * failure message if hw breakpoints do not work. | ||
894 | */ | ||
895 | if (!(arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT && hwbreaks_ok)) { | ||
896 | eprintk("kgdbts: HW breakpoints BROKEN, ending tests\n"); | ||
897 | return; | ||
898 | } | ||
899 | force_hwbrks = 1; | ||
900 | v1printk("kgdbts:Using HW breakpoints for SW breakpoint tests\n"); | ||
901 | #endif /* CONFIG_DEBUG_RODATA */ | ||
902 | } | ||
903 | |||
888 | static void kgdbts_run_tests(void) | 904 | static void kgdbts_run_tests(void) |
889 | { | 905 | { |
890 | char *ptr; | 906 | char *ptr; |
@@ -907,6 +923,18 @@ static void kgdbts_run_tests(void) | |||
907 | if (ptr) | 923 | if (ptr) |
908 | sstep_test = simple_strtol(ptr+1, NULL, 10); | 924 | sstep_test = simple_strtol(ptr+1, NULL, 10); |
909 | 925 | ||
926 | /* All HW break point tests */ | ||
927 | if (arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT) { | ||
928 | hwbreaks_ok = 1; | ||
929 | v1printk("kgdbts:RUN hw breakpoint test\n"); | ||
930 | run_breakpoint_test(1); | ||
931 | v1printk("kgdbts:RUN hw write breakpoint test\n"); | ||
932 | run_hw_break_test(1); | ||
933 | v1printk("kgdbts:RUN access write breakpoint test\n"); | ||
934 | run_hw_break_test(0); | ||
935 | } | ||
936 | test_debug_rodata(); | ||
937 | |||
910 | /* required internal KGDB tests */ | 938 | /* required internal KGDB tests */ |
911 | v1printk("kgdbts:RUN plant and detach test\n"); | 939 | v1printk("kgdbts:RUN plant and detach test\n"); |
912 | run_plant_and_detach_test(0); | 940 | run_plant_and_detach_test(0); |
@@ -924,35 +952,11 @@ static void kgdbts_run_tests(void) | |||
924 | 952 | ||
925 | /* ===Optional tests=== */ | 953 | /* ===Optional tests=== */ |
926 | 954 | ||
927 | /* All HW break point tests */ | ||
928 | if (arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT) { | ||
929 | hwbreaks_ok = 1; | ||
930 | v1printk("kgdbts:RUN hw breakpoint test\n"); | ||
931 | run_breakpoint_test(1); | ||
932 | v1printk("kgdbts:RUN hw write breakpoint test\n"); | ||
933 | run_hw_break_test(1); | ||
934 | v1printk("kgdbts:RUN access write breakpoint test\n"); | ||
935 | run_hw_break_test(0); | ||
936 | } | ||
937 | |||
938 | if (nmi_sleep) { | 955 | if (nmi_sleep) { |
939 | v1printk("kgdbts:RUN NMI sleep %i seconds test\n", nmi_sleep); | 956 | v1printk("kgdbts:RUN NMI sleep %i seconds test\n", nmi_sleep); |
940 | run_nmi_sleep_test(nmi_sleep); | 957 | run_nmi_sleep_test(nmi_sleep); |
941 | } | 958 | } |
942 | 959 | ||
943 | #ifdef CONFIG_DEBUG_RODATA | ||
944 | /* Until there is an api to write to read-only text segments, use | ||
945 | * HW breakpoints for the remainder of any tests, else print a | ||
946 | * failure message if hw breakpoints do not work. | ||
947 | */ | ||
948 | if (!(arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT && hwbreaks_ok)) { | ||
949 | eprintk("kgdbts: HW breakpoints do not work," | ||
950 | "skipping remaining tests\n"); | ||
951 | return; | ||
952 | } | ||
953 | force_hwbrks = 1; | ||
954 | #endif /* CONFIG_DEBUG_RODATA */ | ||
955 | |||
956 | /* If the do_fork test is run it will be the last test that is | 960 | /* If the do_fork test is run it will be the last test that is |
957 | * executed because a kernel thread will be spawned at the very | 961 | * executed because a kernel thread will be spawned at the very |
958 | * end to unregister the debug hooks. | 962 | * end to unregister the debug hooks. |