aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/kgdb.tmpl10
-rw-r--r--kernel/kgdb.c26
2 files changed, 29 insertions, 7 deletions
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl
index 54d3b158d080..372dec20c8da 100644
--- a/Documentation/DocBook/kgdb.tmpl
+++ b/Documentation/DocBook/kgdb.tmpl
@@ -106,6 +106,16 @@
106 while debugging the kernel. 106 while debugging the kernel.
107 </para> 107 </para>
108 <para> 108 <para>
109 If the architecture that you are using supports the kernel option
110 CONFIG_DEBUG_RODATA, you should consider turning it off. This
111 option will prevent the use of software breakpoints because it
112 marks certain regions of the kernel's memory space as read-only.
113 If kgdb supports it for the architecture you are using, you can
114 use hardware breakpoints if you desire to run with the
115 CONFIG_DEBUG_RODATA option turned on, else you need to turn off
116 this option.
117 </para>
118 <para>
109 Next you should choose one of more I/O drivers to interconnect debugging 119 Next you should choose one of more I/O drivers to interconnect debugging
110 host and debugged target. Early boot debugging requires a KGDB 120 host and debugged target. Early boot debugging requires a KGDB
111 I/O driver that supports early debugging and the driver must be 121 I/O driver that supports early debugging and the driver must be
diff --git a/kernel/kgdb.c b/kernel/kgdb.c
index 3ec23c3ec97f..c0d45b2c4d79 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -166,13 +166,6 @@ early_param("nokgdbroundup", opt_nokgdbroundup);
166 * Weak aliases for breakpoint management, 166 * Weak aliases for breakpoint management,
167 * can be overriden by architectures when needed: 167 * can be overriden by architectures when needed:
168 */ 168 */
169int __weak kgdb_validate_break_address(unsigned long addr)
170{
171 char tmp_variable[BREAK_INSTR_SIZE];
172
173 return probe_kernel_read(tmp_variable, (char *)addr, BREAK_INSTR_SIZE);
174}
175
176int __weak kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr) 169int __weak kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr)
177{ 170{
178 int err; 171 int err;
@@ -191,6 +184,25 @@ int __weak kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle)
191 (char *)bundle, BREAK_INSTR_SIZE); 184 (char *)bundle, BREAK_INSTR_SIZE);
192} 185}
193 186
187int __weak kgdb_validate_break_address(unsigned long addr)
188{
189 char tmp_variable[BREAK_INSTR_SIZE];
190 int err;
191 /* Validate setting the breakpoint and then removing it. In the
192 * remove fails, the kernel needs to emit a bad message because we
193 * are deep trouble not being able to put things back the way we
194 * found them.
195 */
196 err = kgdb_arch_set_breakpoint(addr, tmp_variable);
197 if (err)
198 return err;
199 err = kgdb_arch_remove_breakpoint(addr, tmp_variable);
200 if (err)
201 printk(KERN_ERR "KGDB: Critical breakpoint error, kernel "
202 "memory destroyed at: %lx", addr);
203 return err;
204}
205
194unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs) 206unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs)
195{ 207{
196 return instruction_pointer(regs); 208 return instruction_pointer(regs);