Re: [PATCH 2/4] kgdb: Make gdbstub_exit a nop unless gdb is attached
From: Jason Wessel
Date: Fri Mar 16 2012 - 12:04:26 EST
On 03/16/2012 07:17 AM, Jan Kiszka wrote:
> This allows to call gdbstub_exit without worrying if
> - CONFIG_KGDB is enabled
> - if an kgdb I/O driver is loaded
> - if a gdb frontend is currently attached
If you took a look at the alternate patch I sent in the 4 of 4 response, I made a modification for kdb to continue to work properly, namely disconnect and do not emit characters if we are in kdb mode.
>
> diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c
> index c22d8c2..5d7ed0a 100644
> --- a/kernel/debug/gdbstub.c
> +++ b/kernel/debug/gdbstub.c
> @@ -1111,6 +1111,9 @@ void gdbstub_exit(int status)
> unsigned char checksum, ch, buffer[3];
> int loop;
>
> + if (!dbg_io_ops || !kgdb_connected)
> + return;
> +
> buffer[0] = 'W';
> buffer[1] = hex_asc_hi(status);
> buffer[2] = hex_asc_lo(status);
I patched against what you originally had there.
--- a/kernel/debug/gdbstub.c
+++ b/kernel/debug/gdbstub.c
@@ -1110,8 +1110,11 @@ void gdbstub_exit(int status)
{
unsigned char checksum, ch, buffer[3];
int loop;
+ if (!kgdb_connected)
+ return;
+ kgdb_connected = 0;
- if (!dbg_io_ops || !kgdb_connected)
+ if (!dbg_io_ops || dbg_kdb_mode)
return;
buffer[0] = 'W';
---
Depending on what we come to agreement on with patches 2-4 in your series I'll fold the changes into the reboot notifier.
It is possible to have both the reboot notifier and the low level modifications to the arch specific reboot hooks as a final catch, but I am interested to see what you think about just using the reboot notifier.
Cheers,
Jason.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/